NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

How do I convert .osm.pbf or .osm.bz2 http://download.geofabrik.de/africa-latest.osm.bz2. to Geo .tiff via commandline? I want is end results to convert files to .mbtiles. If I have Geo .tiff I can convert using Gdal to .mbtiles easily. This is the response I got from the guys at geofabrik.de.

 This is not so easy. You will want to have different zoom levels
 generated, so it is better to go osm->mbtiles directly without GDAL and
 GeoTiff. However, osm->mbtiles requires map rendering and style
 information. If it is for a small area, you can probably use Maperitive
 for this (unsure if it has a command line). Otherwise you will need to
 import OSM data into a PostGIS database, and then you can use e.g.
 Tilemill to batch-process

(Credits Frederik Ramm)

Can someone translate this? How do I import OSM data into PostGIS database. Reference: http://wiki.openstreetmap.org/wiki/Osm2pgsql

osm2pgsql -s -U postgres -d nameofdatabase /file/path/toosm/fileorpbf/name.osm

Will this work for .OSM.PBF?

How do I use a Tilemill to do a batch process? What is the commandline arguments?

asked 30 Jul '15, 03:43

Chathu's gravatar image

Chathu
20223
accept rate: 0%


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

permanent link

answered 19 Aug '21, 19:47

protos29's gravatar image

protos29
412
accept rate: 0%

The best guide to setting up osm2pgsql etc. is probably the switch2osm guide. You can point TileMill at the database that you set up using those instructions.

permanent link

answered 30 Jul '15, 10:24

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

@Someoneelse can you let me know how to point TileMill to this database?

(31 Jul '15, 02:56) Chathu

Mapbox's "use TileMill with a database" instructions are here:

https://www.mapbox.com/tilemill/docs/guides/postgis-work/

But that's probably only needed if you're setting up a TileMill project from scratch. If you're using an existing stylesheet and your database is called "gis" I'd imagine things will "just work" as far as database access is concerned

(03 Aug '15, 17:23) SomeoneElse ♦

As Frederick / woodpeck points out this is not easy and contains multiple steps:

  1. rendering OSM geodata to rasterdata
  2. converting map rasterdata to mbtiles

I'm not familar if Tilemill/Mapbox studio can handle both steps. But this platform runs completely online and without any CLI preprocessing.

Usually you pick an desktop renderer as Maperitive (or the full OSM rendering stack) and convert the resulting tiles structure to MBtiles (no idea which tool to use).
Anyway, you should start with an pretty small area! An whole continent doesn't sound like a good idea for usual hardware!

permanent link

answered 30 Jul '15, 10:14

iii's gravatar image

iii
4.9k84082
accept rate: 10%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×710
×362
×36
×18
×4

question asked: 30 Jul '15, 03:43

question was seen: 15,516 times

last updated: 19 Aug '21, 19:47

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum