Re: Use of GCPS in Rasterio

Sean Gillies
 

Vincent.

After a little more thought, I'm thinking that working around GDAL with respect to geotransform and GCPs is not a good idea. GDALGetGeoTransform() does not use GCPs if they exist and the second to last paragraph in https://gdal.org/user/raster_data_model.html#gcps cautions that the meaning of the GCPs is up to the application. And by application, it means the application of the data defined by the provider, not our software project as an application. It could be the case that GCPs in one file are meant to be used differently than GCPs in another file, and if we made Rasterio overly clever we might get in the way of programmers or cause problems with the wrong default behavior.

On Tue, Sep 10, 2019 at 10:52 AM <vincent.sarago@...> wrote:
Sean, my main worry is that we need to use `WarpedVRT` so it adds one more layer, and thus not optimal. But it will be better than nothing :-) 

For files with gcps, not only the transform but also the CRS won't be set by default so basically, the WarpedVRT reader it should do something like: 

```
gcps, gcps_crs = src.gcps
in_transform = from_gcps(gcps) if gcps else src.transform
in_crs = gcps_crs if gcps else src.crs

# in https://github.com/mapbox/rasterio/blob/master/rasterio/_warp.pyx#L738
self.src_transform = src_transform if src_transform else in_transform

# in https://github.com/mapbox/rasterio/blob/master/rasterio/_warp.pyx#L736
self.src_crs = src_crs if src_crs else in_crs

--
Sean Gillies

Join dev@rasterio.groups.io to automatically receive all group messages.