[OSM-dev] Osm2pgsql outputs neg. and duplicate osm_ids (and weird attributes in table rels)

Frederik Ramm frederik at remote.org
Sat Jul 23 21:33:09 BST 2011


Hi,

    your suspicions are correct, the objects with negative IDs come from 
relations and at least in the case of a multipolygon relation it is 
obvious that there can be more than one. Boundary relations will create 
line and polygon objects, and route relations create line objects.

The multiple positive IDs are because osm2pgsql splits very long lines 
into smaller segments.

The file output-pgsql.c in osm2pgsql's source (available in SVN) 
contains all these answers.

> 3. Then in table <<osm>>_rels which I don't understand following attributes:
> * way_off (smallint)
> * rel_off (smallint)
> * pending (boolean) -- exists also in table osm_ways
> * parts (integer[])
> * members (text[])

This is the way in whcih osm2pgsql stores the linkage between relations 
and objects. Here, middle_pgsql.c is your friend! Basically every 
relation has a simple array of member IDs, where all node members come 
first, then all way members, then all relation members, and way_off is 
the index of the first way member and rel_off the index of the first 
relation member.

The "pending" flag is a dirty marker used during diff updates.

> => Any hints?

"Read the source, Luke" ;)

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"



More information about the dev mailing list