[Git][debian-gis-team/mkgmap][upstream] New upstream version 0.0.0+svn4214
Bas Couwenberg
gitlab at salsa.debian.org
Thu Aug 2 06:42:59 BST 2018
Bas Couwenberg pushed to branch upstream at Debian GIS Project / mkgmap
Commits:
8827792c by Bas Couwenberg at 2018-08-02T05:30:48Z
New upstream version 0.0.0+svn4214
- - - - -
8 changed files:
- resources/mkgmap-version.properties
- resources/styles/default/points
- src/uk/me/parabola/mkgmap/filters/ShapeMergeFilter.java
- src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java
- src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java
- src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java
- src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java
- src/uk/me/parabola/mkgmap/reader/osm/UnusedElementsRemoverHook.java
Changes:
=====================================
resources/mkgmap-version.properties
=====================================
--- a/resources/mkgmap-version.properties
+++ b/resources/mkgmap-version.properties
@@ -1,2 +1,2 @@
-svn.version: 4193
-build.timestamp: 2018-05-31T07:29:23+0100
+svn.version: 4214
+build.timestamp: 2018-07-28T09:29:55+0100
=====================================
resources/styles/default/points
=====================================
--- a/resources/styles/default/points
+++ b/resources/styles/default/points
@@ -218,6 +218,7 @@ man_made=tower|man_made=mast|landmark=chimney [0x6411 resolution 24]
# Edge 705 displays 0x650a,0x6511,0x6512,0x6513,0x6603,0x6614 as hollow white circles, no menu
natural=cave_entrance [0x6601 resolution 24]
+natural=cape [0x6606 resolution 24]
natural=cliff [0x6607 resolution 24]
natural=peak {name '${name|def:}${ele|height:m=>ft|def:}' } [0x6616 resolution 24]
natural=rock [0x6614 resolution 24]
=====================================
src/uk/me/parabola/mkgmap/filters/ShapeMergeFilter.java
=====================================
--- a/src/uk/me/parabola/mkgmap/filters/ShapeMergeFilter.java
+++ b/src/uk/me/parabola/mkgmap/filters/ShapeMergeFilter.java
@@ -529,7 +529,9 @@ public class ShapeMergeFilter{
* (c1.getHighPrecLat() - c2.getHighPrecLat());
}
if (Math.abs(signedAreaSize) < SINGLE_POINT_AREA){
- log.debug("very small shape near", points.get(0).toOSMURL(), "signed area in high prec map units:", signedAreaSize );
+ if (log.isDebugEnabled()) {
+ log.debug("very small shape near", points.get(0).toOSMURL(), "signed area in high prec map units:", signedAreaSize );
+ }
}
return signedAreaSize;
}
=====================================
src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java
=====================================
--- a/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java
@@ -962,22 +962,6 @@ public class HousenumberGenerator {
}
}
-
- private static void checkSegment(HousenumberMatch house, MapRoad road, int seg){
- Coord cx = house.getLocation();
- Coord c0 = road.getPoints().get(seg);
- Coord c1 = road.getPoints().get(seg + 1);
- double frac = getFrac(c0, c1, cx);
- double dist = distanceToSegment(c0,c1,cx,frac);
- if (dist < house.getDistance()){
- house.setDistance(dist);
- house.setRoad(road);
- house.setSegment(seg);
- house.setSegmentFrac(frac);
- }
- }
-
-
/**
* process option --x-name-service-roads=n
* The program identifies unnamed roads which are only connected to one
@@ -1700,28 +1684,6 @@ public class HousenumberGenerator {
}
- private static class RoadPoint implements Locatable{
- final Coord p;
- final MapRoad r;
- final int segment;
- final int partOfSeg;
-
- public RoadPoint(MapRoad road, Coord co, int s, int part) {
- this.p = co;
- this.r = road;
- this.segment = s;
- this.partOfSeg = part;
- }
- @Override
- public Coord getLocation() {
- return p;
- }
- @Override
- public String toString() {
- return r + " " + segment + " " + partOfSeg;
- }
- }
-
/**
* A performance critical part:
* Index all road segments to be able to find all road segments within a given range
@@ -1729,13 +1691,35 @@ public class HousenumberGenerator {
* @author Gerd Petermann
*
*/
- class RoadSegmentIndex {
+ private static class RoadSegmentIndex {
private final KdTree<RoadPoint> kdTree = new KdTree<>();
private final Int2ObjectOpenHashMap<Set<RoadPoint>> nodeId2RoadPointMap = new Int2ObjectOpenHashMap<>();
private final double range;
private final double maxSegmentLength;
private final double kdSearchRange;
+ private static class RoadPoint implements Locatable{
+ final Coord p;
+ final MapRoad r;
+ final int segment;
+ final int partOfSeg;
+
+ public RoadPoint(MapRoad road, Coord co, int s, int part) {
+ this.p = co;
+ this.r = road;
+ this.segment = s;
+ this.partOfSeg = part;
+ }
+ @Override
+ public Coord getLocation() {
+ return p;
+ }
+ @Override
+ public String toString() {
+ return r + " " + segment + " " + partOfSeg;
+ }
+ }
+
public RoadSegmentIndex(List<MapRoad> roads, double rangeInMeter) {
this.range = rangeInMeter;
this.maxSegmentLength = range * 2 / 3;
@@ -1931,6 +1915,20 @@ public class HousenumberGenerator {
}
+ private static void checkSegment(HousenumberMatch house, MapRoad road, int seg){
+ Coord cx = house.getLocation();
+ Coord c0 = road.getPoints().get(seg);
+ Coord c1 = road.getPoints().get(seg + 1);
+ double frac = getFrac(c0, c1, cx);
+ double dist = distanceToSegment(c0,c1,cx,frac);
+ if (dist < house.getDistance()){
+ house.setDistance(dist);
+ house.setRoad(road);
+ house.setSegment(seg);
+ house.setSegmentFrac(frac);
+ }
+ }
+
}
=====================================
src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java
=====================================
--- a/src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/ElementSaver.java
@@ -108,7 +108,7 @@ public class ElementSaver {
}
/**
- * Add the given node and save it. The node should have tags.
+ * Add the given node and save it. The node should have tags, if not it should be a member of a relation.
*
* @param node The osm node.
*/
=====================================
src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java
=====================================
--- a/src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/LocationHook.java
@@ -180,7 +180,13 @@ public class LocationHook extends OsmReadingHooksAdaptor {
Way way = (Way) elem;
// try the mid point of the way first
int middle = way.getPoints().size() / 2;
- tags = search(way.getPoints().get(middle));
+ Coord midPoint;
+ if (way.getPoints().size() == 2) {
+ midPoint = way.getPoints().get(0).makeBetweenPoint(way.getPoints().get(1), 0.5);
+ } else {
+ midPoint = way.getPoints().get(middle);
+ }
+ tags = search(midPoint);
if (tags == null){
// try 1st point next
tags = search(way.getPoints().get(0));
=====================================
src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java
=====================================
--- a/src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java
@@ -61,6 +61,8 @@ public class OsmMapDataSource extends MapperBasedMapDataSource implements Loadab
private static final Logger log = Logger.getLogger(OsmMapDataSource.class);
private Style style;
+
+ // attention, the order of the hooks is important!
private final OsmReadingHooks[] POSSIBLE_HOOKS = {
new SeaGenerator(),
new MultiPolygonFinishHook(),
=====================================
src/uk/me/parabola/mkgmap/reader/osm/UnusedElementsRemoverHook.java
=====================================
--- a/src/uk/me/parabola/mkgmap/reader/osm/UnusedElementsRemoverHook.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/UnusedElementsRemoverHook.java
@@ -15,11 +15,8 @@ package uk.me.parabola.mkgmap.reader.osm;
import java.awt.Rectangle;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
-import java.util.Set;
import uk.me.parabola.imgfmt.app.Area;
import uk.me.parabola.imgfmt.app.Coord;
@@ -28,7 +25,7 @@ import uk.me.parabola.util.EnhancedProperties;
/**
* The hook removes all elements that will not be included in the map and can therefore
- * be safely removed. This improves the performance because the elements does not have
+ * be safely removed. This improves the performance because the elements do not have
* to go through the style system.
*
* @author WanMil
@@ -39,8 +36,8 @@ public class UnusedElementsRemoverHook extends OsmReadingHooksAdaptor {
private ElementSaver saver;
/** node with tags of this list must not be removed */
- private Collection<String> nodeTagBlacklist;
-
+ private List<Entry<String,String>> areasToPoiNodeTags;
+
public UnusedElementsRemoverHook() {
}
@@ -51,12 +48,10 @@ public class UnusedElementsRemoverHook extends OsmReadingHooksAdaptor {
// where the POI is placed in polygons. They must not be removed if the polygon
// is not removed. Checking if the polygon is not removed is too costly therefore
// all nodes with these tags are kept.
- nodeTagBlacklist = new HashSet<String>();
- List<Entry<String,String>> areasToPoiNodeTags = POIGeneratorHook.getPoiPlacementTags(props);
- for (Entry<String,String> nodeTags : areasToPoiNodeTags) {
- nodeTagBlacklist.add(nodeTags.getKey());
- }
-
+ if (props.containsKey("add-pois-to-areas"))
+ areasToPoiNodeTags = POIGeneratorHook.getPoiPlacementTags(props);
+ else
+ areasToPoiNodeTags = new ArrayList<>();
return true;
}
@@ -81,11 +76,13 @@ public class UnusedElementsRemoverHook extends OsmReadingHooksAdaptor {
if (bbox.contains(node.getLocation()) == false) {
boolean removeNode = true;
- // check if the node has no tag of the blacklist
- if (nodeTagBlacklist.isEmpty() == false) {
- for (String tag : nodeTagBlacklist ) {
- if (node.getTag(tag) != null) {
- // the node contains one tag that might be interesting for the POIGeneratorHook
+ for (Entry<String, String> tag : areasToPoiNodeTags) {
+ // check if the node has a tag used by the POIGeneratorHook
+ String val = node.getTag(tag.getKey());
+ if (val != null) {
+ if (tag.getValue() == null || val.equals(tag.getValue())) {
+ // the node contains one tag that might be
+ // interesting for the POIGeneratorHook
// do not remove it
removeNode = false;
break;
@@ -100,22 +97,7 @@ public class UnusedElementsRemoverHook extends OsmReadingHooksAdaptor {
}
}
- long tr1 = System.currentTimeMillis();
-
- // store all way ids that are referenced by a relation
- // all tags without a tag must not be removed if they are referenced by a relation
- Set<Long> relationWays = new HashSet<Long>();
- for (Relation rel : saver.getRelations().values()) {
- for (Entry<String, Element> relEntry : rel.getElements()) {
- if (relEntry.getValue() instanceof Way) {
- relationWays.add(relEntry.getValue().getId());
- }
- }
- }
- log.debug("Collecting way ids from relations took", (System.currentTimeMillis()-tr1), "ms");
-
Rectangle bboxRect = new Rectangle(bbox.getMinLong(), bbox.getMinLat(), bbox.getWidth(), bbox.getHeight());
- long relWays = 0;
long ways = saver.getWays().size();
for (Way way : new ArrayList<Way>(saver.getWays().values())) {
if (way.getPoints().isEmpty()) {
@@ -124,15 +106,11 @@ public class UnusedElementsRemoverHook extends OsmReadingHooksAdaptor {
continue;
}
- // check if a way has no tags and is not a member of a relation
- // a relation might be used to add tags to the way using the style file
+ // check if a way has no tags
+ // it is presumed that the RelationStyleHook was already executed
if (way.getTagCount() == 0) {
- if (relationWays.contains(way.getId())) {
- relWays++;
- } else {
- saver.getWays().remove(way.getId());
- continue;
- }
+ saver.getWays().remove(way.getId());
+ continue;
}
// check if the way is completely outside the tile bounding box
@@ -183,15 +161,14 @@ public class UnusedElementsRemoverHook extends OsmReadingHooksAdaptor {
// no coord of the way is within the bounding box
// check if the way possibly covers the bounding box completely
Area wayBbox = new Area(minLat, minLong, maxLat, maxLong);
- if (wayBbox.intersects(saver.getBoundingBox())) {
- log.debug(way, "possibly covers the bbox completely. Keep it.", way.toTagString());
+ if (wayBbox.contains(saver.getBoundingBox())) {
+ log.debug(way, "possibly covers the bbox completely. Keep it.");
} else {
saver.getWays().remove(way.getId());
}
}
}
- log.info("Relation referenced ways:", relationWays.size(), "Used:", relWays);
log.info("Nodes: before:", nodes, "after:", saver.getNodes().size());
log.info("Ways: before:", ways, "after:", saver.getWays().size());
log.info("Removing unused elements took", (System.currentTimeMillis()-t1), "ms");
View it on GitLab: https://salsa.debian.org/debian-gis-team/mkgmap/commit/8827792cb6796c6cd41e9cfd2f3ecd6312cd35d2
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/mkgmap/commit/8827792cb6796c6cd41e9cfd2f3ecd6312cd35d2
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20180802/3beebcf6/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list