[mkgmap-dev] Multipolygons and disappearing coastlines
From Steve Ratcliffe steve at parabola.me.uk on Mon Dec 28 08:54:29 GMT 2009
On 26/12/09 22:11, Mark Burton wrote: > > Hi Chris, > >> Mark Burton schrieb: >> >>> So, is putting the coastline into a multipolygon a reasonable OSM >>> thing? >> >> A coastline is often also a boundary and boundaries are >> multipolygons in OSM. >> >>> If so, should mkgmap be breaking the coastline by removing its >>> tags? If not, how do we fix that? >> >> My guess is, that the multipolygon handling in mkgmap is not working >> perfectly. >> >> See an older thread on this list where I suggest a >> workaround. (I check if the MP has no inner elements >> and change the type=multipolygon to type=boundarypolygon >> if this is the case). >> >> Chris > > OK, that's understood. > > But why do we have to trash the original ways when we make a > multipolygon from them? Would it not be better to give the relation a > duplicate of the way to trash so that the original way can go on to > serve its original purpose. Perhaps we should do this: > > diff --git a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java > index acc5cf9..fbb1d57 100644 > --- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java > +++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java > @@ -266,10 +266,12 @@ class Osm5XmlHandler extends DefaultHandler { > private void startInRelation(String qName, Attributes attributes) { > if (qName.equals("member")) { > long id = idVal(attributes.getValue("ref")); > - Element el; > + Element el = null; > String type = attributes.getValue("type"); > - if ("way".equals(type)){ > - el = wayMap.get(id); > + if ("way".equals(type)) { > + Way way = wayMap.get(id); > + if(way != null) > + el = way.duplicate(); > } else if ("node".equals(type)) { > el = nodeMap.get(id); > if(el == null) { > > I just tried this patch and (just like magic) the coastline reappears. But do you also magically get an extra unwanted polygon when the relation is a cascading multipolygon? Aside from that, the multipolygon code already does duplicate the way before removing the tags from the original. Duplicating it again can't be the right solution. ..Steve
- Previous message: [mkgmap-dev] Multipolygons and disappearing coastlines
- Next message: [mkgmap-dev] Multipolygons and disappearing coastlines
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list