From 42ca232c82562565341bc748e96f52d3f4962708 Mon Sep 17 00:00:00 2001 From: Sahib Bhai Date: Sat, 20 Jan 2024 17:51:51 -0800 Subject: [PATCH] Optimize GeoJSON data further by filtering features for Los Angeles County only --- functions/geojson_processing_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/geojson_processing_utils.py b/functions/geojson_processing_utils.py index dee37f93..5fcdef1d 100644 --- a/functions/geojson_processing_utils.py +++ b/functions/geojson_processing_utils.py @@ -11,7 +11,10 @@ def optimize_geojson(data: Dict, fields_to_keep: List[str]) -> Dict: Returns: Dict: The optimized GeoJSON data. """ - # Process each feature in the GeoJSON + # Keep only the features in Los Angeles County + data['features'] = [feature for feature in data['features'] if feature['properties'].get('CountyName') == 'Los Angeles'] + + # Now process each remaining feature in the GeoJSON for feature in data['features']: properties: Dict = feature['properties'] # Keep only the required fields