GDAL Coordinate System – How to Convert Affine Coordinates to Lat/Lng?

coordinate systemgdal

I am extremely new to GIS.

I'm using gdal to read in a landuse/landcover map and I need to pick out the lat/lng of certain land cover types to index into a different dataset which is expressed only in lat/lng. Unfortuantely, I don't understand the form of the x and y coordinates given to me from the geotransform, specifically the originX and originY below:

geotransform = dataset.GetGeoTransform()
originX = geotransform[0]
originY = geotransform[3]

Printing these values gives me coordinates like (447466.693808, 4952570.40529). How do these relate to the original latitude and longitude?

Edit:

Here's a simple python example that got me what I was looking for:

srs = osr.SpatialReference()
srs.ImportFromWkt(dataset.GetProjection())

srsLatLong = srs.CloneGeogCS()
ct = osr.CoordinateTransformation(srs,srsLatLong)
print ct.TransformPoint(originX,originY)

Stolen from: tolatlong.py

Best Answer

gdal_translate will reproject your data from whatever projection it is in to any other (in this case you want EPSG:4326) using:

gdal_translate -a_srs epsg:4326 srcfile new_file 

or you could use gdaltrasform to convert the points (and I'm sure you can access that from Python(?) too)