Skip to content

Commit e70f9bb

Browse files
committed
Coerce feature stream to a list so estimate-area works with ldgeojson
1 parent 95af8c4 commit e70f9bb

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

mapbox_tilesets/scripts/cli.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -746,20 +746,15 @@ def estimate_area(features, precision, no_validation=False, force_1cm=False):
746746
)
747747

748748
# builtins.list because there is a list command in the cli & will thrown an error
749-
try:
750-
features = builtins.list(filter_features(features))
751-
except (ValueError, json.decoder.JSONDecodeError):
752-
raise errors.TilesetsError(
753-
"Error with feature parsing. Ensure that feature inputs are valid and formatted correctly. Try 'tilesets estimate-area --help' for help."
754-
)
755-
except Exception:
756-
raise errors.TilesetsError("Error with feature filtering.")
749+
features = builtins.list(features)
757750

758751
# expect users to bypass source validation when users rerun command and their features passed validation previously
759752
if not no_validation:
760753
for feature in features:
761754
utils.validate_geojson(feature)
762755

756+
features = builtins.list(filter_features(features))
757+
763758
area = utils.calculate_tiles_area(features, precision)
764759
area = str(round(area))
765760

0 commit comments

Comments
 (0)