MyLocationOverlay in mapsforge 0.4.0

562 views
Skip to first unread message

Daniele Germano

unread,
Jun 9, 2014, 7:00:04 AM6/9/14
to mapsfo...@googlegroups.com
Hello

I have problems using myLocationOverlay.

In mapsforge 0.3.1 i use this:

Drawable drawable = getResources().getDrawable(R.drawable.current_position);

drawable = Marker.boundCenter(drawable);

this.myLocationOverlay = new MyLocationOverlay(this, this.mapView, drawable);


But this code seems not to be good in maps forge 0.4.0


How can i use MyLocationOverlay in mapsforge 0.4.0?

Daniele Germano

unread,
Jun 9, 2014, 7:01:38 AM6/9/14
to mapsfo...@googlegroups.com
Nevermind
 
I found the answer in the Samples...

Emux

unread,
Jun 9, 2014, 7:02:47 AM6/9/14
to mapsfo...@googlegroups.com
You can see at the Samples, the LocationOverlayMapViewer.

--
Emux
Cruiser - Atlas

Daniele Germano

unread,
Jun 9, 2014, 7:14:54 AM6/9/14
to mapsfo...@googlegroups.com
Yes, i foud.

I see that many things has changed.
for example getMapViewPosition()  and getZoomIn()  and getZoomOut()  has been replaced?

Emux

unread,
Jun 9, 2014, 7:22:24 AM6/9/14
to mapsfo...@googlegroups.com
Try mapView.getModel().mapViewPosition

What do you mean with the zoom?

Daniele Germano

unread,
Jun 9, 2014, 7:25:44 AM6/9/14
to mapsfo...@googlegroups.com
to zoom with custom zoom buttons

Emux

unread,
Jun 9, 2014, 7:27:02 AM6/9/14
to mapsfo...@googlegroups.com
mapView.getModel().mapViewPosition.zoomIn()
mapView.getModel().mapViewPosition.zoomOut()

Daniele Germano

unread,
Jun 9, 2014, 7:32:31 AM6/9/14
to mapsfo...@googlegroups.com
Thank you very much.

I have some problems to understand how the new mylocationOverlay works.

i heve add this outside the onCreate

protected ArrayList<MapViewPosition> mapViewPositions = new ArrayList<MapViewPosition>();

protected ArrayList<LayerManager> layerManagers = new ArrayList<LayerManager>();

private MyLocationOverlay myLocationOverlay;


and this inside the onCreate


 // a marker to show at the position

        Drawable drawable = getResources().getDrawable(R.drawable.current_position);

        Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);


        // create the overlay and tell it to follow the location

        this.myLocationOverlay = new MyLocationOverlay(thisthis.mapViewPositions.get(0), bitmap);

        this.myLocationOverlay.setSnapToLocationEnabled(true);

        this.layerManagers.get(0).getLayers().add(this.myLocationOverlay);

        this.myLocationOverlay.enableMyLocation(true);


But if i try to run the app, i get a RunTimeException error.

What is wrong with the code?

Emux

unread,
Jun 9, 2014, 7:42:57 AM6/9/14
to mapsfo...@googlegroups.com
Please include the stack trace of the exceptions, it helps us to diagnose any problems.

I see you follow the BasicMapViewer example. You call:
this.layerManagers.get(0)
Have you filled prior the layerManagers list?

I recommend to check also the GettingStartedAndroidApp Wiki, it'll help you understand better new mapsforge API.

Daniele Germano

unread,
Jun 9, 2014, 7:47:59 AM6/9/14
to mapsfo...@googlegroups.com
I have use the example int he Wiki. it works fine, i just have trouble with the location overlay.


this is the stack

06-09 13:39:26.757: E/AndroidRuntime(22691): FATAL EXCEPTION: main
06-09 13:39:26.757: E/AndroidRuntime(22691): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapsforgerescueprova/com.example.mapsforgerescueprova.MainActivity}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.app.ActivityThread.access$700(ActivityThread.java:150)
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.os.Handler.dispatchMessage(Handler.java:99)
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.os.Looper.loop(Looper.java:137)
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.app.ActivityThread.main(ActivityThread.java:5283)
06-09 13:39:26.757: E/AndroidRuntime(22691): at java.lang.reflect.Method.invokeNative(Native Method)
06-09 13:39:26.757: E/AndroidRuntime(22691): at java.lang.reflect.Method.invoke(Method.java:511)
06-09 13:39:26.757: E/AndroidRuntime(22691): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
06-09 13:39:26.757: E/AndroidRuntime(22691): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
06-09 13:39:26.757: E/AndroidRuntime(22691): at dalvik.system.NativeStart.main(Native Method)
06-09 13:39:26.757: E/AndroidRuntime(22691): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
06-09 13:39:26.757: E/AndroidRuntime(22691): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
06-09 13:39:26.757: E/AndroidRuntime(22691): at java.util.ArrayList.get(ArrayList.java:304)
06-09 13:39:26.757: E/AndroidRuntime(22691): at com.example.mapsforgerescueprova.MainActivity.onCreate(MainActivity.java:78)
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.app.Activity.performCreate(Activity.java:5283)
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
06-09 13:39:26.757: E/AndroidRuntime(22691): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
06-09 13:39:26.757: E/AndroidRuntime(22691): ... 11 more

Emux

unread,
Jun 9, 2014, 7:54:57 AM6/9/14
to mapsfo...@googlegroups.com
If you follow the BasicMapViewer example you have to check it's whole life cycle.
e.g. do you use the createLayerManagers method?

Probably it's easier to start with GettingStartedAndroidApp and build upon it.

Daniele Germano

unread,
Jun 9, 2014, 8:10:06 AM6/9/14
to mapsfo...@googlegroups.com
This is the activity

public class MainActivity extends Activity {

protected ArrayList<MapViewPosition> mapViewPositions = new ArrayList<MapViewPosition>();

protected ArrayList<LayerManager> layerManagers = new ArrayList<LayerManager>();

protected ArrayList<MapView> mapViews = new ArrayList<MapView>();

private MyLocationOverlay myLocationOverlay;

private static final String MAPFILE = "berlin.map";

 

ImageButton zoomIn;

ImageButton zoomOut;

     

     private MapView mapView;        

     private TileCache tileCache;

     private TileRendererLayer tileRendererLayer;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

AndroidGraphicFactory.createInstance(this.getApplication());

setContentView(R.layout.activity_main);

this.mapView = (MapView) findViewById(R.id.mapView);


        this.mapView.setClickable(true);

        this.mapView.getMapScaleBar().setVisible(true);

        this.mapView.setBuiltInZoomControls(false);

        this.mapView.getMapZoomControls().setZoomLevelMin((byte) 10);

        this.mapView.getMapZoomControls().setZoomLevelMax((byte) 20);


        // create a tile cache of suitable size

        this.tileCache = AndroidUtil.createTileCache(this, "mapcache",

                        mapView.getModel().displayModel.getTileSize(), 1f, 

                        this.mapView.getModel().frameBufferModel.getOverdrawFactor());

    

        // a marker to show at the position

       Drawable drawable = getResources().getDrawable(R.drawable.current_position);

       Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);


        // create the overlay and tell it to follow the location

        this.myLocationOverlay = new MyLocationOverlay(this, this.mapViewPositions.get(0), bitmap);

        this.myLocationOverlay.setSnapToLocationEnabled(true);

        this.layerManagers.get(0).getLayers().add(this.myLocationOverlay);

        this.myLocationOverlay.enableMyLocation(true);

       

        zoomIn = (ImageButton) findViewById(R.id.zoomIn);

zoomIn.setBackgroundResource(R.drawable.action_click_zoom_in);

zoomOut = (ImageButton) findViewById(R.id.zoomOut);

zoomOut.setBackgroundResource(R.drawable.action_click_zoom_out);

zoomIn.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {


    mapView.getModel().mapViewPosition.zoomIn();

   

    }

});

zoomOut.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {

   

    mapView.getModel().mapViewPosition.zoomOut();


   

    }

});

        

}

@Override

     protected void onStart() {

             super.onStart();

             

             this.mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));

             this.mapView.getModel().mapViewPosition.setZoomLevel((byte) 12);


             // tile renderer layer using internal render theme

             this.tileRendererLayer = new TileRendererLayer(tileCache,

                             this.mapView.getModel().mapViewPosition, false, AndroidGraphicFactory.INSTANCE);

             tileRendererLayer.setMapFile(getMapFile());

             tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);

             

             // only once a layer is associated with a mapView the rendering starts

             this.mapView.getLayerManager().getLayers().add(tileRendererLayer);

             


     }


     @Override

     protected void onStop() {

             super.onStop();

             this.mapView.getLayerManager().getLayers().remove(this.tileRendererLayer);

             this.tileRendererLayer.onDestroy();

     }


     @Override

     protected void onDestroy() {

             super.onDestroy();

             this.tileCache.destroy();

     }

     

     private File getMapFile() {

             File file = new File(Environment.getExternalStorageDirectory(), MAPFILE);

             return file;

     }


@Override

public boolean onCreateOptionsMenu(Menu menu) {


// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.main, menu);

return true;

}


@Override

public boolean onOptionsItemSelected(MenuItem item) {

// Handle action bar item clicks here. The action bar will

// automatically handle clicks on the Home/Up button, so long

// as you specify a parent activity in AndroidManifest.xml.

int id = item.getItemId();

if (id == R.id.action_settings) {

return true;

}

return super.onOptionsItemSelected(item);

Emux

unread,
Jun 9, 2014, 8:18:56 AM6/9/14
to mapsfo...@googlegroups.com
The BasicMapViewer structure with the lists exists in order to support the multiple activities that extend it.
You don't need lists if you have only one map view.

Try replacing the
this.layerManagers.get(0).getLayers().add(this.myLocationOverlay);
with
this.mapView.getLayerManager().getLayers().add(this.myLocationOverlay);

Also you have to add my location overlay over the tile overlays.
Now you add my location overlay at onCreate and later the tile overlay at onStart.

Daniele Germano

unread,
Jun 9, 2014, 8:35:09 AM6/9/14
to mapsfo...@googlegroups.com
I have try to do as you say, but i get the same error. I have change the line of code you suggest. I don't understand what about add my location over the tile overlays



Il giorno lunedì 9 giugno 2014 14:18:56 UTC+2, emux ha scritto:

Emux

unread,
Jun 9, 2014, 8:45:37 AM6/9/14
to mapsfo...@googlegroups.com
From rewrite mapsforge handles the tiles as a layer too.
So you add at the bottom the tiles layer (e.g. TileRendererLayer) and above it the other layers (e.g. my location).

The exception you posted earlier shows that at MainActivity:78 you try to parse an ArrayList which is empty.

Daniele Germano

unread,
Jun 9, 2014, 8:56:03 AM6/9/14
to mapsfo...@googlegroups.com
So if i have understand correctly, i should call first tileLayer and the the location layer.
I have try to change the code like this in the onCreate

this.mapView.getLayerManager().getLayers().add(tileRendererLayer);

        // create the overlay and tell it to follow the location

        this.myLocationOverlay = new MyLocationOverlay(this, this.mapViewPositions.get(0), bitmap);

        this.myLocationOverlay.setSnapToLocationEnabled(true);

        this.mapView.getLayerManager().getLayers().add(this.myLocationOverlay);

        this.myLocationOverlay.enableMyLocation(true);


But now i get the error IllegalArgumentException:layer must not be null


this is the stack


06-09 14:53:11.684: E/AndroidRuntime(5904): FATAL EXCEPTION: main

06-09 14:53:11.684: E/AndroidRuntime(5904): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapsforgerescueprova/com.example.mapsforgerescueprova.MainActivity}: java.lang.IllegalArgumentException: layer must not be null

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.app.ActivityThread.access$700(ActivityThread.java:150)

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.os.Handler.dispatchMessage(Handler.java:99)

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.os.Looper.loop(Looper.java:137)

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.app.ActivityThread.main(ActivityThread.java:5283)

06-09 14:53:11.684: E/AndroidRuntime(5904): at java.lang.reflect.Method.invokeNative(Native Method)

06-09 14:53:11.684: E/AndroidRuntime(5904): at java.lang.reflect.Method.invoke(Method.java:511)

06-09 14:53:11.684: E/AndroidRuntime(5904): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)

06-09 14:53:11.684: E/AndroidRuntime(5904): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)

06-09 14:53:11.684: E/AndroidRuntime(5904): at dalvik.system.NativeStart.main(Native Method)

06-09 14:53:11.684: E/AndroidRuntime(5904): Caused by: java.lang.IllegalArgumentException: layer must not be null

06-09 14:53:11.684: E/AndroidRuntime(5904): at org.mapsforge.map.layer.Layers.checkIsNull(Layers.java:43)

06-09 14:53:11.684: E/AndroidRuntime(5904): at org.mapsforge.map.layer.Layers.add(Layers.java:73)

06-09 14:53:11.684: E/AndroidRuntime(5904): at com.example.mapsforgerescueprova.MainActivity.onCreate(MainActivity.java:79)

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.app.Activity.performCreate(Activity.java:5283)

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)

06-09 14:53:11.684: E/AndroidRuntime(5904): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)

06-09 14:53:11.684: E/AndroidRuntime(5904): ... 11 more

Emux

unread,
Jun 9, 2014, 9:01:26 AM6/9/14
to mapsfo...@googlegroups.com
From your previous code, I remember that you create the TileRendererLayer at onStart (which is called after onCreate).
So now you try to add a layer that has not been created yet.

You need to reorder the life cycle of your app.
You can move the layers creation (and add) completely at onStart, like the GettingStartedAndroidApp.

Daniele Germano

unread,
Jun 9, 2014, 9:08:26 AM6/9/14
to mapsfo...@googlegroups.com
Nothing, i get the first stack error i post. The error is at this line

this.myLocationOverlay = new MyLocationOverlay(this, this.mapViewPositions.get(0), bitmap);



i put the code in onStart


 @Override

     protected void onStart() {

             super.onStart();

             

             this.mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));

             this.mapView.getModel().mapViewPosition.setZoomLevel((byte) 12);


             // tile renderer layer using internal render theme

             this.tileRendererLayer = new TileRendererLayer(tileCache,

                             this.mapView.getModel().mapViewPosition, false, AndroidGraphicFactory.INSTANCE);

             tileRendererLayer.setMapFile(getMapFile());

             tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);

             

             // only once a layer is associated with a mapView the rendering starts

             this.mapView.getLayerManager().getLayers().add(tileRendererLayer);

             

             Drawable drawable = getResources().getDrawable(R.drawable.current_position);

             Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);


              // create the overlay and tell it to follow the location

              this.myLocationOverlay = new MyLocationOverlay(this, this.mapViewPositions.get(0), bitmap);

              this.myLocationOverlay.setSnapToLocationEnabled(true);

              this.mapView.getLayerManager().getLayers().add(this.myLocationOverlay);

              this.myLocationOverlay.enableMyLocation(true);

             


     }


Emux

unread,
Jun 9, 2014, 9:12:15 AM6/9/14
to mapsfo...@googlegroups.com
You're using at MyLocationOverlay constructor the mapViewPositions list that's probably empty.

Try using this.mapView.getModel().mapViewPosition

Daniele Germano

unread,
Jun 9, 2014, 9:20:49 AM6/9/14
to mapsfo...@googlegroups.com
problem solved

i put 

this.myLocationOverlay = new MyLocationOverlay(this, mapView.getModel().mapViewPosition, bitmap);


instead of


this.myLocationOverlay = new MyLocationOverlay(thisthis.mapViewPositions.get(0), bitmap);


Is ok?

Emux

unread,
Jun 9, 2014, 9:23:45 AM6/9/14
to mapsfo...@googlegroups.com
Yes, you probably can remove all lists copied from BasicMapViewer, as you're not using them and in order to avoid such errors.

Daniele Germano

unread,
Jun 9, 2014, 9:44:49 AM6/9/14
to mapsfo...@googlegroups.com
Thanks for your help.

Is normal that the map flick for a moment when i move it with the finger?

Emux

unread,
Jun 9, 2014, 9:46:14 AM6/9/14
to mapsfo...@googlegroups.com
Yes it's a known issue.
Try setting android:hardwareAccelerated="false" at manifest.

Daniele Germano

unread,
Jun 9, 2014, 9:50:48 AM6/9/14
to mapsfo...@googlegroups.com
Perfect, thank you

Daniele Germano

unread,
Jun 10, 2014, 7:37:45 AM6/10/14
to mapsfo...@googlegroups.com
I was tring to add a marker on map using long press.

following the samples OverlayMapViever, i add a layer with the marker using this:


protected void addOverlayLayers(Layers layers, LatLong geoPoint) {

 

Drawable drawable = getResources().getDrawable(R.drawable.current_position);

Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);

myMarker = new Marker(geoPoint, bitmap, 0, 0);

layers.add(myMarker);

}

and for remove (i use an alert dialog to delete markers) i call this:

protected void removeOverlayLayers(Layers layers, LatLong geoPoint) {


layers.remove(myMarker);

}

This method allow the user to add multiple markers. But from the dialog, no matter which marker i choose, it delete only the last marker positioned on map. i think it's because i delete both marker and the layer.

How can i add and remove just the marker and not the layer?

Emux

unread,
Jun 10, 2014, 7:50:49 AM6/10/14
to mapsfo...@googlegroups.com
A Marker is subclass of Layer, it's nothing different.

Your myMarker variable holds the last marker you put in it, so naturally when you just call layers.remove(myMarker) you remove the last added.

You have to keep track of your markers and at removal to pass the proper one.

e.g. LongPressAction at Samples, where you can see the use of layer's listener in order to interact with the layers directly.

Daniele Germano

unread,
Jun 11, 2014, 5:28:18 AM6/11/14
to mapsfo...@googlegroups.com
Thanks for your advices, really helps me!

I was think, does the scalebar scale itself on different dpi devices? and how can i show bot imperial and metrics scale bar.
is possible in maps forge 0.4.0 add dy to ways?

Emux

unread,
Jun 11, 2014, 6:22:30 AM6/11/14
to mapsfo...@googlegroups.com
Yes scale bar component is scaled based on device dpi.

For the scale bar API check at the BasicMapViewer example, the setScaleBars method.
To show both metric and imperial call:
((DefaultMapScaleBar) scalebar).setScaleBarMode(ScaleBarMode.BOTH);

Recently we have added also the nautical units.
I have changed slightly the API and committed to dev branch.
But I guess you're using the release version of mapsforge.

Render theme v4 supports dy also for lines, line symbols and path texts, besides captions, see the renderTheme-v4.xsd

Daniele Germano

unread,
Jun 11, 2014, 6:56:49 AM6/11/14
to mapsfo...@googlegroups.com
Seems that both mapscalebar are not include in the rescue version

Emux

unread,
Jun 11, 2014, 7:05:21 AM6/11/14
to mapsfo...@googlegroups.com
Map scale bar in mapsforge 0.4.X (aka rescue) works in 3 modes: Metric, Imperial, Both.
Are you sure you're using the right jars?

Daniele Germano

unread,
Jun 11, 2014, 7:14:16 AM6/11/14
to mapsfo...@googlegroups.com
Yes, is rescue. The org.mapsforge.map.scalebar contain:

Adapter.Java
Imperial.Java
MapScaleBar.Java
Metric.Java

But i was able to fix this problem anyway.
Can i replace renderTheme.xsd with renderTheme-v4.xsd?

Emux

unread,
Jun 11, 2014, 7:51:34 AM6/11/14
to mapsfo...@googlegroups.com
The org.mapsforge.map.scalebar package should contain:

DefaultMapScaleBar.java
DistanceUnitAdapter.java
ImperialUnitAdapter.java
MapScaleBar.java
MetricUnitAdapter.java

You're not using the mapsforge 0.4.X but a different branch?
Don't use rescue branch as development continues at master, or use directly the release version.

Mapsforge 0.4.X supports render theme v4, you can certainly advance to it.

Daniele Germano

unread,
Jun 11, 2014, 8:02:47 AM6/11/14
to mapsfo...@googlegroups.com

Emux

unread,
Jun 11, 2014, 8:04:54 AM6/11/14
to mapsfo...@googlegroups.com
You need the master branch, rescue has evolved into master some time ago.
https://code.google.com/p/mapsforge/source/browse/

Daniele Germano

unread,
Jun 11, 2014, 9:15:13 AM6/11/14
to mapsfo...@googlegroups.com
Ok, thanks.

I'm try to apply dy on ways which contains poi, but i does not have any effects.
do i need to add something else? i don't get any error, but seems it doesn't work
example:

<rule e="way" k="shop" v="doityourself" zoom-min="17">

     <symbol src="jar:symbols/tools.png" />

</rule>


<rule e="way" k="shop" v="doityourself" >

     <rule e="way" k="*" v="*" zoom-min="19">

<caption dy="38" k="name" font-family="default" font-style="bold" font-size="22" fill="#f187f8" stroke="#ffffff" stroke-width="3.0" />

     </rule>

</rule>

Emux

unread,
Jun 11, 2014, 9:25:57 AM6/11/14
to mapsfo...@googlegroups.com
I don't think that the POI (having point geometry) can be described with the 'way' element, they need the 'node'.

Ludwig

unread,
Jun 11, 2014, 9:29:59 AM6/11/14
to mapsfo...@googlegroups.com
I guess that would be an area with an area caption. The label placement computes the center of the area, and the dy operator should move the center some 38 points downwards. I have not really tried this, but looking at the code it should work.

Best to try with/without dy and compare with screenshot. The center of  the area might not be where you expect it to be.

Ludwig


--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapsforge-dev/c57e092b-acf5-4bcb-a0fa-74292d3547c4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Daniele Germano

unread,
Jun 11, 2014, 9:34:54 AM6/11/14
to mapsfo...@googlegroups.com
So if i have understand, i can not use dy if poi element is way.

Because i can see the caption and the icon, but i can't let the caption be below the icon, as i do with node.

Daniele Germano

unread,
Jun 11, 2014, 9:36:01 AM6/11/14
to mapsfo...@googlegroups.com
Hi Ludwig
It works with nodes, but seems do not works if is way

Daniele Germano

unread,
Jun 11, 2014, 10:15:07 AM6/11/14
to mapsfo...@googlegroups.com

The first screenshot is with a dy of 44, the second is without dy
Elements are Parkway  Daisy Forever In
Screenshot_2014-06-11-16-10-13.png
Screenshot_2014-06-11-16-11-29.png

Ludwig

unread,
Jun 11, 2014, 8:55:04 PM6/11/14
to mapsfo...@googlegroups.com
I have tried this with the dev branch and it works as it should. I think it should work with master too.



--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
area-nooffset.png
area-offset.png

Tobias

unread,
Jun 12, 2014, 1:42:44 AM6/12/14
to mapsfo...@googlegroups.com
I thought this was only available in dev, as least as discussed here:
https://groups.google.com/forum/#!msg/mapsforge-dev/HQaDBEm4wnY/K6TNwqUytgkJ
With dev it was working great.
Message has been deleted

Emux

unread,
Jun 12, 2014, 2:07:59 AM6/12/14
to mapsfo...@googlegroups.com
I thought this was only available in dev

Render theme v4 is included now also at master (aka 0.5.0-SNAPSHOT).
So in Cruiser / Atlas.

It's not included at release 0.4.3

Ludwig

unread,
Jun 12, 2014, 3:27:05 AM6/12/14
to mapsfo...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.

Tobias

unread,
Jun 12, 2014, 3:48:47 AM6/12/14
to mapsfo...@googlegroups.com
Sorry, too much confusion with dev/master/release. I meant release, and Daniele is using 0.4.0 AFAIK ("is possible in maps forge 0.4.0 add dy to ways?"), where it is not included.

Emux

unread,
Jun 12, 2014, 4:00:20 AM6/12/14
to mapsfo...@googlegroups.com
Check the Downloads page at Wiki, it summarizes the 3 states of mapsforge.

Render theme v4 exists at master (future release) and dev (test new features).

If I understood correctly Daniele downloaded from repository the master,
so render theme v4 features should be available.

Daniele Germano

unread,
Jun 12, 2014, 4:05:50 AM6/12/14
to mapsfo...@googlegroups.com
I moved to master branch. dy on way now works
Reply all
Reply to author
Forward
0 new messages