[OSM-dev] Adding a table to osm2pgsql (and a couple utility patches) [patch]

Phil! Gold phil_g at pobox.com
Tue Jan 18 16:16:40 GMT 2011


I don't see an email address in the osm2pgsql source, so I'm just sending
this here; if there's a better destination, please let me know.

I think it would be really useful to have a table that tracks relation
membership so you can do JOINs to get the components of relations, so I
added one to osm2pgsql.  If this is accepted into the trunk, I plan to use
it to submit some rendering patches to render highway shields from route
relations.

I'm attaching three patches; I've tried to keep my changes orthogonal,
plus I think the first two are improvements on the codebase even if no one
likes the planet_osm_member table:

 * exportlist-indexing.patch changes exportList in output-pgsql.c so that
   it's explicitly indexed by OsmType.  Most of the code that uses it does
   so with OsmType indexing, but a few spots treat it as if it's indexed
   by table_id, which it isn't (at least, not any more).

 * common-set-prefix.patch merely moves the set_prefix() function from
   middle-pgsql.c into pgsql.h and uses it in output-pgsql.c.

 * planet-osm-member.patch adds a new table, <prefix>_member, which
   cross-references relations and their members.  It's intended to allow
   JOINs on the line, polygon, and node tables, so it has a field for the
   member type, and all IDs referring to relations are negative.
   The patch creates a distinction in output-pgsql.c between geometric
   tables (ones with a way field) and non-geometric tables; the
   distinction is made by the presence or absence of the type member of
   the s_table struct.

-- 
...computer contrarian of the first order... / http://aperiodic.net/phil/
PGP: 026A27F2  print: D200 5BDB FC4B B24A 9248  9F7A 4322 2D22 026A 27F2
--- --
Hire an expert marksman to stand by the entrance to your fortress.  His
job will be to shoot anyone who rides up to challenge you.
                       -- Evil Overlord's Handbook, entry 196
---- --- --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exportlist-indexing.patch
Type: text/x-diff
Size: 1575 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20110118/28005530/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: common-set-prefix.patch
Type: text/x-diff
Size: 2438 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20110118/28005530/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: planet-osm-member.patch
Type: text/x-diff
Size: 17678 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20110118/28005530/attachment-0002.patch>


More information about the dev mailing list