nrenner / brouter-web

Web client for BRouter, a routing engine based on OpenStreetMap
https://brouter.de/brouter-web/
MIT License
363 stars 69 forks source link

Route analysis: Only highlight actual tracks for a given tracktype #771

Closed rkflx closed 8 months ago

rkflx commented 1 year ago

In the OSM data model, a tracktype (e.g. "Grade1") can be set for highways other than tracks (e.g. "Unclassified" roads) too. However, in the route analysis sidebar categories are exclusive, i.e. there are separate categories per tracktype for "track" highways, but for other highways all tracktypes are summarized into a single category.

This separation already works fine for the resulting table, but when highlighting a category on the map by clicking on the respective table row, highways other than tracks could be marked too in case they had a tracktype assigned.

When trying to match a particular highway on the map to a given tracktype in wayTagsMatchesData(...), it is needed to check if that highway is actually a highway of category "track". Currently that check is only done for "unknown" tracktypes, but is missing for all other tracktypes.

By adding the missing check, the issue can be resolved. It is enough to move the check to the outer if instead of duplicating it, since the later generic return will be false due to parsed.highway===dataName evaluating to false in that case anyway.

Fixes #768.

Test Plan:

rkflx commented 1 year ago

@mjaschen I'd appreciate you taking a second look whether I missed anything. Thanks!

mjaschen commented 1 year ago

Looks fine to me, thanks for figuring out the fix :-)