1

We know that fields related to "Geotransformation" and "projection" are empty when one tries to access these information using gdal on Sentinel-1 (at least the GRD products).

I normaly use:

gdal.Info('file_name',option='-mm -stats -nogcp')

to have some useful information about the tile that I am working on. Among other things the information of the "pixel size" is being returned.

Is there any way to access this "pixel size" information (not simply printing by gdal.Info()) somehow with gdal and not needing to directly open the respective .xml file and read it from the corresponding tree?

1 Answer 1

1

You can actually use gdal.Info() on the manifest.safe file or the SAFE folder containing the data. The resolution of the data is stored under PIXEL_SPACING. Unfortunately gdal.Info() returns a string so you will have to use a a regular expression to search for the value.

Alternatively you can open the manifest.safe file (or the SAFE folder itself) in gdal and retrieve the pixel size from the metadata stored with the product e.g.

from osgeo import gdal

sentinel_manifest = "C:\Documents\S1A_IW_GRDH_1SDV_20180406T180648_20180406T180713_021350_024BEA_1641.SAFE\manifest.safe"

dataset = gdal.Open(sentinel_manifest)
metadata = dataset.GetMetadata()
pixel_size = metadata['PIXEL_SPACING']

#to see what else is in the dictionary
for k,v in metadata.items():
    print (k,v)

del dataset

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.