Closed samlama111 closed 1 year ago
The assumption of Z = Zc is where it goes wrong. You actually want the Z coordinate for the corresponding pixel on the ground. There are various ways to find this, but a quick way to see that the other calculations you made are correct, is to assign Z a value closer to the ground, could be between 10-30.
For the real value of Z you need a terrain model. See https://datafordeler.dk/dataoversigt/danmarks-hoejdemodel-dhm/dhm-wms/
I am able to search for an image of a polygon, but I would like to specifically locate it. Is there a way of achieving this, based on its coordinates?
I have tried the georeferencing mentioned in the documentation, but without success. I try calculate the (xa, ya) position, but as a result I get a ya position of
27998.858461163214
, well outside of the bounds of the image (its height is 8578 pixels). Only difference to documenation is our assumption that Z=Zc. We expect ~(5750, 3350), but receive (5147, 27998).Following is the geojson and georeferencing calculation. Any help is greatly appreciated!
I query data using the
/search/
endpoint, with the following example response:Pixel calculation:
Calculated values. In pixels. Origo in image lower left.
f = f_mm / pixel_size x0 = sensor_cols 0.5 + ppo_x / pixel_size y0 = sensor_rows 0.5 + ppo_y / pixel_size
X = (item['bbox'][0] + item['bbox'][2]) / 2 Y = (item['bbox'][1] + item['bbox'][3]) / 2 Z = Zc # We assume the Z coordinate of the polygon is the same
dX = (X-Xc) dY = (Y-Yc) dZ = (Z-Zc)
n = (m31 dX + m32 dY + m33 * dZ)
xa = x0 - f (m11 dX + m12 dY + m13 dZ) / n ya = y0 - f (m21 dX + m22 dY + m23 dZ) / n