質問

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