OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#1 2008-06-03 09:48:05

Zwennie
Member
From: Leipzig
Registered: 2008-05-25
Posts: 46

Relations from Database

Hi,

i already posted this yesterday to the talk mailing list, but it seems not being sent over the mailing list. So i ask in this forum.
Can anyone tell me, how i can retrieve relations from the database and how they are stored in the database? I just want to try rendering them with mapnik.
When i look into my database, which also should contain the relations, i can't find any hint where those relations are stored.

Best regards
Sven

Offline

#2 2008-06-03 10:07:17

Lambertus
Administrator
From: Apeldoorn (NL)
Registered: 2007-03-17
Posts: 3,269
Website

Re: Relations from Database

There were some network problems yesterday, so that may have been the cause for the email problem.

Relations are exported every day with the daily exports. You should be able to import the relations using osm2pgsql script.


Mapping tools: Garmin GPSmap 60CSx, Giant Terrago 2002

Offline

#3 2008-06-03 11:31:10

Zwennie
Member
From: Leipzig
Registered: 2008-05-25
Posts: 46

Re: Relations from Database

Thanks for this hint, but i already tried this. I imported the relations.osm.* but it stuck.
OK, i'lL tried once more :-)
But maybe you can point me to any documentation about the database schema? Or how do i recognize that relations are in the database? Should there be a separate table for them?

Offline

#4 2008-06-03 12:26:12

Lambertus
Administrator
From: Apeldoorn (NL)
Registered: 2007-03-17
Posts: 3,269
Website

Re: Relations from Database

Sorry, this is about as far as my knowledge about Mapnik/relations/database schema goes... I hope someone else can help.


Mapping tools: Garmin GPSmap 60CSx, Giant Terrago 2002

Offline

#5 2008-06-04 06:01:43

JRA
Member
Registered: 2007-12-17
Posts: 663

Re: Relations from Database

Osm2pgsql is importing relations to corresponding point, line and polygon tables according to their types.  Thus multipolygon relation, once it is imported is just one feature in the polygon table.  The attribute field "osm_id" that is in point, line and polygon tables contains the id of the relation.  So if you know the id of the relation you are searching for you can query it by osm_id.  Relations have such small ids that it is quite possible to find all relations by query "where osm_id < 10000".  With multipolygons it seems to be so that original geometries used for relation are not imported at all, so there are not the original osm ways for inner and outer rings in PostGIS but there is just one polygon with holes. I do not know what happens with line relations.

Offline

#6 2008-06-05 11:25:37

Zwennie
Member
From: Leipzig
Registered: 2008-05-25
Posts: 46

Re: Relations from Database

Thanks for all your answers. From an email from Frederik Ramm, i now know, that relations as such are being lost when importing with osm2pgsql. They are stored as separate ways as i did understand. And JRA is right, all members of a "former" relation do have the same osm_id.

Offline

Board footer

Powered by FluxBB