Re: [mkgmap-dev] Multipolygon artificial tagging

2010-02-21 Thread Torsten Leistikow
Moin,

I tried a slightly modified patch provided by WanMil, where also mkgmap:mp_*=no
tags are added:

 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 and mkgmap:mp_created=no.
 
 All artificially created polygons during the mp processing are tagged
 with mkgmap:mp_created=yes and mkgmap:mp_source=no.
 
 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

With this patch I was able to fix the multipolygon borders commonly used in
Germany, by modifying my style as follows.

For the border lines I don't want to have the artificially created polygons, I
am only interested in the original polygons from the multi-polygon. So I added
to each border check the condition mkgmap:mp_created!=yes. As a result only the
original polygons from a multi-polygon are drawn as borderlines as well as all
lines not belonging to a multi-polygon.

The second change was done in the polygon files. Here I added to every check the
condition mkgmap:mp_created!=no. As a result only the artificially created
polygons are drawn as areas as well as all polygons not belonging to a
multi-polygon.

So in my eyes with this patch the multi-polygon processing is much better
controllable via the style file. But you have to adjust your style accordingly,
so that you do not output both polygons, the original and the artificial one.

Gruss
Torsten
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] Multipolygon artificial tagging

2010-02-17 Thread WanMil

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 @@
ListWay 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) {

Re: [mkgmap-dev] Multipolygon artificial tagging

2010-02-17 Thread Marko Mäkelä
Hi WanMil,

 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.

How would this remove the bogus boundary lines in Germany? (Germany  
uses multipolygons for administrative boundaries.) I believe that for  
those to work, the multipolygon code should be disabled by a style  
rule, e.g., use the MP code only if type=multipolygon  boundary!=*.  
Someone who wants to render boundaries as multipolygons would enable  
the MP processing of the boundaries. Or would we make this by an  
option, something like mkgmap --disable-multipolygon='boundary=*'?

An alternative to disabling MP processing would be to set  
mkgmap:mp_created only on the line segments that were created when  
splitting A to A1 and A2, but I suppose that polygons and lines are  
wholly different entities in mkgmap, and thus you cannot have  
differently tagged line segments within a polygon.

Marko
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev