osm2pgsql: improve handling of multipolygon relations #721
Comments
Author: jburgess[at]uklinux.net The changes to osm2pgsql are mostly straight forward. Do you have a plan on how the 5000+ existing multipolygons will get fixed? It should be possible to special-case the situation where the tags on the inner and outer match but that may cause some confusion. |
Author: robx Hi, sorry for not replying to this earlier -- I didn't realise I wasn't getting updates by mail. I'm not sure if this is worth pursuing: I had the impression I'm about the only one who thinks the current behaviour is stupid. If we do, I have scripts that can Then we could:
I think I mostly did step 1 earlier, but there's sure to be a lot of new multipolygons now. Open questions would be how other renderers would deal with it. or/p should be able to handle this also, but the xslt-based osmarender might not. |
Author: jburgess[at]uklinux.net In the past week I made some changes to osm2pgsql which attempts to implement what you originally asked for. The change was made live after the last planet dump so not all the tiles visible on the map this week have this fixed. On example which is partially visible is the island in the lake at http://www.openstreetmap.org/?lat=54.59126&lon=-3.14333&zoom=16&layers=B00FTF The new algorithm is: When rendering the multipolygon only take into consideration tags on the relation and on any members that are not marked role=inner. We can't reliably assume that all outer rings are correctly tagged with role=outer but instead assume that if someone wants to tag an inner way differently then he can add role=inner to avoid it getting used by mistake. The code builds up a list of representative polygon tags from the multipolygon, i.e. things like landuse=, building= etc. It then compares the tags on all the member ways to these. If they don't match, e.g. outer has landuse=forest and inner has landuse=residential, or building=yes then the non-matching way will be added to be rendered on its own. If the inner way tags match the outer way then they will be excluded. This avoids problems with a lot of the existing data which does duplicate the tags between all the members. The checking is loose enough though that if the outer way has name=foo and this is missing on the inner ways then this is not a difference which will cause them to mis-match. Feel free to email me the scripts if you want and I'll take a look at them and/or add to SVN. The algorithms above are not ideal and are bound to be difficult/impossible to implement in some renderers. It would be much better if the data was more consistent and/or easier to identify which revision of the multipolygon tagging recommendations a particular one is conforming to. |
Author: jburgess777[at]googlemail.com I just applied a fix to osm2pgsql in r14997 to make it fix up the direction of the inner/outer rings during the processing. I believe this fixes the remaining orienatation issue mentioned in this ticket but I'll leave it open until things begin re-rendering with the fix in place next Wednesday. |
Author: iandees Pretty sure osm2pgsql is doing well on multipolygon relations now. |
Reporter: robx
[Submitted to the original trac issue database at 11.58am, Tuesday, 4th March 2008]
Following the mailing list discussion at http://lists.openstreetmap.org/pipermail/talk/2008-March/thread.html#23876 I've rewritten the definition at http://wiki.openstreetmap.org/index.php/Relations/Multipolygon.
In particular:
I'll try to create a patch, but go ahead and fix it yourself if you want -- might take me a while.
Cheers
Rob
The text was updated successfully, but these errors were encountered: