2

I have some raster images, and I would like to determine the GSD using Python.

I know that I can use rasterio.transform() or gdal.GetGeoTransform() to extract the spatial resolution of the image.

How do I determine the units of the spatial resolution.

  • 1
    I don't think I've seen this called GSD before, and for anyone else it stands for "Ground Sampling Distance". (My default for GSD is German Shepherd Dog) – Spacedman Nov 8 '20 at 11:32
  • Sorry if it wasn't clear enough I updated the question. I was hoping there would be a way to use the spatial resolution to determine the GSD. – A Merii Nov 8 '20 at 14:15
  • Is the spatial resolution not equivalent to the GSD? – A Merii Nov 8 '20 at 14:16
  • Related: gis.stackexchange.com/a/115035/8104 – Aaron Nov 8 '20 at 15:25
  • Thanks a lot, in this case I will rephrase the question so that others can benefit. – A Merii Nov 8 '20 at 15:45
2

You can use the linear_units property in the crs class. For example:

import rasterio

raster = rasterio.open('/path/to/your/raster.tif' )

print(raster.crs.linear_units)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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