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



I recently installed postgres and loaded some osm data in it. I'm trying to do some queries (for example getting all street names, street numbers, etc ..). Can anyone help me with some documentation about postgres query with osm ? i'm looking for any tutorial able to get me started on how to query the database

Thanks for you help

asked 10 Mar '12, 17:53

Hyboga's gravatar image

accept rate: 0%

There are many different ways to load osm data into a postgres database all depending on how you want to get the data out again. Can you tell us how you imported the data and possibly what you want with the database in the end.

(10 Mar '12, 23:43) Gnonthgol ♦

Hello Gnonthgol,

I loaded osm data using osm2psql, in the end i would like those data as lists (csv or else) so i can import them somewhere else.

(11 Mar '12, 13:31) Hyboga

Here is the schema of Osm2pgsql:

it contains one example and documentation of the table structure.

permanent link

answered 16 Mar '12, 22:58

TheOddOne2's gravatar image

accept rate: 3%


osm2pgsql stores the data in several tables according to the style you used when you imported. The geometries is stored in postgis format. For a description on how to work with the geometries read the postgis manual. If you are unfemilear with sql there are a lot of resources out there on the internet.

permanent link

answered 11 Mar '12, 17:42

Gnonthgol's gravatar image

Gnonthgol ♦
accept rate: 16%


You can find lots of example queries in mapnik stylesheets:

permanent link

answered 15 Mar '12, 09:25

emj's gravatar image

accept rate: 15%

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: 10 Mar '12, 17:53

question was seen: 17,622 times

last updated: 16 Mar '12, 22:58

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