Skip to content
Snippets Groups Projects

Resolve "Create the Geometry, Quadkey, RelationID and Floorspace rules"

1 file
+ 7
7
Compare changes
  • Side-by-side
  • Inline
@@ -19,17 +19,17 @@ class StoriesAndFloorspaceRule:
from math import ceil
storey_options = [self.get_info(building["tags"]) for building in [tags] + relations]
story_options = [self.get_info(building["tags"]) for building in [tags] + relations]
for storey_string in storey_options:
if storey_string is None or storey_string == "":
for story_string in story_options:
if story_string is None or story_string == "":
continue
try:
storeys = ceil(float(storey_string))
if storeys < 1:
stories = ceil(float(story_string))
if stories < 1:
raise ValueError("Number of stories cannot be below 1")
floorspace = storeys * area
return {"storeys": storeys, "floorspace": floorspace}
floorspace = stories * area
return {"stories": stories, "floorspace": floorspace}
except ValueError:
continue
return {"storeys": None, "floorspace": None}
Loading