Skip to content

Commit

Permalink
don't consider the width of service roads and tracks dubious if they …
Browse files Browse the repository at this point in the history
…are only one vehicle broad without being a oneway
  • Loading branch information
westnordost committed May 7, 2024
1 parent 5c41733 commit 113c312
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions app/src/main/java/de/westnordost/streetcomplete/osm/RoadWidth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,25 @@ fun hasDubiousRoadWidth(tags: Map<String, String>): Boolean? {
val roadType = tags["highway"]
if (roadType in ALL_ROADS) {
val usableWidth = estimateUsableRoadwayWidth(tags) ?: return null
if (isOneway(tags)) {
if (roadType == "service" || roadType == "track") {
// a service road (e.g. driveway) or just some track should be at least as broad
// as the default profile of OSRM considers as passable by cars
return usableWidth < 1.9f
} else {
// all others should at least be broad enough to accommodate a truck
return usableWidth < 2.6f
}
// service roads (alleys, driveways, ...) and tracks don't need to be oneways for it to be
// plausible to be only as broad as the default profile of OSRM considers as passable by cars
if (roadType == "service" || roadType == "track") {
return usableWidth < 1.9f
// usable width of oneways should be broad enough to accommodate a truck
} else if (isOneway(tags)) {
return usableWidth < 2.6f
/* one may assume that if the usable width of non-oneway roads is below double the above
widths, it is also implausible, however, this is actually sometimes the case, by design:
- on 2-1 roads (roads with no car lanes markings and advisory cycle lanes on both sides)
https://en.wikipedia.org/wiki/2-1_road
- certain residential streets with (partial) on-street parking that narrow them down so
much that drivers have to do a slalom around the parking cars and have to wait on each
other to pass them
Hence, to declare such common cases implausible does not make sense.
However, if the total carriageway (ignoring street parking etc.) of a non-oneway is below
2x the above, THEN it is dubious
*/
} else {
/* one may assume that if the usable width of non-oneway roads is below double the above
widths, it is also implausible, however, this is actually sometimes the case, by design:
- on 2-1 roads (roads with no car lanes markings and advisory cycle lanes on both sides)
https://en.wikipedia.org/wiki/2-1_road
- certain residential streets with (partial) on-street parking that narrow them down so
much that drivers have to do a slalom around the parking cars and have to wait on each
other to pass them
Hence, to declare such common cases implausible is dubious.
However, if the total carriageway (ignoring street parking etc.) of a non-oneway is below
2x the above, then it is dubious
*/
val width = estimateRoadwayWidth(tags) ?: return null
return width < 2 * 2.6f
}
Expand Down

0 comments on commit 113c312

Please sign in to comment.