问题描述
我怎样才能实现在Android的离线地图。我试图与mapsforge库。它不为威斯康星州二进制映射文件。那么,怎样才能创建自己的地图二进制文件?
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 ?
在此先感谢。
推荐答案
您将需要两件事情:
-
一个程序,让您使用mapsforge库。关于这一点,你可以叫AdvancedMapViewer的程序,将其视为与图书馆为例棒。
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.
映射文件。 Bascially你必须创建自己的映射文件从OpenStreetMap的数据。这是通过一个插件的渗透。这个插件描述如下:
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:
的
在短期它的工作原理是这样的:
In short it works like this:
- 在安装反渗透( http://wiki.openstreetmap.org/wiki/Osmosis )
- 安装的插件(的)
- 下载数据(例如,从geofabrik.de: HTTP: //download.geofabrik.de/north-america/us/wisconsin-latest.osm.pbf )
-
运行渗透任务,因此(在你的路径与渗透)在shell中运行这样的:
- 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):
渗透--read-PBF威斯康星latest.osm.pbf --mapfile作家文件= wisconsin.map
osmosis --read-pbf wisconsin-latest.osm.pbf --mapfile-writer file=wisconsin.map
然后把你的设备上创建的文件wisconsin.map和AdvancedMapViewer加载它。
then put the created file wisconsin.map on your device and load it from AdvancedMapViewer.
这篇关于在Android中使用mapsforge离线地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!