Hi Marko and others,

the patch for the mp code does not remove any tags from the source polygons and lines. Instead it tags all mp-source lines and polygons with mkgmap:mp_source=yes.

All artificially created polygons during the mp processing are tagged with mkgmap:mp_created=yes.

Example:
Polygon A - natural=water, role=outer
Polygon B - landuse=grass, role=inner

Result after mp processing
Polygon A - natural=water, role=outer, mkgmap:mp_source=yes
Polygon B - landuse=grass, role=inner, mkgmap:mp_source=yes

Polygon A1 - natural=water, mkgmap:mp_created=yes
Polygon A2 - natural=water, mkgmap:mp_created=yes
Polygon B1 - landuse=grass, mkgmap:mp_created=yes

Maybe you could play a bit with this and post any new ideas how to improve the tag handling in the mp code.

WanMil

Index: src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java      
(revision 1575)
+++ src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java      
(working copy)
@@ -325,6 +325,22 @@
                        }
                        Coord p1 = way.getPoints().get(0);
                        Coord p2 = way.getPoints().get(way.getPoints().size() - 
1);
+                       
+//                     if ((p1.getLatitude() <= bbox.getMinLat() && 
p2.getLatitude() <= bbox.getMinLat()) ||
+//                                     (p1.getLatitude() >= bbox.getMaxLat() 
&& p2.getLatitude() >= bbox.getMinLat()) ||       
+//                                     (p1.getLongitude() <= bbox.getMinLong() 
&& p2.getLongitude() <= bbox.getMinLong())      ||
+//                                     (p1.getLongitude() >= bbox.getMaxLong() 
&& p2.getLongitude() >= bbox.getMinLong()))
+//                     {
+//                                     // close the polygon
+//                                     log.info("Closing way because its start 
and endpoint are outside the bbox", way);
+//                                     log.info("from", 
way.getPoints().get(0).toOSMURL());
+//                                     log.info("to", 
way.getPoints().get(way.getPoints().size() - 1)
+//                                                     .toOSMURL());
+//                                     // mark this ways as artificially closed
+//                                     way.closeWayArtificially();
+//                                     continue;
+//                     }
+                       
                        Line2D closingLine = new 
Line2D.Float(p1.getLongitude(), p1
                                        .getLatitude(), p2.getLongitude(), 
p2.getLatitude());
 
@@ -632,22 +648,27 @@
                                List<Way> singularOuterPolygons = 
cutOutInnerPolygons(
                                        currentPolygon.polygon, innerWays);
 
-                               if 
(currentPolygon.polygon.getOriginalWays().size() == 1) {
-                                       // the original way was a closed 
polygon which
-                                       // has been replaced by the new cutted 
polygon
-                                       // the original way should not appear
-                                       // so we remove all tags
-                                       
currentPolygon.polygon.removeAllTagsDeep();
-                               } else {
-                                       // remove all polygons tags from the 
original ways
-                                       // sometimes the ways seem to be 
autoclosed later on
-                                       // in mkgmap
-                                       for (Way w : 
currentPolygon.polygon.getOriginalWays()) {
-                                               for (String polygonTag : 
polygonTags) {
-                                                       w.deleteTag(polygonTag);
-                                               }
-                                       }
+//                             if 
(currentPolygon.polygon.getOriginalWays().size() == 1) {
+//                                     // the original way was a closed 
polygon which
+//                                     // has been replaced by the new cutted 
polygon
+//                                     // the original way should not appear
+//                                     // so we remove all tags
+//                                     
currentPolygon.polygon.removeAllTagsDeep();
+//                             } else {
+//                                     // remove all polygons tags from the 
original ways
+//                                     // sometimes the ways seem to be 
autoclosed later on
+//                                     // in mkgmap
+//                                     for (Way w : 
currentPolygon.polygon.getOriginalWays()) {
+//                                             for (String polygonTag : 
polygonTags) {
+//                                                     w.deleteTag(polygonTag);
+//                                             }
+//                                     }
+//                             }
+                               
+                               for (Way w : 
currentPolygon.polygon.getOriginalWays()) {
+                                       w.addTag("mkgmap:mp_source", "yes");
                                }
+                               
 
                                boolean useRelationTags = currentPolygon.outer
                                                && hasPolygonTags(this);
@@ -662,6 +683,7 @@
                                for (Way mpWay : singularOuterPolygons) {
                                        // put the cut out polygons to the
                                        // final way map
+                                       mpWay.addTag("mkgmap:mp_created", 
"yes");
                                        tileWayMap.put(mpWay.getId(), mpWay);
                                }
                        }
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to