Use OSM Data in Quantum GIS

Hello everybody,
I have a problem concerning the use of osm data in Quantum GIS. Unfortunatelly I am not very familiar with scripting and that stuff.
Please can anybody help me and explain me how I can transform or convert the OSM data (I downloaded the Planet file) to shapefile, gml or MapInfo.ThanIcan add the data to QGIS.
I found just some explanations in the net, but I don’t understand how the script works. Can anybody give me a detailled explanation how I can convert them?
Thank you guy for the assistant.

Hello Don,

What I do is;

  • get the data into a postgresql/postgis database with oms2pgsql
  • Pull the osm data from the database with filters using pgsql2shp

pgsql2shp -f parks -h -u “select osm_id, leisure, “name”, transform(way,4326) as way from planet_osm_polygon where leisure=’park’”

this creates a shp, shx and a dbf file named parks

  • I then take this data into qGIS.

Of course it takes some knowledge of spatial-sql but that his well documented on the internet at The big advantage of this method is that you can apply your own filters.

Hi Milo,
Thanks for your reply. I just try to repeat…better for a dummie like me :slight_smile:

  1. I install PostGIS, create a database and than put the downloaded osm data in with oms2pgsql in
    → Is the oms2pgsql a script or a add on or is it included in PostGIS?
  2. Than I pullt the data from the Post GIS Data base using pgsql2shp to another folder and get shape files? Is that rigt so far?

But what does this mean

Is it well documented on the post gis site? I couldnt find it?
Thanks again :slight_smile:

But there is no easier way? Only the way with PostGIS? Is there a docu somewhere about how to do it sep by step?

there probably is. But since this is the toolchain most tileservers have in position already, it is the easiest for me to describe.

osm2pgsql is a script. It can be downloaded from the openstreetmap svn repository.

the pgsql2shp is the statement to connect to the postgis database, fire a query and return the data as shape

osm2pgsql is a script.
→ Can I run it with python or what di you use for it? Thanks again!


I would suggest you to start in a most simple way by downloading first some ready made shapefiles from Geofabrik or Cloudmade. Install PostGIS and run osm2pgsql a bit later, when you feel that you would need other tags than those included in standard shapefiles. Osm2pgsql in executable, it does not need python or anything, just the binary and PostGIS.