I have an image in UTM projection, given a pixel value (px, py) I'd need to get its corresponding utm coordinates (utx, utmy). Is it possible? I tried

gdallocationinfo  input.tif 256 256

but I did not get the expected result.

Thank you

M.

有帮助吗?

解决方案

gdallocationinfo is for getting pixel values out of a raster. For conversion you should use gdaltransform. If you provide the target image as an argument you can enter pixel coordinates and get projected coordinates in return.

So:

gdaltransform input.tif
256 256

其他提示

It's a math problem, you just need to fetch the affine transformation coefficients, which you can easily do with the Python bindings. Also, it depends on your pixel coordinate system (e.g., does it start with [1,1] or [0,0]? And, which corner is the origin?)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top