Nicolas,

> It's easy to go from coordinate space to pixel space in python using
> something like.
> 
> pixel_x  =  int(-124114.3  -  geo_transform[0])/geo_transform[1])
> 
> What is the trick when there is an image rotation? 

Compute the inverse geotransform with
https://gdal.org/api/raster_c_api.html?highlight=invgeotransform#_CPPv419GDALInvGeoTransformPdPd

(gdal.InvGeoTransform(gt) in Python )

And then use the coordinates in coordinate space as the input for this inverse 
geotransform

column = inv_gt[0] + X * inv_gt[1] + Y * inv_gt[2]
row    = inv_gt[3] + X * inv_gt[4] + Y * inv_gt[5]


> Also, as a second
> very beginner question, what is the difference between geo_transform[2]
> and geo_transform[4]?

There are defined by the relationships at
https://gdal.org/user/raster_data_model.html#affine-geotransform

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to