Skip to content

Commit

Permalink
include sidewalk width in calculation (and document it) (#4499)
Browse files Browse the repository at this point in the history
* include sidewalk width in calculation (and document it)
to address #4494

* intentionally reduce widths way below realistic estimates
see #4494 (comment)

* adjust values

* adjust values

* more adjustment

Co-authored-by: Tobias Zwick <newton@westnordost.de>
  • Loading branch information
mnalis and westnordost authored Oct 21, 2022
1 parent 4cc7615 commit d597473
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private fun estimateCyclewaysWidth(tags: Map<String, String>, isLane: Boolean):
return leftWidth + rightWidth
}

private const val BROAD_LANE = 4f
private const val LANE = 3f
// rather under-estimate then over-estimate the road width
private const val BROAD_LANE = 3.75f // standard interstate/motorway width
private const val LANE = 2.75f // widest trucks are about 2.6m
private const val SHOULDER = 2f
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AddSidewalk : OsmElementQuestType<LeftAndRightSidewalk> {
/* Unfortunately, the filter above is not enough. In OSM, sidewalks may be mapped as
* separate ways as well and it is not guaranteed that in this case, sidewalk = separate
* (or foot = use_sidepath) is always tagged on the main road then. So, all roads should
* be excluded whose center is within of ~15 meters of a footway, to be on the safe side. */
* be excluded whose center is within several meters of a footway, to be on the safe side. */

if (roadsWithMissingSidewalks.isNotEmpty()) {

Expand Down Expand Up @@ -75,11 +75,14 @@ class AddSidewalk : OsmElementQuestType<LeftAndRightSidewalk> {
return roadsWithMissingSidewalks + roadsWithInvalidSidewalkTags
}

/* Calculate when footway is too far away from the road to be considered its sidewalk.
It is an estimate, and we deliberately err on the side of showing the quest too often. */
private fun getMinDistanceToWays(tags: Map<String, String>): Float =
(
(estimateRoadwayWidth(tags) ?: guessRoadwayWidth(tags)) +
(estimateParkingOffRoadWidth(tags) ?: 0f) +
(estimateCycleTrackWidth(tags) ?: 0f)
(estimateCycleTrackWidth(tags) ?: 0f) +
1.5f // assumed sidewalk width
) / 2f +
4f // + generous buffer for possible grass verge

Expand Down

0 comments on commit d597473

Please sign in to comment.