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

3
1

Hello,

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

Hyboga
45113
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:

http://wiki.openstreetmap.org/wiki/Osm2pgsql/schema

it contains one example and documentation of the table structure.

permanent link

answered 16 Mar '12, 22:58

TheOddOne2's gravatar image

TheOddOne2
6851621
accept rate: 3%

-1

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 ♦
13.8k16103198
accept rate: 16%

-1

You can find lots of example queries in mapnik stylesheets: https://trac.openstreetmap.org/browser/applications/rendering/mapnik/osm.xml

permanent link

answered 15 Mar '12, 09:25

emj's gravatar image

emj
2.0k123547
accept rate: 15%

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:

×362
×165
×147

question asked: 10 Mar '12, 17:53

question was seen: 17,986 times

last updated: 16 Mar '12, 22:58

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