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

I posted on stackoverflow before to find this website. so here is my my post.

http://stackoverflow.com/questions/10242129/how-can-i-get-the-zone-administrive-of-a-city-from-postgis-nominatim-import

I retreived europe.osm database with osm2pgsql. And now I try to exploit it. Is there a way to get the state, country, region, from a way like a town hamlet locality or city?

http://wiki.openstreetmap.org/wiki/Nominatim
https://github.com/twain47/Nominatim

databases osm format :
http://download.geofabrik.de/osm/europe/
here is the database schema :
http://wiki.openstreetmap.org/wiki/Osm2pgsql/schema

if someone can provide me the SQL Query to retreive the information.

asked 23 Apr '12, 15:52

Christophe%20DEBOVE's gravatar image

Christophe D...
16225
accept rate: 0%

edited 24 Apr '12, 08:39

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701


I presume you have a full Nominatim installation as described on the installation page not just an osm2pgsql import.

Doing SQL queries on the database directly is a bit involved. You can get administrative information much easier by sending reverse requests directly to your local installation. If you have the OSM id of your way, send something like: http://your.local.nominatim.server/reverse?osm_type=W&osm_id=<osm id> and process the XML returned.

If you still want to go down the SQL road, have a look at the placex and place_addressline tables. The former contains all OSM objects and the latter the relationship between them.

permanent link

answered 24 Apr '12, 08:36

lonvia's gravatar image

lonvia
6.2k25789
accept rate: 40%

edited 24 Apr '12, 10:34

thanks I didn't make the full nominatim install because I've allready a geo request system, I need just to make an import to my system.

(24 Apr '12, 09:23) Christophe D...

Sorry but there is not place_addressline table

(24 Apr '12, 10:22) Christophe D...

The placex and place_addressline tables are part of the full Nominatim import. If you don't want to do the full import, there is no point in importing the gazetteer schema in the first place.

(24 Apr '12, 10:40) lonvia

Ok I will follow the full installation. Thx

(24 Apr '12, 13:35) Christophe D...

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:

×689
×263
×118

question asked: 23 Apr '12, 15:52

question was seen: 6,484 times

last updated: 24 Apr '12, 13:35

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