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

2010-06-21 Thread Ture Pålsson
2010/6/21 Phil! Gold :
> 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 was playing around with representing ways as arrays of node id:s the
other day, and I got seemingly decent performance, at least doing
array intersection tests (using '&&', stuff like "what other ways
share nodes with this way"),  by building a GIN index on the array
column. I was just playing around with it interactively though, so it
might still be too slow for heavy use. Just mentioning it in case you
have not tried. :-)

  -- Ture

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2010-06-21 Thread John Smith
On 22 June 2010 01:15, Phil! Gold  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.

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2010-06-21 Thread Phil! Gold
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.

-- 
...computer contrarian of the first order... / http://aperiodic.net/phil/
PGP: 026A27F2  print: D200 5BDB FC4B B24A 9248  9F7A 4322 2D22 026A 27F2
--- --
Last Rule of Politics:
  Kingdoms are good. Empires are evil.
   -- Console Role Playing Game Clichés, item 74
 --- --

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk