Offline map using mapsforge in android

我只是一个虾纸丫 提交于 2019-11-27 16:49:13

问题


How can i implement offline map in android. I tried it with mapsforge library. It does not provides binary map file for Wisconsin state. So How can create my own map binary file ?

Thanks in advance.


回答1:


You will need two things:

  1. a program that allows you to use the mapsforge library. Concerning this, you can stick with the program called AdvancedMapViewer which comes as an example with the library.

  2. a mapfile. Bascially you have to create your own mapfile from OpenStreetMap data. This is done with a plugin for Osmosis. This plugin is described here:

https://github.com/mapsforge/mapsforge/blob/master/docs/Getting-Started-Map-Writer.md

In short it works like this:

  • Install Osmosis (http://wiki.openstreetmap.org/wiki/Osmosis)
  • Install the plugin (https://github.com/mapsforge/mapsforge/blob/master/docs/Getting-Started-Map-Writer.md)
  • Download the data (e.g. from geofabrik.de: http://download.geofabrik.de/north-america/us/wisconsin-latest.osm.pbf)
  • run the osmosis task, thus run this on a shell (with osmosis in your PATH):

    osmosis --read-pbf wisconsin-latest.osm.pbf --mapfile-writer file=wisconsin.map

then put the created file wisconsin.map on your device and load it from AdvancedMapViewer.



来源:https://stackoverflow.com/questions/9645235/offline-map-using-mapsforge-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!