Skip to content

Commit 6867993

Browse files
committed
Fixes flake8 issues in road handler
1 parent af1edfa commit 6867993

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

robosat/osm/road.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import geojson
66
import shapely.geometry
77

8-
from robosat.osm.core import is_polygon
9-
108

119
class RoadHandler(osmium.SimpleHandler):
1210
"""Extracts road polygon features (visible in satellite imagery) from the map.
@@ -122,19 +120,19 @@ def way(self, w):
122120
# https://wiki.openstreetmap.org/wiki/Tag:busway%3Dlane
123121
# https://wiki.openstreetmap.org/wiki/Tag:cycleway%3Dlane
124122
# https://wiki.openstreetmap.org/wiki/Key:parking:lane
125-
except:
123+
except ValueError:
126124
print("Warning: invalid feature: https://www.openstreetmap.org/way/{}".format(w.id), file=sys.stderr)
127125

128126
road_width = left_hard_shoulder_width + lane_width * lanes + right_hard_shoulder_width
129127

130128
if "width" in w.tags:
131129
try:
132130
# At least one meter wide, for road classes specified above
133-
road_width = max(float(w.tags["width"]), 1)
131+
road_width = max(float(w.tags["width"]), 1.0)
134132

135133
# Todo: handle optional units such as "2 m"
136134
# https://wiki.openstreetmap.org/wiki/Key:width
137-
except:
135+
except ValueError:
138136
print("Warning: invalid feature: https://www.openstreetmap.org/way/{}".format(w.id), file=sys.stderr)
139137

140138
geometry = geojson.LineString([(n.lon, n.lat) for n in w.nodes])

0 commit comments

Comments
 (0)