Hello everyone and thanks for all the insights I found in the forum so far.
I’m writing a python script that should extract the overlapping area of 2 (or more) Sentinel-1 GRD images and save each cropped image as a GeoTIFF.
I was able to calibrate the products and apply terrain correction. I can also save products in the .tif format (despite the lack of official documentation, snappy is quite easy and fun to work with, once you get the basics down).
The only thing I’m missing at this point is subsetting each image of the common area, which I would ideally perform before saving my images, in order to make things faster.
I’m pretty new to SAR processing, so every tip will be helpful!
So, you don’t have a predefined area which you want to use for subset but you want to find the overlapping area and then subset to this area?
If so, you need to get the boundary first of all products and then create the intersection to find the common overlapping area.The area can be converted to a WKT string and used with the Subset operator with each product.
You can use this method to get the boundary: org.esa.snap.core.util.ProductUtils#createGeoBoundaryPaths(org.esa.snap.core.datamodel.Product)
The resulting path (you probably only need the first path in the array) needs to be converted into a geometry
The following is a Java snippet which can be converted into python
GeometryFactory factory = new GeometryFactory()
Geometry boundary = JTS.shapeToGeometry(geoBoundaryPath, factory);
if (boundary instanceof LinearRing) {
boundary = factory.createPolygon((LinearRing) boundary, null);
}
return boundary;
If you have two or more geometries you can create the intersection:
intersection = geometry1.intersection(geometry2)
The intersection can be used as parameter “geoRegion” with the Subset operator.
No problem, I managed to do it by looking at similiar imports like the one for HashMap. By the way, I just noticed I copied the wrong line in the quote in my previous reply, but again, it works fine.
Thank you