Вот мой рабочий код для xytilesource, надеюсь, он кому-нибудь пригодится.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.getController().setZoom(5);
GeoPoint point = new LatLonPoint(6.83917,79.91455);
//mapView.getController().setCenter(new GeoPoint(51500000, 5400000));
mapView.getController().setCenter(point);
final MapTileProviderBasic tileProvider = new MapTileProviderBasic(getApplicationContext());
final ITileSource tileSource = new XYTileSource("SomeName", null, 3,14, 256, ".png",
"http://192.168.1.5/mapcache/tms/1.0.0/ms-base@GoogleMapsCompatible/");
//mapView.setTileSource((new XYTileSource("localMapnik", Resource, 0, 18, 256, ".png",
// "http://tile.openstreetmap.org/")));
tileProvider.setTileSource(tileSource);
final TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, this.getBaseContext());
mapView.getOverlays().add(tilesOverlay);
}
@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;
}
private static final class LatLonPoint extends GeoPoint {
public LatLonPoint(double latitude, double longitude) {
super((int) (latitude * 1E6), (int) (longitude * 1E6));
}
}
Файл макета должен содержать
<org.osmdroid.views.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true" />