Open Street Map working offline android

后端 未结 3 529
遥遥无期
遥遥无期 2020-12-14 03:55

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 provide

相关标签:
3条回答
  • 2020-12-14 04:34

    MOBAC(Mobile Atlas Creator) is blocked now for using OSM You can see here

    0 讨论(0)
  • 2020-12-14 04:40

    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!

    0 讨论(0)
  • 2020-12-14 04:44

    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 ;)

    0 讨论(0)
提交回复
热议问题