Annoyingly, motorway exit POIs don't show up on my Nuvi so I thought
that the next best thing would be to label the exit roads with the exit
name (number). This patch does that in a generic way. It introduces a
new facility:
If a way (of highway type X) has a POI for its first point and that
POI has a tag called X_name, set the way's name to that tag's value.
So, if the exit POI (which should be positioned on the first point of
the exit ramp) set's motorway_link_name to its name/ref, then the ramp
will get that name. So the points style file has something like:
highway=motorway_junction & ref=* { add motorway_link_name = '${ref}' name
'${ref}' }
highway=motorway_junction & name=* { add motorway_link_name = '${name}' name
'${name}'}
With the patch in place, you need to use the --link-pois-to-ways
option for this to work.
All feedback appreciated.
Mark
diff --git a/resources/styles/default/points b/resources/styles/default/points
index 473a134..44b73a6 100644
--- a/resources/styles/default/points
+++ b/resources/styles/default/points
@@ -88,7 +88,9 @@ amenity=zoo [0x2c07 resolution 21]
highway=bus_stop [0x2f08 resolution 21]
-highway=motorway_junction { name '${ref} ${name}' | '${ref}' | '${name}' }
+#highway=motorway_junction { name '${ref} ${name}' | '${ref}' | '${name}' }
+highway=motorway_junction & ref=* { add motorway_link_name = '${ref}' name '${ref}' }
+highway=motorway_junction & name=* { add motorway_link_name = '${name}' name '${name}'}
highway=motorway_junction [0x2000 resolution 16]
highway=services { name '${ref} ${name}' | '${ref}' | '${name}' }
diff --git a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
index 2e124ea..cfb7027 100644
--- a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
+++ b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
@@ -542,6 +542,20 @@ public class StyledConverter implements OsmConverter {
if("true".equals(way.getTag("mkgmap:way-has-pois"))) {
List<Coord> points = way.getPoints();
+ // for highways, see if its name is set by a POI located
+ // at the first point
+ if(points.size() > 1 && points.get(0) instanceof CoordPOI) {
+ String highwayKind = way.getTag("highway");
+ if(highwayKind != null) {
+ Node poiNode = ((CoordPOI)points.get(0)).getNode();
+ String nameFromPoi = poiNode.getTag(highwayKind + "_name");
+ if(nameFromPoi != null) {
+ way.setName(nameFromPoi);
+ log.info(highwayKind + " " + way.getId() + " named '" + way.getName() + "'");
+ }
+ }
+ }
+
// at this time, we are only looking for POIs that have
// the "access" tag defined - if they do, copy the access
// permissions to the way - what we want to achieve is
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 29ae5f0..aeda7ac 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
@@ -822,10 +822,12 @@ class Osm5XmlHandler extends DefaultHandler {
// equivalent CoordPOI that contains a reference to
// the POI's Node so we can access the POI's tags
Node node = nodeMap.get(id);
- // for now, only do this for nodes that have an access
- // tag otherwise we will end up creating a CoordPOI
- // for every node
- if(node != null && node.getTag("access") != null) {
+ // for now, only do this for the first node in the way
+ // and for nodes that have an access tag otherwise we
+ // will end up creating a CoordPOI for every node
+ if(node != null &&
+ (currentWay.getPoints().size() == 0 ||
+ node.getTag("access") != null)) {
if(!(co instanceof CoordPOI)) {
co = new CoordPOI(co.getLatitude(), co.getLongitude(), node);
coordMap.put(id, co);
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev