Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easiest way to create mbtiles files of Openstreetmap extracts?

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

like image 390
user678556 Avatar asked Jul 30 '12 12:07

user678556


People also ask

How do you convert OSM to MBTiles?

You can use ogr2ogr (see other answer here) to translate osm. pbf into geojson, and then Mapbox's tippecanoe tool to convert the geojson to mbtiles.

Where can I download MBTiles?

Data Download MBTiles with OSM data for analysis are available from http://osmlab.github.io/osm-qa-tiles/ , these are provided by the Humanitarian OpenStreetMap Team and updated weekly.

How do you create MBTiles in Qgis?

From the homepage, click the setup button in the sub-menu bar and select layers. On the layers page, select the create layer button to begin creating a new layer. When creating a new layer you will want to select the MBTile layer type, give your layer a name and then select the MBTile file you just created.


2 Answers

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

like image 120
Igor Brejc Avatar answered Nov 15 '22 10:11

Igor Brejc


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.

like image 38
osedok Avatar answered Nov 15 '22 10:11

osedok