[OSM-dev] How does osm2pgsql handle multiple matches of same key?

Paul Norman penorman at mac.com
Sat Sep 17 02:41:43 UTC 2016


On 9/16/2016 5:37 PM, Spencer Gardner wrote:
> It's not clear to me how osm2pgsql handles multiple values for the 
> same key on an OSM feature. For example, imagine I have a way with the 
> following tags:
> parking:lane:right=perpendicular
> parking:lane:left=parallel

"parking:lane:right" and "parking:lane:left" are different keys. What 
happens depends what your tag transform is doing. The default C tag 
transforms does nothing special with those keys, so doesn't change the 
values or anything. A lua tag transform or a multi-backend style does 
what you have defined it to.

>  1. How does the "parking" column reflect this after the import
>     assuming that my style file has an entry for parking?
>

If those are the only tags and there is not a "parking" key on the 
feature, the column is null with the C tag transforms.


>  1. Is there a way to define styles that separate these? (i.e. one
>     column for parking:lane:right and another column for
>     parking:lane:left?
>
> My understanding of hstore is that it will suffer from the same 
> problem--if there's a duplicate entry for the same key it takes the 
> first and ignores the others. If this is not the case I'll investigate 
> using that for my purposes.

If you want a column for parking:lane:right and parking:lane:left, add 
both to your style file.

If you want to do something more sophisticated, you need to use Lua 
transforms. You could have a column which indicates which sides there is 
parking on. https://github.com/ClearTables/ClearTables/issues/51 is 
about something similar for maxspeed:forward and maxspeed:backward
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20160916/08d01aa0/attachment.html>


More information about the dev mailing list