[Tile-serving] [osm2pgsql] Set polygon/linestring differently for some key values differently than the key in default style.lua (#346)

math1985 notifications at github.com
Tue Feb 23 21:58:46 UTC 2016


>     for i,k in ipairs(polygon_keys) do
>        if keyvalues[k] then
> +         polygontag = 1
> +         -- However, if the key/value combination occurs in linestring_values, do not treat the object as polygon
> +         for index,tag in pairs(linestring_values) do
> +            if k == tag[1] and keyvalues[k] == tag[2] then
> +               polygontag = 0
> +               break
> +            end
> +         end
> +         if polygontag == 1 then
> +            polygon = 1

@lonvia If I'm not mistaken, setting 'polygon' directly is not quite the same. Consider an object tagged with a polygon key, like building=yes, and a linestring tag, like historic=citywalls. The outer loop will be run at least twice, once for k=building and once for k=historic. The proposed code sets 'polygontag' and 'polygon' to 1 in the loop with k=building. In the loop with k=historic, 'polygontag' will be set to 0 because historic=citywalls is in linestring_values. However, 'polygon' will remain 1. This is not equivalent to setting 'polygon' directly, because in that case, 'polygon' would also be set to 0 in the loop for k=building.

I admit the code is rather hard to read, perhaps there is a cleaner way to accomplish the same.

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/346/files#r53857595
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20160223/8d157e81/attachment-0001.html>


More information about the Tile-serving mailing list