I tried to retrieve the resolution of a raster image with Gdal in a python notebook to convert surfaces from pixels to hectares.

import gdal
from osgeo import osr

src = gdal.Open(map_raster)
proj = osr.SpatialReference(wkt=src.GetProjection())
_, resx, _, _, _, resy  = src.GetGeoTransform()
src = None

I expected resx to be in meter but a print(resx) gave me 0.00025000000000000017 which would be very small if expressed in meters.

So my question is how can I know the unit system used by the GetGeoTransform function ?

the proj value is :

        SPHEROID["WGS 84",6378137,298.257223563,

1 Answer 1


"So my question is how can I know the unit system used by the GetGeoTransform function ?"

The units used in GetGeoTransform are 100% related to your coordinate system. Perhaps you can read-up about coordinate systems (there are various coordinate systems for various applications).

The two main types of coordinate systems is either a "Geographic" or a "Projected" coordinate system. Your current file is in WGS 84 (epsg 4326) and is a geographic coordinate system and uses degrees as a unit. This coordinate system is widely used for display purposes (and navigation perhaps), but it is not accurate for area measurements (e.g. your true pixel size).

What you want to do is re-project your raster image to a projected coordinate system (one that is specific to the area of you image, most commonly used is the universal transverse mercator (utm), you just need to know your zone). Once the image is re-projected into a projected coordinate system your pixel size from GetGeoTransform will be in meters.

I hope that helps.

  • to have a value in meters, an approximate value of pixelsize in the area be obtained... starting from the bounding box of the data considered?
    – stefcud
    Commented Sep 8, 2023 at 9:27

Your Answer

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

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