I have implemented OSMDroid and added a Custom Marker like this:
mResourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
mapView.setTileSource(TileSourceFactory.MAPNIK);
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
mapController = this.mapView.getController();
mapController.setZoom(25);
GeoPoint center = new GeoPoint(DataManager.glat, DataManager.glon);
mapController.setCenter(center);
OverlayItem newItem = new OverlayItem("Here", "SampleDescription", center);
Drawable newMarker = this.getResources().getDrawable(R.drawable.marker);
newItem.setMarker(newMarker);
This marker should be at the user´s location and the map should be centered there by default. This works well, as long as I dont zoom:
But when I zoom out, the marker moves:
The distance increases with zoomlevel:
Any idea what this is caused by? Are there any restrictions/guidelines for custom markers?
Note: This does NOT happen when using the default marker.
Found the problem: Hotspot
Seems like the default Hotspot
is Bottom Center
, in my case, Center
would be the right one. The bottom center of my marker WAS at the right place, it just didnt look like it.
newItem.setMarkerHotspot(HotspotPlace.CENTER);
fixed it
This is basically my marker:
___________
| _ |
| ( ) |
| V |
| |
|___________|