PROJ icon indicating copy to clipboard operation
PROJ copied to clipboard

[test] Transformation grids unavailable via network should fall back on local files

Open dmahr1 opened this issue 3 years ago • 0 comments

Hello. I am setting up a transformation from EPSG 9306 to EPSG 4326. The best transformation uses a grid HS2TN15_NTv2.gsb. Since this grid is proprietary, it's not available via the network. Fortunately, my client has provided this grid file to me. I've put it in the data directory as specified in the docs.

In PROJ 9.0.1, the transformation grid is used if and only if PROJ_NETWORK=OFF:

docker run --rm -it -v /Users/dmahr/grids/:/grids osgeo/proj:9.0.1 bash
root@5bbacfd7bf92:/# mkdir -p ~/.local/share/proj
root@5bbacfd7bf92:/# cp /grids/HS2TN15_NTv2.gsb ~/.local/share/proj
root@5bbacfd7bf92:/# echo 282000 287000 | PROJ_NETWORK=OFF cs2cs -d 8 'epsg:9306' 'epsg:4326'
51.51765001     -0.27660073 0.00000000
root@5bbacfd7bf92:/# echo 282000 287000 | PROJ_NETWORK=ON cs2cs -d 8 'epsg:9306' 'epsg:4326'
51.50241100     -0.30282087 0.00000000

But somehow it's fixed in the latest Docker image:

docker run --rm -it -v /Users/dmahr/grids/:/grids osgeo/proj:latest bash 
root@e4503a823dc3:/# mkdir -p ~/.local/share/proj
root@e4503a823dc3:/# cp /grids/HS2TN15_NTv2.gsb ~/.local/share/proj
root@e4503a823dc3:/# echo 282000 287000 | PROJ_NETWORK=OFF cs2cs -d 8 'epsg:9306' 'epsg:4326'
51.51765001     -0.27660073 0.00000000
root@e4503a823dc3:/# echo 282000 287000 | PROJ_NETWORK=ON cs2cs -d 8 'epsg:9306' 'epsg:4326'
51.51765001     -0.27660073 0.00000000
root@e4503a823dc3:/# proj   
Rel. 9.1.0, September 1st, 2022
usage: proj [-bdeEfiIlmorsStTvVwW [args]] [+opt[=arg] ...] [file ...]

I suspect this bug might have inadvertently been fixed by this change.

Either way, could a test be added to ensure that this fix remains in PROJ? Perhaps mock out the network request and ensure that it gracefully falls back on local files?

dmahr1 avatar Aug 11 '22 14:08 dmahr1