>
> 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.
>
> Cheers,
>
> Mark
Hi Mark,
I didn't try your patch but the idea is good. It is also more compliant
to the rules described in the OSM wiki
(http://wiki.openstreetmap.org/wiki/Multipolygon#Tagging) than the
current implementation.
Mulitpolygon code should be reimplemented soon. As far as I am quite new
to mkgmap I will need some time to do this.
At the moment I see the following things to do:
1. Only simple polygons are supported. Lots of options described in
http://wiki.openstreetmap.org/wiki/Multipolygon#Advanced_multipolygons
are not implemented. I think the algorithm in the OSM wiki
(http://wiki.openstreetmap.org/wiki/Relation:multipolygon/Algorithm) is
a good starting point to make mkgmap implementation compatible. Some
rules about tagging are also described there.
2. The PolygonSplitter destroys the polygons created by the current
multipolygon code. Up to now I do not fully understand if thats a
problem or not. But I would feel better if someone could replace the
usage of the java.awt.Area class with some code that does not remove the
mulitpolygon connections between outer and inner rings.
3. Up to now the MultiPolygonRelation class does support one outer ring
only. This must be changed so that the MultiPolygonRelation class can
create multiple polygons in the garmin format. I do not fully understand
how the Garmin map is assembled from the mkgmap map format, so any hint
is appreciated.
WanMil
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev