@@ -707,6 +707,12 @@ def list_sources(username, token=None):
707707 raise errors .TilesetsError (r .text )
708708
709709
710+ def validate_stream (features ):
711+ for feature in features :
712+ utils .validate_geojson (feature )
713+ yield feature
714+
715+
710716@cli .command ("estimate-area" )
711717@cligj .features_in_arg
712718@click .option (
@@ -745,21 +751,18 @@ def estimate_area(features, precision, no_validation=False, force_1cm=False):
745751 "The --force-1cm flag is enabled but the precision is not 1cm."
746752 )
747753
748- # builtins.list because there is a list command in the cli & will thrown an error
749754 try :
750- features = builtins .list (features )
755+ # expect users to bypass source validation when users rerun command and their features passed validation previously
756+ if not no_validation :
757+ features = validate_stream (features )
758+ # builtins.list because there is a list command in the cli & will thrown an error
759+ # It is a list at all because calculate_tiles_area does not work with a stream
760+ features = builtins .list (filter_features (features ))
751761 except (ValueError , json .decoder .JSONDecodeError ):
752762 raise errors .TilesetsError (
753763 "Error with feature parsing. Ensure that feature inputs are valid and formatted correctly. Try 'tilesets estimate-area --help' for help."
754764 )
755765
756- # expect users to bypass source validation when users rerun command and their features passed validation previously
757- if not no_validation :
758- for feature in features :
759- utils .validate_geojson (feature )
760-
761- features = builtins .list (filter_features (features ))
762-
763766 area = utils .calculate_tiles_area (features , precision )
764767 area = str (int (round (area )))
765768
0 commit comments