Hi Gerd

Attached a patch to create 2 mkgmap: variables when --link-pois-to-ways
operates.

mkgmap:poi-barrier is a list of the distinct POI barrier= tags on the
way, so it will have values like:
  mkgmap:poi-barrier=gate;bollard

mkgmap:poi-highway is similar but a list of the highway= tags, eg:
  mkgmap:poi-highway=mini_roundabout;crossing

These can be tested eg:
  highway=service & access!=* & mkgmap:poi-barrier=* &
     mkgmap:poi-barrier~".*(yes|barrier|gate|bollard|block).*"
       {set access=destination}

If you are happy with this I'll update the Style Manual.

Ticker

On Tue, 2022-02-15 at 16:41 +0000, Ticker Berkin wrote:
> Hi Gerd
> 
> highway=street_lamp was just an example of a POI that can get linked
> to
> a WAY that can be ignored. There are others that are valid OSM
> tagging
> that are irrelevant to the highway behaviour.
> 
> Actually, regardless of --link-pois-to-ways, there is a problem in
> the
> scenario where there is typical road system linked to a small road
> system by just a road with mkgmap:throughroute=no and a footway.
> BaseCamp and the eTrex 30x really will route over the footway to get
> into the small road system. MapSource and, I think, the eTrex HCx
> will
> use the road.
> 
> I realise that this set-up seems unlikely, but can happen if there is
> an inconsistency in the tagging of roads in the small system that
> results in one not having mkgmap:throughroute=no that is joined to
> the
> footway. My example happened in a business park.
> 
> My style makes this problem more likely to happen, while also trying
> to
> fix it, by not setting mkgmap:throughroute=no unless there seems to
> be
> a good reason for it. Good reasons are when there is a barrier on a
> service road. This is the test I want to improve.
> 
> Ticker
> 
> On Tue, 2022-02-15 at 14:12 +0000, Gerd Petermann wrote:
> > Hi Ticker,
> > 
> > if you find highway=street_lamp nodes on highway=* ways those are
> > errors and should be fixed in OSM.
> > Street lamps are normally mapped along the road, not on the road.
> > 
> > Maybe you meant highway=traffic_signals?
> > 
> > Besides that Basecamp should never route a car over a footway. That
> > sounds like an error in the map data produced by mkgmap
> > or maybe you used wrong routing settings. Please let me know how to
> > reproduce.
> > 
> > No idea if your proposed change would improve routing, but feel
> > free
> > to experiment with that.
> > 
> > Gerd
> > 
> > ________________________________________
> > Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag
> > von Ticker Berkin <rwb-mkg...@jagit.co.uk>
> > Gesendet: Dienstag, 15. Februar 2022 13:37
> > An: mkgmap development
> > Betreff: [mkgmap-dev] option link-pois-to-ways information
> > 
> > Hi all
> > 
> > To improve routing, I'd like to get information about the POIS that
> > are
> > being linked to a WAY that can be used as part of the style/lines
> > processing.
> > 
> > The problem I'm trying to solve is to restrict car routing through
> > some
> > types of very low level roads (eg service) when there is a barrier.
> > Setting mkgmap:throughroute=no on these works nicely with MapSource
> > and
> > older devices but BaseCamp and newer devices will happily route
> > over
> > a
> > footpath to avoid a throughroute=no section.
> > 
> > At the moment, with --link-pois-to-ways, if the POI has a barrier
> > or
> > highway tag, mkgmap:way-has-pois is set true. This can be tested by
> > lines, inc/access etc, but there is no way to find out if it is a
> > significant barrier or something like highway=street_lamp.
> > 
> > points processing can set mkgmap: access & road_speed/class
> > variables
> > that are handled by inbuild code after lines processing to imposes
> > more
> > restrictions on the way and/or reduces speed/class; this is no use
> > for
> > what I want to do.
> > 
> > Possibilities are:
> > 1/ have options to say which POI tag/value combinations cause
> >    link-pois-to-ways
> > 2/ set new variables on the way, eg
> > mkgmap:barrier_tags/highway_tags,
> >    which are a list of distinct POI highway/barrier tag values.
> > 
> > Ticker
> > 
> > 
> > 
> > _______________________________________________
> > mkgmap-dev mailing list
> > mkgmap-dev@lists.mkgmap.org.uk
> > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> > _______________________________________________
> > mkgmap-dev mailing list
> > mkgmap-dev@lists.mkgmap.org.uk
> > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> 
> 
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev@lists.mkgmap.org.uk
> https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Index: src/uk/me/parabola/mkgmap/reader/osm/HighwayHooks.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/HighwayHooks.java	(revision 4896)
+++ src/uk/me/parabola/mkgmap/reader/osm/HighwayHooks.java	(working copy)
@@ -100,11 +100,11 @@
 		// if this Coord is also a POI, replace it with an
 		// equivalent CoordPOI that contains a reference to
 		// the POI's Node so we can access the POI's tags
+		final String[] coordPOITags = { "barrier", "highway" };
 		if (!(co instanceof CoordPOI)) {
 			// for now, only do this for nodes that have
 			// certain tags otherwise we will end up creating
 			// a CoordPOI for every node in the way
-			final String[] coordPOITags = { "barrier", "highway" };
 			for (String cpt : coordPOITags) {
 				if (currentNodeInWay.getTag(cpt) != null) {
 					// the POI has one of the approved tags so
@@ -138,9 +138,27 @@
 			way.addTag("mkgmap:way-has-pois", "true");
 			if (log.isInfoEnabled())
 				log.info("link-pois-to-ways: Linking POI", currentNodeInWay.toBrowseURL(), "to way at", co.toOSMURL());
+			for (String cpt : coordPOITags)
+				addTagWithList(cpt, way);
 		}
 	}
 
+	private void addTagWithList(String cpt, Way way) {
+		String poiTagVal = currentNodeInWay.getTag(cpt);
+		if (poiTagVal == null)
+			return;
+		String wayTagName = "mkgmap:poi-" + cpt;
+		String wayTagVal = way.getTag(wayTagName);
+		if (wayTagVal == null) {
+			way.addTag(wayTagName, poiTagVal); // mkgmap:poi-barrier=gate;post;this;that
+		} else if (wayTagVal.matches("(?:^|.*;)" + poiTagVal + "(?:;.*|$)")) {
+			//log.info("addToList", wayTagName, wayTagVal, "matches", poiTagVal);
+		} else {
+			way.addTag(wayTagName, wayTagVal + ';' + poiTagVal);
+			//log.info("addToList", wayTagName, wayTagVal, "append ;", poiTagVal);
+		}
+	}
+
 	@Override
 	public void onAddWay(Way way) {
 		String highway = way.getTag("highway");
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to