AnswerBun.com

What is the unit used by Gdal.GetGeoTransform?

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 ?

EDIT
the proj value is :

GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AXIS["Latitude",NORTH],
    AXIS["Longitude",EAST],
    AUTHORITY["EPSG","4326"]]

Geographic Information Systems Asked on December 8, 2021

1 Answers

One Answer

"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.

Answered by Jascha Muller on December 8, 2021

Add your own answers!

Related Questions

GeoTIFF to ENVI GDAL translation causes rotation

1  Asked on September 23, 2020 by maaattes

     

Has anybody else experienced having issues opening QGIS or .gqz project files on macs?

1  Asked on September 23, 2020 by open-source-user-123

       

What bin value does QGIS Histogram uses?

1  Asked on September 22, 2020 by darkcygnus

       

Mosaicing of multitemporal Sentinel-2 images

1  Asked on September 21, 2020 by xmisx

       

Portion of PDF missing in QGIS Export to PDF

1  Asked on September 21, 2020 by grahamdee63

   

Calculating distance between pixel values on raster layers using QGIS

1  Asked on September 19, 2020 by katie_northcoast

       

How can I integrate railway embankments to a heightmap?

0  Asked on September 18, 2020 by rangertwo

   

Retrieve projection inside .map() GEE

1  Asked on September 18, 2020 by alexander-vocaet

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.