> I don't use 0x4b in Typfile anymore. Having two polygons for one
> function (get rid of yellow on etrex) is slowing down GPS/Mapsource .13.x
Fair enough - please try attached new patch that generates the land
poly.
> The big flooding in the tile of "Bremen"
> in Germany still exists however (I do know that the geofabrik cut is
> 100% responsible for it).
Given the location, I would think that the coastline reaches the edge
of the tile. In that case, this patch doesn't help. The coastline must
be broken. I assume that "close-gaps" doesn't fix the problem.
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 f78b1f9..e94bcc6 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
@@ -115,6 +115,7 @@ public class Osm5XmlHandler extends DefaultHandler {
private boolean generateSeaUsingMP = true;
private boolean allowSeaSectors = true;
private boolean extendSeaSectors;
+ private boolean roadsReachBoundary;
private int maxCoastlineGap;
private String[] landTag = { "natural", "land" };
private final Double minimumArcLength;
@@ -618,10 +619,12 @@ public class Osm5XmlHandler extends DefaultHandler {
coordMap = null;
+ if(bbox != null && (generateSea || minimumArcLength != null))
+ makeBoundaryNodes();
+
if (generateSea)
generateSeaPolygon(shoreline);
- long start = System.currentTimeMillis();
for (Relation r : relationMap.values())
converter.convertRelation(r);
@@ -630,11 +633,8 @@ public class Osm5XmlHandler extends DefaultHandler {
nodeMap = null;
- if(minimumArcLength != null) {
- if(bbox != null)
- makeBoundaryNodes();
+ if(minimumArcLength != null)
removeShortArcsByMergingNodes(minimumArcLength);
- }
nodeIdMap = null;
@@ -691,7 +691,8 @@ public class Osm5XmlHandler extends DefaultHandler {
// highway count one
clippedPair[1].incHighwayCount();
++numBoundaryNodesAdded;
-
+ if(!roadsReachBoundary && way.getTag("highway") != null)
+ roadsReachBoundary = true;
}
else if(clippedPair[1].getOnBoundary())
++numBoundaryNodesDetected;
@@ -712,6 +713,8 @@ public class Osm5XmlHandler extends DefaultHandler {
// highway count one
clippedPair[0].incHighwayCount();
++numBoundaryNodesAdded;
+ if(!roadsReachBoundary && way.getTag("highway") != null)
+ roadsReachBoundary = true;
}
else if(clippedPair[0].getOnBoundary())
++numBoundaryNodesDetected;
@@ -1187,6 +1190,7 @@ public class Osm5XmlHandler extends DefaultHandler {
// the remaining shoreline segments should intersect the boundary
// find the intersection points and store them in a SortedMap
SortedMap<EdgeHit, Way> hitMap = new TreeMap<EdgeHit, Way>();
+ boolean shorelineReachesBoundary = false;
long seaId;
Way sea;
for (Way w : shoreline) {
@@ -1343,6 +1347,13 @@ public class Osm5XmlHandler extends DefaultHandler {
w.getPoints().add(w.getPoints().get(0));
log.info("adding non-island landmass, hits.size()=" + hits.size());
islands.add(w);
+ shorelineReachesBoundary = true;
+ }
+
+ if(!shorelineReachesBoundary && roadsReachBoundary) {
+ // try to avoid tiles being flooded by anti-lakes or other
+ // bogus uses of natural=coastline
+ generateSeaBackground = false;
}
List<Way> antiIslands = new ArrayList<Way>();
@@ -1451,6 +1462,23 @@ public class Osm5XmlHandler extends DefaultHandler {
if(generateSeaUsingMP)
seaRelation.addElement("outer", sea);
}
+ else {
+ // background is land
+ if(!generateSeaUsingMP) {
+ // generate a land polygon so that the tile's
+ // background colour will match the land colour on the
+ // tiles that do contain some sea
+ long landId = FakeIdGenerator.makeFakeId();
+ Way land = new Way(landId);
+ land.addPoint(nw);
+ land.addPoint(sw);
+ land.addPoint(se);
+ land.addPoint(ne);
+ land.addPoint(nw);
+ land.addTag(landTag[0], landTag[1]);
+ wayMap.put(landId, land);
+ }
+ }
if(generateSeaUsingMP) {
Area mpBbox = (bbox != null ? bbox : ((MapDetails) collector).getBounds());
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev