在Android中使用mapsforge离线地图 [英] Offline map using mapsforge in android

查看:1700
本文介绍了在Android中使用mapsforge离线地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能实现在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 ?

在此先感谢。

推荐答案

您将需要两件事情:

  1. 一个程序,让您使用mapsforge库。关于这一点,你可以叫AdvancedMapViewer的程序,将其视为与图书馆为例棒。

  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.

映射文件。 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:

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

渗透--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离线地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆