How do I convert .osm.pbf or .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

 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:

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

accept rate: 0%

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

accept rate: 10%

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 ♦
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:

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 ♦
Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 30 Jul '15, 03:43

question was seen: 8,633 times

last updated: 03 Aug '15, 17:23

powered by OSQA