Closed shepik closed 3 years ago
@shepik Thanks, Will you please write a test for this and fix the linting errors.
@shepik Thanks, Will you please write a test for this and fix the linting errors.
Sure, i'll do it in a couple of days.
Please update your PR with latest changes
Last week I run into strange error (same code, same input, same libs but different results) and today I found that it was caused by this bug. I'm using last v0.0.5 release.
I suggest to fix this in more general way by using is_empty:
--- transformation.py
+++ transformation.py
@@ -155,11 +155,11 @@
for shape_value in shapes:
intersection = shape_value.intersection(intersection)
- intersection = mapping(intersection)
-
- if (
- len(intersection.get("coordinates", [])) == 0
- and len(intersection.get('geometries', [])) == 0
- ):
+ if intersection.is_empty:
return None
+ intersection = mapping(intersection)
+
properties = merge_dict(properties_list)
intersection_feature = Feature(geometry=intersection, properties=properties)
@omanges what do you think?
Thanks, @kapitan-iglu, will you please share the test example. yes is_empty
seems to be good option.
When intersection has type=GeometryCollection, coordinates is undefined.