Skip to content

Commit

Permalink
Print geojsons for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
dmannarino committed Nov 30, 2024
1 parent 821dc28 commit 6ee4704
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions batch/python/tiles_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,21 @@ def generate_geojson_parallel(geo_tiffs: List[str], tiles_output: str, extent_ou

# Write tiles.geojson
tiles_fc = FeatureCollection(features)
tiles_txt = json.dumps(tiles_fc, indent=2)
print(f"tiles.geojson:\n", tiles_txt)

with open(tiles_output, "w") as f:
json.dump(tiles_fc, f, indent=2)
print(tiles_txt, file=f)
print(f"GeoJSON written to {tiles_output}")

# Create and write extent.geojson
union_geometry = unary_union(polygons)
extent_fc = FeatureCollection([
Feature(geometry=union_geometry.__geo_interface__, properties={})
])
extent_txt = json.dumps(extent_fc, indent=2)
print(f"extent.geojson:\n", extent_txt)

with open(extent_output, "w") as f:
json.dump(extent_fc, f, indent=2)
print(extent_txt, file=f)
print(f"GeoJSON written to {extent_output}")

0 comments on commit 6ee4704

Please sign in to comment.