I've found a bug that results in some POIs (mainly place POIs) that have
no address information (so only the default country and default region).
The POIs are automatically created by the add-pois-to-areas parameter
and originate from multipolygons.
This happens if mkgmap is started at least with the parameters
--add-pois-to-areas --index --location-autofill=bounds
It is important that the location-autofill parameter contains the value
bounds only. In this case the add-pois-to-areas takes the middle points
of all multipolygons and create a new POI with tags copied from the mp.
But the mp has no address information because the LocationHook ignores
all relations and multipolygons.
The patch fixes that in the LocationHook. It now adds the
mkgmap:admin_levelN tags to all mp. It uses the calculated middle point
of the mp to query for the bounds information.
WanMil
Index: src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java (revision 2326)
+++ src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java (working copy)
@@ -145,6 +145,30 @@
resultLog.debug("W", way.getId(), locationTagsToString(way));
}
}
+
+ // process all multipolygons - the add-pois-to-area function uses its
+ // center point and its tags so the mp must be tagged itself with the bounds
+ // tags
+ for (Relation r : saver.getRelations().values()) {
+ if (r instanceof MultiPolygonRelation) {
+ // check if the mp could be processed
+ Coord mpCenter = ((MultiPolygonRelation) r).getCofG();
+ if (mpCenter != null && saver.getBoundingBox().contains(mpCenter)){
+ // create a fake node for which the bounds information is collected
+ Node mpNode = new Node(FakeIdGenerator.makeFakeId(), mpCenter);
+ processElem(mpNode);
+ // copy the bounds tags back to the multipolygon
+ for (String boundsTag : BoundaryQuadTree.mkgmapTagsArray) {
+ String tagValue = mpNode.getTag(boundsTag);
+ if (tagValue != null) {
+ r.addTag(boundsTag, tagValue);
+ }
+ }
+ if (resultLog.isDebugEnabled())
+ resultLog.debug("R", r.getId(), locationTagsToString(r));
+ }
+ }
+ }
}
/**
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev