问题描述
我正在创建一个使用在线和离线地图的iPhone旅行应用程序.对于离线地图,我希望允许用户下载他们感兴趣的区域(例如伦敦)的mbtiles文件.地图应该具有OpenStreetmap中已经找到的信息,例如道路等.我知道有一些网站,例如 http://metro.teczno.com/用于下载Openstreetmap摘录.创建Openstreetmap提取的mbtiles文件的最简单方法是什么?注意:不需要自定义地图.我尝试使用TileMill,但无法看到正确的地图信息.关于此的大多数信息都说要加载许多其他工具,并且说明不容易遵循或不起作用,并且由于我不需要地图自定义,因此实际上并不需要.我的主要/首选工作环境依次是Windows,Mac和Ubuntu(使用Windows下的VirtualBox).
I'm creating an iPhone travel app that uses online as well as offline maps. For the offline maps I want to allow users to download an mbtiles file of the area they are interested in (e.g. London). The map should have information such as roads etc.. that are already found in OpenStreetmap. I'm aware of web sites such as http://metro.teczno.com/ for downloading Openstreetmap extracts. What is the easiest way to create mbtiles files of Openstreetmap extracts? Note: no map customization is needed. I've tried using TileMill, but I'm not able to see the correct map information. Most information on this says to load quite a few other tools and the instructions are not easy to follow or they don't work and since I don't need map customization, it should not really be needed. My main/preferred work environments are Windows, Mac and Ubuntu (using VirtualBox under Windows) in that order.
谢谢汤姆
推荐答案
几天前,我在我的网站-这是一个逐步的过程,说明如何从OSM数据生成PNG栅格对象.
Few days ago I have written an article on my website - it's a step by step process on how to generate PNG raster mbtiles from OSM data.
我是笨拙的用户,几个星期前,我确实设法部署了基于 node.js 和 Mapnik 的解决方案.它非常快速,方便和一站式的命令解决方案.
I am heavy mbtiles user and few weeks ago I did manage to deploy a solution based on node.js and Mapnik. Its very fast, convenient and one line command solution.
要执行的步骤是:
-
下载并安装node.js –确保其为 32Bit版本,否则 Mapnik 将不起作用.
如果还没有Python,请安装它.
Install Python if you do not have it already.
在node.js控制台中安装Mapnik执行命令:
Install Mapnik executing command in the node.js console:
npm install -g tl @mapbox/mbtiles tilelive-http
安装成功后,您应该能够执行以下命令:-z(最小缩放级别),-Z(最大缩放级别)
When the installation is successful you should be able to execute command:-z (min zoom level), -Z (max zoom level)
tl copy -z 0 -Z 15 -b "19.481506 49.050920 20.407791 49.319751" "http://a.tile.openstreetmap.org/{z}/{x}/{y}.png" mbtiles://./tatra.mbtiles
这将为Tatra山脉创建测试mbtiles文件,如果您使用的是Windows,则该文件将位于C:\ Users {your_user_name} \文件夹中
This will create test mbtiles file for Tatra mountains and if you are on Windows the file will be located in C:\Users{your_user_name}\ folder
由于声誉低下,我无法包含URL或图片,但已记录了该过程在这里.
Due to low reputation I am not able to include URLs or pictures, but I have documented the process over here.
这篇关于创建Openstreetmap提取内容的mbtiles文件的最简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!