Correction in number/float detection for floors, as it caused another crash in overnight rendering.
This commit is contained in:
parent
6f9d8d9dd5
commit
5adb6733ef
18
osmxml.py
18
osmxml.py
@ -203,6 +203,19 @@ class mstr_osmxml:
|
|||||||
|
|
||||||
# Return the found surface type
|
# Return the found surface type
|
||||||
return surface
|
return surface
|
||||||
|
|
||||||
|
|
||||||
|
# Again, a crash on number checking of levels.
|
||||||
|
# Short call for sanity check
|
||||||
|
def is_float(element: any) -> bool:
|
||||||
|
#If you expect None to be passed:
|
||||||
|
if element is None:
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
float(element)
|
||||||
|
return True
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
# Find the levels of a building (for shadow rendering)
|
# Find the levels of a building (for shadow rendering)
|
||||||
@ -217,8 +230,9 @@ class mstr_osmxml:
|
|||||||
a = tag.getAttribute("k")
|
a = tag.getAttribute("k")
|
||||||
v = tag.getAttribute("v")
|
v = tag.getAttribute("v")
|
||||||
if a == "building:levels":
|
if a == "building:levels":
|
||||||
lvl = int(float(v)) # <- This blew layergen and maskgen at some buildings with 1.5 floors
|
if self.is_float(v) == True:
|
||||||
break
|
lvl = int(float(v)) # <- This blew layergen and maskgen at some buildings with 1.5 floors
|
||||||
|
break
|
||||||
return lvl
|
return lvl
|
||||||
|
|
||||||
# Find minimum level of a building
|
# Find minimum level of a building
|
||||||
|
Loading…
x
Reference in New Issue
Block a user