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

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.

Thanks for this hint, but i already tried this. I imported the relations.osm.* but it stuck.
OK, i’lL tried once more :slight_smile:
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?

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

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.

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.