Skip to content
Snippets Groups Projects

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

All threads resolved!
Files
2
@@ -19,20 +19,20 @@ 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}
return {"stories": None, "floorspace": None}
@staticmethod
def get_info(tags):
@@ -41,7 +41,7 @@ class StoriesAndFloorspaceRule:
Args:
tags:
Building tags, such has the building levels or building type.
Building tags, such as the building levels or building type.
Returns:
Number of stories, if the attribute `building:levels` exist, otherwise `None`.
Loading