if self.osm_type not in ('N', 'W', 'R'):
raise ValueError(f"Illegal OSM type '{self.osm_type}'. Must be one of N, W, R.")
+ def class_as_housenumber(self) -> Optional[int]:
+ """ Interpret the class property as a housenumber and return it.
+
+ If the OSM ID points to an interpolation, then the class may be
+ a number pointing to the exact number requested. This function
+ returns the housenumber as an int, if class is set and is a number.
+ """
+ if self.osm_class and self.osm_class.isdigit():
+ return int(self.osm_class)
+ return None
+
PlaceRef = Union[PlaceID, OsmID]
except ValueError as exc:
raise UsageError('Point parameter needs to be numbers.') from exc
- if x < -180.0 or x > 180.0 or y < -90.0 or y > 90.0:
+ if not -180 <= x <= 180 or not -90 <= y <= 90.0:
raise UsageError('Point coordinates invalid.')
return Point(x, y)