Unless I'm understanding this incorrectly, to initialize osmdroid around a given point you would do as following:
map = (MapView) findViewById(R.id.mapview);
map.setTileSource(TileSourceFactory.MAPNIK);
MapController mapController = (MapController)map.getController();
GeoPoint startPoint = new GeoPoint(52370816, 9735936);
mapController.animateTo(startPoint);
map.setBuiltInZoomControls(true);
mapController.setZoom(2);
map.setUseDataConnection(true);
map.setMultiTouchControls(true);
When I run this however, the map sorta does whatever it wants. It doesn't center on the given GeoPoint
. Changing these numbers doesn't seem to do anything. Am I missing something?
My XML
files are all in order as per the tutorials as are my permissions.
This is a known bug occuring when you set the map view in onCreate: https://github.com/osmdroid/osmdroid/issues/22
Issue is closed because assumed to be fixed in source Head, but it's still not fixed in the 4.2 osmdroid release.
setCenter works fine once the mapview has been drawn once.
Various workarounds can be found in osmdroid project Issue.