I am a newbie to Open Street Map. I made some research and found that we can download and store the map into a folder. But i didn't find any tutorial or sample that provides offline Open Street Map. Can someone provide a step by step tutorial, a guide to implement offline open street map please. I am following this example http://android-coding.blogspot.com/2012/06/example-of-implementing-openstreetmap.html but now i want to make it available when there is no connection.
Like in the tutorial you mentionned you can use osmdroid library: https://code.google.com/p/osmdroid/
There's a good explanation of how osmdroid works with offline maps here: https://stackoverflow.com/a/8286276/891479
Use MapTileProviderBasic in your app. Some examples here: http://www.androidadb.com/class/ma/MapTileProviderBasic.html
To generate your offline maps in osmdroid format use Mobile Atlas Creator: http://mobac.sourceforge.net/
You can choose the source of the maps and the output format. Once generated, put your maps atlas in zip format into your "/osmdroid/map" directory.
Hope it will help!
I have found this tutorial that explains all things you need step by step.
In brief:
1- You must download map tiles using Mobile Atlas Creator. I have explained the steps HERE
2- Move the resulting zip-file to /mnt/sdcard/osmdroid/ on your device.
3- Adding osmdroid-android-XXX.jar and slf4j-android-1.5.8.jar into build path your project
4- Adding MapView: You can add a MapView to your xml layout
<org.osmdroid.views.MapView
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
tilesource="Mapnik"
/>
Or create a MapView programmatically:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
mResourceProxy = new ResourceProxyImpl(inflater.getContext().getApplicationContext());
mMapView = new MapView(inflater.getContext(), 256, mResourceProxy);
return mMapView;
}
Hope it Helps ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With