logo separator

[mkgmap-dev] Generate coastline - can we keep the coastline way?

From Mark Burton markb at ordern.com on Wed Mar 24 15:12:12 GMT 2010

On Wed, 24 Mar 2010 14:33:15 +0000
Toby Speight <T.M.Speight.90 at cantab.net> wrote:

> When --generate-coastline=multipolygon fails, I'm left with a map that
> has no distinction between land and sea.  However, if I don't
> use --generate-coastline, I at least get a line (from my style/lines).
> Is there any good reason why generating coastline prevents the line
> rules from being applied to the coastline ways?
> 
> It's not a problem when I actually get sea tiles, but it's a serious
> nuisance when small islands have completely disappeared!
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Perhaps this does what you want?

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 0b150ef..8d40da2 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
@@ -531,8 +531,9 @@ public class Osm5XmlHandler extends DefaultHandler {
                                        String natural = currentWay.getTag("natural");
                                        if(natural != null) {
                                                if("coastline".equals(natural)) {
-                                                       currentWay.deleteTag("natural");
-                                                       shoreline.add(currentWay);
+                                                       Way w = currentWay.copy();
+                                                       w.deleteTag("natural");
+                                                       shoreline.add(w);
                                                }
                                                else if(natural.contains(";")) {
                                                        // cope with compound tag value
@@ -547,10 +548,11 @@ public class Osm5XmlHandler extends DefaultHandler {
                                                                        others += ";" + n;
                                                        }
                                                        if(foundCoastline) {
-                                                               currentWay.deleteTag("natural");
+                                                               Way w = currentWay.copy();
+                                                               w.deleteTag("natural");
                                                                if(others != null)
-                                                                       currentWay.addTag("natural", others);
-                                                               shoreline.add(currentWay);
+                                                                       w.addTag("natural", others);
+                                                               shoreline.add(w);
                                                        }
                                                }
                                        }



More information about the mkgmap-dev mailing list