Easiest way to create mbtiles files of Openstreetmap extracts?

ぐ巨炮叔叔 提交于 2020-01-13 03:21:10

问题


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.

Thanks Tom


回答1:


These things are never really easy, but I've tried to make them as easy as possible in Maperitive. In a few days I'll be releasing a new version which supports creating MBTiles from OSM XML files. In the meantime, you can read the older tutorial which generates tiles as individual files for the web map server. Since you don't need map customization, you can skip some of the steps: http://braincrunch.tumblr.com/post/9921938947/maperitive-tutorial-a-hiking-web-map-in-ten-easy-steps




回答2:


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.

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.

The steps to follow are:

  1. Download and install node.js – make sure it’s 32Bit version otherwise Mapnik will not work.

  2. Install Python if you do not have it already.

  3. Install Mapnik executing command in the node.js console:

    npm install -g tl @mapbox/mbtiles tilelive-http 
    
  4. 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
    

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

Due to low reputation I am not able to include URLs or pictures, but I have documented the process over here.



来源:https://stackoverflow.com/questions/11721543/easiest-way-to-create-mbtiles-files-of-openstreetmap-extracts

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