Skip to content

Commit 33305e3

Browse files
authored
Merge pull request #1331 from linesinalandscape/fix-highway-types
exclude highway types rest_area and services for all network types
2 parents 77f227b + aeb4049 commit 33305e3

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
- exclude highways tagged as "rest_area" or "services" (which differs from "service") for all network types, these are amenity areas rather than routable ways (#1328)
4+
35
## 2.0.5 (2025-07-05)
46

57
- fix bug that prevents querying or projecting in polar regions (#1324 #1326)

osmnx/_overpass.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def _get_network_filter(network_type: str) -> str:
3535
excludes ways that are incompatible with the requested network type. You
3636
can choose from the following types:
3737
38-
"all" retrieves all public and private-access ways currently in use.
38+
"all" retrieves all public and private-access ways currently in use,
39+
(defined to exclude ways that represent areas either explicitly (area=yes)
40+
or by OSM tagging convention (rest_area, services))
3941
4042
"all_public" retrieves all public ways currently in use.
4143
@@ -75,8 +77,8 @@ def _get_network_filter(network_type: str) -> str:
7577
filters["drive"] = (
7678
f'["highway"]["area"!~"yes"]{settings.default_access}'
7779
f'["highway"!~"abandoned|bridleway|bus_guideway|construction|corridor|cycleway|elevator|'
78-
f"escalator|footway|no|path|pedestrian|planned|platform|proposed|raceway|razed|service|"
79-
f'steps|track"]'
80+
f"escalator|footway|no|path|pedestrian|planned|platform|proposed|raceway|razed|"
81+
f'rest_area|service|services|steps|track"]'
8082
f'["motor_vehicle"!~"no"]["motorcar"!~"no"]'
8183
f'["service"!~"alley|driveway|emergency_access|parking|parking_aisle|private"]'
8284
)
@@ -85,8 +87,8 @@ def _get_network_filter(network_type: str) -> str:
8587
filters["drive_service"] = (
8688
f'["highway"]["area"!~"yes"]{settings.default_access}'
8789
f'["highway"!~"abandoned|bridleway|bus_guideway|construction|corridor|cycleway|elevator|'
88-
f"escalator|footway|no|path|pedestrian|planned|platform|proposed|raceway|razed|steps|"
89-
f'track"]'
90+
f"escalator|footway|no|path|pedestrian|planned|platform|proposed|raceway|razed|"
91+
f'rest_area|services|steps|track"]'
9092
f'["motor_vehicle"!~"no"]["motorcar"!~"no"]'
9193
f'["service"!~"emergency_access|parking|parking_aisle|private"]'
9294
)
@@ -99,7 +101,7 @@ def _get_network_filter(network_type: str) -> str:
99101
filters["walk"] = (
100102
f'["highway"]["area"!~"yes"]{settings.default_access}'
101103
f'["highway"!~"abandoned|bus_guideway|construction|cycleway|motor|no|planned|platform|'
102-
f'proposed|raceway|razed"]'
104+
f'proposed|raceway|razed|rest_area|services"]'
103105
f'["foot"!~"no"]["service"!~"private"]'
104106
f'["sidewalk"!~"separate"]["sidewalk:both"!~"separate"]'
105107
f'["sidewalk:left"!~"separate"]["sidewalk:right"!~"separate"]'
@@ -110,23 +112,24 @@ def _get_network_filter(network_type: str) -> str:
110112
filters["bike"] = (
111113
f'["highway"]["area"!~"yes"]{settings.default_access}'
112114
f'["highway"!~"abandoned|bus_guideway|construction|corridor|elevator|escalator|footway|'
113-
f'motor|no|planned|platform|proposed|raceway|razed|steps"]'
115+
f'motor|no|planned|platform|proposed|raceway|razed|rest_area|services|steps"]'
114116
f'["bicycle"!~"no"]["service"!~"private"]'
115117
)
116118

117119
# to download all public ways, just filter out everything not currently in
118120
# use or that is private-access only
119121
filters["all_public"] = (
120122
f'["highway"]["area"!~"yes"]{settings.default_access}'
121-
f'["highway"!~"abandoned|construction|no|planned|platform|proposed|raceway|razed"]'
123+
f'["highway"!~"abandoned|construction|no|planned|platform|proposed|raceway|razed|'
124+
f'rest_area|services"]'
122125
f'["service"!~"private"]'
123126
)
124127

125128
# to download all ways, including private-access ones, just filter out
126129
# everything not currently in use
127130
filters["all"] = (
128131
'["highway"]["area"!~"yes"]["highway"!~"abandoned|construction|no|planned|platform|'
129-
'proposed|raceway|razed"]'
132+
'proposed|raceway|razed|rest_area|services"]'
130133
)
131134

132135
if network_type in filters:

0 commit comments

Comments
 (0)