[OSM-dev] osm2pgsql hstore column patch

Peter Körner osm-lists at mazdermind.de
Wed Jun 23 23:02:54 BST 2010


Hi

I took Sven's hstore patch and added a new functionality.
It is now possible to request an arbitrary number of extra hstore 
columns, that contains all tags that start with the column name.

eg: osm2pgsql --hstore-column "name:" --hstore-column "wikipedia:"

will add two new columns "name:" and "wikipedia:". When a node or a
way contains a name:de=Deutschland tag, the "name:"-column will contain 
an hstore entry 'de'=>'Deutschland'.

If no name:-Tag is present, the column is set to NULL. That way one can 
easily look for translated objects by toing a "name:" IS NOT NULL query.

What kind of Index would you suggest for such a IS NOT NULL query? A 
conditional index on osm_id WHERE "name:" IS NOT NULL?


I wrote the relevant code into a single function and also relocated the 
hstore code into a seperate function and documented both. Can someone 
with more C experience please check the patch because I'm not sure I did 
all pointer logic correct.

I did successfully test it on the berlin geofabrik extract and will try 
to run a planet import during the next week (need to talk about that on 
Maps-l ;).

The attached patch is against r21892 of the osm repo.

Special thanks to Sven who did the real hard work.
Peter
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hstore-column.patch
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20100624/f3d69c59/attachment.ksh>


More information about the dev mailing list