This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

library/tool for generating an MBTiles file from online osm data

1

Hi all,

I am aware of TileMill, however, I need a library or tool that can take osm data (from a URL, rather than a local file source) and return an MBTiles file. I would like to create my own application where the user can view an area on the map (I plan on using OpenLayers + data from OpenStreetMap) and upon selection of an area, the application can call this tool/library and an MBTiles file can be generated and saved locally. I would then use this MBTiles file to display a map to the user when he/she is off-line.

Does such a tool/library exist? Can TileMill offer this functionality via an API?

Thank you,

-f.

asked 30 Mar '12, 06:24

fabasi's gravatar image

fabasi
26112
accept rate: 0%

edited 30 Mar '12, 06:25


2 Answers:

1

It looks like you will either have to download the files first and then use mbutil to make an MBTiles file, or you will have to modify that utility to read from the web instead of from a file.

Be aware that while it is ok to use data from OpenStreetMap for your purpose, it is not acceptable that you use the OSM-provided tile server; you will have to set up your own tile server for that. See Tile Usage Policy.

answered 30 Mar '12, 07:17

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Thanks for the answer; that makes sense. I would be happy to setup my own tiles server, if that is what is needed. So in that case, would I download all the data from osm (periodically?), and host that on my own server? What is required to setup a tiles server? I think that an "enhanced" tiles server which generates MBTiles files is essentially what I am trying to build for the project described above.

Cheers,

-f.

(30 Mar '12, 07:50) fabasi

Well, planet.osm if 29GB (400GB uncompressed XML) so if possible start from a smaller part; see https://wiki.openstreetmap.org/wiki/Planet.osm#Country_and_area_extracts

(09 Jul '14, 22:41) sesam

1

You can create MBTiles from any .osm.pbf file using this tool - https://github.com/systemed/tilemaker

  1. Download .osm.pbf file from Geofabric. To download for a custom area, you can use Protomaps or BBBike Extract

  2. Download tilemaker

  3. Execute the following command

tilemaker --input netherlands.osm.pbf --output netherlands.mbtiles --process resources/process-openmaptiles.lua --config resources/config-openmaptiles.json

You can read more about it in this blog post - https://blog.kleunen.nl/blog/tilemaker-generate-map

answered 19 Aug '21, 19:48

protos29's gravatar image

protos29
412
accept rate: 0%

Source code available on GitHub .