corteva / rioxarray

geospatial xarray extension powered by rasterio
https://corteva.github.io/rioxarray
Other
504 stars 80 forks source link

Support GCPs without known z coordinate #731

Closed Kirill888 closed 5 months ago

Kirill888 commented 5 months ago

Ground Control Points are allowed to omit elevation component, however logic in here assumes GCPs are always in x,y,z form:

https://github.com/corteva/rioxarray/blob/166c0c76d9e174387ca6b2368f7eb6a3d07ec13a/rioxarray/rioxarray.py#L1255

When geometry is specified with only x,y coordinates IndexError is raised when calling .rio.get_gcps().

Code here

https://github.com/corteva/rioxarray/blob/166c0c76d9e174387ca6b2368f7eb6a3d07ec13a/rioxarray/rioxarray.py#L1289

should probably generate [float, float] instead of [float, float, None] when GCP is missing height information.

snowman2 commented 5 months ago

Thoughts @mraspaud ?

snowman2 commented 5 months ago

Related #460

mraspaud commented 5 months ago

I wasn't aware of the gcps allowing a missing z coordinate. So indeed, the code isn't made for that, but definitely should make z optional, both in reading and in generating the geojson.