Open Street maps in Android -Part 2
For knowing the basics of openstreet maps ,Refer
http://androidtraininginkerala.blogspot.in/2013/01/open-street-maps-in-android-part-1.html
Today ,we have to check how to create offline map using osmdroid.For that we requires
Steps
1:Offline Map Source .
Use MOBAC for creating offline map source.
For knowing the basics of openstreet maps ,Refer
http://androidtraininginkerala.blogspot.in/2013/01/open-street-maps-in-android-part-1.html
Today ,we have to check how to create offline map using osmdroid.For that we requires
Steps
1:Offline Map Source .
Use MOBAC for creating offline map source.
2:After creating zip file,copy that file and paste it inside /sdcard/osmdroid/
For eg: if our zipfile is "mymap.zip",then it should be like
/sdcard/osmdroid/mymap.zip
Folder Structure of mymap.zip
" Mapnik->ZoomLevels->X value->Y.png "
Sample Code:
public class OsmdroidDemoMap extends Activity {
private MapView mMapView;
private MapController mMapController;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapView mapView = new MapView(this, 256); //constructor
mMapController=mapView.getController();
mapView.setClickable(true);
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
setContentView(mapView);
mapView.getController().setZoom(5); your need
mMapController.setCenter(new GeoPoint(10.5649,-20.7097));
mapView.setUseDataConnection(true);
}
}
0 comments: