问题描述
如何在Android中实现离线地图。我用mapsforge库试了一下。
它不提供威斯康星州的二进制地图文件。那么如何创建我自己的地图二进制文件?
提前感谢
您将需要两件事:
-
允许您使用mapsforge库的程序。关于这一点,您可以坚持使用名为AdvancedMapViewer的程序作为示例与库。
-
一个mapfile。勉强你必须从OpenStreetMap数据创建你自己的mapfile。这是通过一个用于渗透的插件来完成的。这个插件在这里描述:
)
运行渗透任务,从而在shell上运行(在PATH中使用渗透):
osmosis --read-pbf wisconsin-latest.osm.pbf - -mapfile-writer file = wisconsin.map
然后将创建的文件wisconsin.map放在设备上并加载来自AdvancedMapViewer。
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.
You will need two things:
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.
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.
这篇关于在Android中使用mapsforge的离线地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!