[OSM-talk] Finding relation members in osm2pgsql PostGIS database?

John Smith deltafoxtrot256 at gmail.com
Mon Jun 21 20:17:19 BST 2010


On 22 June 2010 01:15, Phil! Gold <phil_g at pobox.com> wrote:
> I've got a PostGIS database created and maintained with osm2pgsql.  For
> some of the Mapnik rendering I'm doing, I'd like to see whether ways
> belong to relations.  (Specifically, whether a highway=* way is a member
> of a route=road relation.)  I've been able to look in the planet_osm_rels
> table for relation membership, but the members are stored in an array, and
> searching those arrays for membership, even on a bbox-restricted subset,
> is really slow.  Is there any way to do this faster?  If not, I suppose I
> can file a feature request against osm2pgsql for an indexed relation
> membership table.

osm2pgsql probably isn't the best tool for the job, relations get
stored as geometries in the database, rather than meta information
cross referencing the ways. What you are after is a database structure
similar/the same as the main OSM DB to be able to do this kind of
interrogation rather than trying to interrogated pre-processed
information which has lost some/a lot of non-desirable attributes to
make rendering faster.




More information about the talk mailing list