Obtaining Corner Coordinates (get extent) of the product in snappy?

Is it possible to get information about area covered by the product (corner coordinates) using SNAP API in Python?

I know that I can call other tools such as gdalinfo or GetExtent function described in this thread: http://gis.stackexchange.com/questions/57834/how-to-get-raster-corner-coordinates-using-python-gdal-bindings
However, GDAL do not allow me to easily read all products that are supported by SNAP / snappy.

You could use for example ProductUtils#createGeoBoundary(Product, int)
This will return an array of GeoPos objects.

1 Like


I am refreshing this topic because I would like to generate the outline of the products I have processed in order to have an overview.

I have used the method createGeoBoundaryPaths.

File = snappy.ProductIO.readProduct('mosaic.dim')
Path =snappy.ProductUtils.createGeoBoundaryPaths(File)

I would assume that I would obtain the 4 corner coordinates of the mosaic. The script proposed by @kedziorm assumes a square scene using min and max of the lat-long which is not valid when your data have been reprojected.

 for point in Path:
    print point.getCurrentPoint().toString()

Returns a single set of coordinates, what am I doing wrong?


The method is named createGeoBoundaryPaths, so you get an array of path. In most cases there will only one but there can be two or three if the product crosses the anti-meridian. Also, this method creates for every ~8th border pixel one location.

Maybe the method GeoPos[] ProductUtils.createGeoBoundary(Product product, int step) is more appropriate for you. It return an GeoPos-array which you can iterate.

If you are only interested in the corner coordinates. You could only ask for them:

ul_Pos = product.getSceneGeoCoding().getGeoPos(PixelPos(0,0), None)
ur_Pos = product.getSceneGeoCoding().getGeoPos(PixelPos(0, product.getgetSceneRasterWidth()-1), None)

Hello, sorry for refreshing this topic

I’m trying to obtain corner value of sentinel data and i use marco solution,
the first line is fine but i got NaN value for the second line

here is my line:

sentinel_1 = ProductIO.readProduct(“manifest.safe”)
ul_Pos = sentinel_1.getSceneGeoCoding().getGeoPos(PixelPos(0,0), None)
ur_Pos = sentinel_1.getSceneGeoCoding().getGeoPos(PixelPos(0, sentinel_1.getSceneRasterWidth()-1), None)

please help how to fix this
thank You

Strange. Can you retrieve the geo-positon for other pixels?
Is there something special with the sentinel-1 product?

I think not,
I mean when i set value other than (0,0) i got nothing,

but i resolve this by just reading the metadata (manifest.safe)

@lveci Do you have an explanation for this?