Skip to content

Commit 2666a32

Browse files
committed
Convert geometry to WKT text using ST_AsText for gdal.Warp cutline
1 parent e6fc22d commit 2666a32

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cng_datasets/raster/cog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ def process_h0_region(self, h0_index: Optional[int] = None) -> Optional[str]:
371371

372372
print(f"\nProcessing h0 region {h0_index}...")
373373

374-
# Load h0 polygons to get the geometry using SQL
374+
# Load h0 polygons to get the geometry using SQL with ST_AsText for WKT
375375
h0_result = self.con.execute(f"""
376-
SELECT h0, geom
376+
SELECT h0, ST_AsText(geom) as geom_wkt
377377
FROM read_parquet('s3://public-grids/hex/h0-valid.parquet')
378378
WHERE i = {h0_index}
379379
""").fetchdf()
@@ -382,7 +382,7 @@ def process_h0_region(self, h0_index: Optional[int] = None) -> Optional[str]:
382382
print(f" ⚠ No h0 region found for index {h0_index}")
383383
return None
384384

385-
h0_geom_wkt = h0_result['geom'].iloc[0]
385+
h0_geom_wkt = h0_result['geom_wkt'].iloc[0]
386386
h0_cell = h0_result['h0'].iloc[0]
387387

388388
print(f" h0 cell: {h0_cell}")

0 commit comments

Comments
 (0)