Skip to content
Snippets Groups Projects

Fixed condition to no longer raise an error

Open Karsten Prehn requested to merge fix/function-classification_from_features into main
1 unresolved thread
Files
2
+ 11
5
@@ -593,18 +593,24 @@ class Quadtile(SpatialFunctions):
assert "geometry" in geometry
for geom in geometry["geometry"].to_list():
geom = geometry["geometry"].to_list()[0]
Please register or sign in to reply
geom_qk = self.latlon_to_quadkey(geom.centroid.y, geom.centroid.x, zoom=zoom)
if geom_qk == quadkey:
self.log.debug(
f"<[{pid}]> Found `{quadkey}` in {name}-geometries and classifying to {name}."
)
# If there is a pure land or water tile, but the land or water geometry
# is split, all geometry parts would resolve to the same tile quadkey and
# the function would end up adding that same quadkey again for each
# additional geometry part.
# We want to add `quadkey` only on the first encounter.
if quadkey in quadkeys:
raise ValueError(
f"<[{pid}]> Duplicate quadkey `{quadkey}`. Cannot have the same quadkey more than once."
self.log.warning(
f"<[{pid}]> Duplicate quadkey `{quadkey}`. Cannot have the same quadkey more than once. Ignnoring."
)
quadkeys += [quadkey]
classifications += [classification]
else:
quadkeys.append(quadkey)
classifications.append(classification)
def classification_from_features(
self, quadkeys, land=None, seawater=None, inlandwater=None, **kwargs
Loading