Skip to content

Commit ecfd7eb

Browse files
Exclude ways with access=private or have access=no and do no explicitly allow bicycles (#847)
* Always exclude ways with access no/private * allow where access=no and bicycles are allowed --------- Co-authored-by: Luis Alvergue <lalver1@gmail.com>
1 parent f115bee commit ecfd7eb

1 file changed

Lines changed: 60 additions & 6 deletions

File tree

brokenspoke_analyzer/scripts/sql/features/functional_class.sql

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ WHERE
2323
'secondary',
2424
'primary',
2525
'living_street'
26+
)
27+
AND (
28+
osm.access IS NULL
29+
OR (
30+
osm.access = 'no'
31+
AND osm.bicycle IN ('yes', 'permissive', 'designated')
32+
)
33+
OR osm.access NOT IN ('no', 'private')
2634
);
2735

2836
UPDATE neighborhood_ways
@@ -31,14 +39,30 @@ FROM neighborhood_osm_full_line AS osm
3139
WHERE
3240
neighborhood_ways.osm_id = osm.osm_id
3341
AND osm.highway = 'track'
34-
AND osm.tracktype = 'grade1';
42+
AND osm.tracktype = 'grade1'
43+
AND (
44+
osm.access IS NULL
45+
OR (
46+
osm.access = 'no'
47+
AND osm.bicycle IN ('yes', 'permissive', 'designated')
48+
)
49+
OR osm.access NOT IN ('no', 'private')
50+
);
3551

3652
UPDATE neighborhood_ways
3753
SET functional_class = 'path'
3854
FROM neighborhood_osm_full_line AS osm
3955
WHERE
4056
neighborhood_ways.osm_id = osm.osm_id
41-
AND osm.highway IN ('cycleway', 'path');
57+
AND osm.highway IN ('cycleway', 'path')
58+
AND (
59+
osm.access IS NULL
60+
OR (
61+
osm.access = 'no'
62+
AND osm.bicycle IN ('yes', 'permissive', 'designated')
63+
)
64+
OR osm.access NOT IN ('no', 'private')
65+
);
4266

4367
UPDATE neighborhood_ways
4468
SET
@@ -48,7 +72,15 @@ FROM neighborhood_osm_full_line AS osm
4872
WHERE
4973
neighborhood_ways.osm_id = osm.osm_id
5074
AND osm.highway = 'footway'
51-
AND osm.footway IN ('crossing', 'traffic_island');
75+
AND osm.footway IN ('crossing', 'traffic_island')
76+
AND (
77+
osm.access IS NULL
78+
OR (
79+
osm.access = 'no'
80+
AND osm.bicycle IN ('yes', 'permissive', 'designated')
81+
)
82+
OR osm.access NOT IN ('no', 'private')
83+
);
5284

5385
UPDATE neighborhood_ways
5486
SET functional_class = 'path'
@@ -57,7 +89,14 @@ WHERE
5789
neighborhood_ways.osm_id = osm.osm_id
5890
AND osm.highway = 'footway'
5991
AND osm.bicycle IN ('yes', 'permissive', 'designated')
60-
AND (osm.access IS NULL OR osm.access NOT IN ('no', 'private'))
92+
AND (
93+
osm.access IS NULL
94+
OR (
95+
osm.access = 'no'
96+
AND osm.bicycle IN ('yes', 'permissive', 'designated')
97+
)
98+
OR osm.access NOT IN ('no', 'private')
99+
)
61100
AND COALESCE(width_ft, 0) >= 8;
62101

63102
UPDATE neighborhood_ways
@@ -66,7 +105,15 @@ FROM neighborhood_osm_full_line AS osm
66105
WHERE
67106
neighborhood_ways.osm_id = osm.osm_id
68107
AND osm.highway = 'service'
69-
AND osm.bicycle IN ('yes', 'permissive', 'designated');
108+
AND osm.bicycle IN ('yes', 'permissive', 'designated')
109+
AND (
110+
osm.access IS NULL
111+
OR (
112+
osm.access = 'no'
113+
AND osm.bicycle IN ('yes', 'permissive', 'designated')
114+
)
115+
OR osm.access NOT IN ('no', 'private')
116+
);
70117

71118
UPDATE neighborhood_ways
72119
SET functional_class = 'living_street'
@@ -75,7 +122,14 @@ WHERE
75122
neighborhood_ways.osm_id = osm.osm_id
76123
AND osm.highway = 'pedestrian'
77124
AND osm.bicycle IN ('yes', 'permissive', 'designated')
78-
AND (osm.access IS NULL OR osm.access NOT IN ('no', 'private'));
125+
AND (
126+
osm.access IS NULL
127+
OR (
128+
osm.access = 'no'
129+
AND osm.bicycle IN ('yes', 'permissive', 'designated')
130+
)
131+
OR osm.access NOT IN ('no', 'private')
132+
);
79133

80134
-- remove stuff that we don't want to route over
81135
DELETE FROM neighborhood_ways

0 commit comments

Comments
 (0)