If you enter the metadata proj string in Google search, you end up at http://spatialreference.org/ref/epsg/3477/proj4/ or NAD83(NSRS2007) / Alaska zone 10
. EPSG:26940 is basically the same.
So it has nothing to do with UTM, rather state plane coordinate systems
Turns out that gdal provides everything needed (which should be no big surprise as gdal can do almost EVERYTHING :) )
So I just need to use the SpatialReference
class to create my source projection which is WGS84:
SpatialReference src = new SpatialReference();
src.SetWellKnownGeogCS("WGS84");
and then my target projection:
dataset = gdal.Open("path/to/my/file", gdalconstConstants.GA_ReadOnly);
projection = dataset.GetProjection();
SpatialReference dst = new SpatialReference(projection);
Now I create a Transformation object like so:
CoordinateTransformation ct = new CoordinateTransformation(src, dst);
And then I transform a given pair of lat/lon to a pixel in my geotiff like so:
double[] xy = ct.TransformPoint(lon, lat);
int x = (int)(((xy[0] - transform[0]) / transform[1]));
int y = (int)(((xy[1] - transform[3]) / transform[5]));
You could further improve my taking a mean value of surrounding pixels as well, but for me that's enough.
Best Answer
Will display a bunch of information about your geotiff including the corner coordinates