1

This is more of a question about how GDAL 3.x and PROJ 7.x work more than a question about how to do something. I have been experimenting with GDAL 3.4.2 and have noticed some things that are different about how gdalwarp is working. I was previously using GDAL 2.3.1.

The issue I am having is that when I try to do a gdalwarp operation on an image that is out of the applicable area of a projection, I get an error that says something like "ERROR 6: Cannot find coordinate operations from EPSG:4326 to EPSG:4326" or something along those lines (EPSG:4326 is NAD83). If I change the georeferencing on the image to a part of the world where the projection is applicable (North America), the gdalwarp operation works without any errors. In GDAL 2.3.1, there were no errors in either case.

As an example, if I run the following gdalwarp command on this image located somewhere in Spain but assigned a NAD83 projection, I get an error message:

gdalwarp.exe -ts 550 534 -te -1.9269800000000 43.3142800000000 -1.9055500000000 43.3350900000000 -r cubic -dstalpha spain.tif -overwrite testSP.tif

However, if I run a similar gdalwarp command on the same image georeferenced somewhere in North America and assigned a NAD83 projection located here (I just translated the longitude coordinates 112 degrees west), I do not get an error message and the output is created correctly:

gdalwarp.exe -ts 550 534 -te -113.9269800000000 43.3142800000000 -113.9055500000000 43.3350900000000 -r cubic -dstalpha us.tif -overwrite testUS.tif

Any ideas about this? Does the newer verison of GDAL/PROJ do some kind of bounds checking to see if the image being warped is within the valid bounds of the projection area?

1
  • 1
    Maybe a spatial test like here proj.org/apps/projinfo.html is performed. With NAD83 in Spain I fear that not even the "intersects" strategy would help. But if this is the case I do not still know how to tell gdalwarp just try the conversion and see what happens. The area of use comes from the EPSG database, for example epsg.org/crs_4269/NAD83.html. See the link in EXTENT. Proj has a local SQLite database "proj.db" that contains also the polygons for area of use.
    – user30184
    Jun 7, 2022 at 17:25

1 Answer 1

1

Yes, indeed since GDAL 3.0 the way of selecting the transformation to perform between the origin and destination spatial reference systems has changed.

These changes include searching for available transformations in the area of interest.

The main reference document about these changes, and especially the section on coordinate transformations, can be read at the following link: https://gdal.org/development/rfc/rfc73_proj6_wkt2_srsbarn.html?#ogrcoordinatetransformation-changes

The error you have reached is that for the area of interest (the bounding box of the source dataset since no other was specified) there is no transformation available to EPSG:4269 (NAD83 Geographic 2D), because that area is found outside the extent defined for that SRS.


I understand that the question is not about how to solve it, so you can consider it answered. But for future reference: we could define, in a transformation option, an area of interest that is within the extents of the destination SRS, and the transformation would be carried out with the best possible transformation for that area. For instance:

gdalwarp -ts 550 534 -te -1.92698 43.31428 -1.90555 43.33509 -to AREA_OF_INTEREST=-113.92698,43.31428,-113.90555,43.33509 -r cubic -dstalpha spain.tif -overwrite testSP.tif

Another solution would be to define a transformation explicitly with the -ct parameter, so that no search for possible transformations is performed. In the trivial case of reprojecting to the same reference system, the transformation that is performed is +proj=noop, so the following command would also work:

gdalwarp -ts 550 534 -te -1.92698 43.31428 -1.90555 43.33509 -ct +proj=noop -r cubic -dstalpha spain.tif -overwrite testSP.tif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.