When trying to use the wktaoi parameter I get the error:
RuntimeError: org.esa.snap.core.gpf.OperatorException: java.util.NoSuchElementException
As soon as I remove it I loose the error, so I’m not sure if I’m doing something wrong or if it just doesn’t work but I guess I will continue with the “Read the XML, parse the geometry out, find intersects” method
Here’s what I tried to get that error:
def polygon_to_wkt(shp): df = gpd.read_file(shp) if df.crs != "EPSG: 4326": df = df.to_crs(4326) wkt = df.to_wkt() wkt1 = wkt.iloc[0].geometry return wkt1
def topsar_split(raster, aoi_shp): parameters = snappy.HashMap() parameters.put('selectedPolarisations', 'VV,VH') aoi_wkt = polygon_to_wkt(aoi_shp) parameters.put('wktAoi', aoi_wkt) topssplit = snappy.GPF.createProduct('TOPSAR-Split', parameters, raster)