-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mention importance of PROJ grids and PROJ_NETWORK #2929
Comments
@dugalh can you check the GDAL change log and see if there was a fix after 3.6.4? |
@sgillies I've looked into this some more - it is not a bug but a PROJ behaviour I was unaware of. The transformation grids needed for the vertical shift are not included the wheel, but can be downloaded by hand, or downloaded and cached on demand with the right settings. There are sections in the pyproj and PROJ docs describing this. It does the vertical shift if I set the import os
import numpy as np
import rasterio as rio
from rasterio.warp import reproject
os.environ.update(PROJ_NETWORK='ON') # <--
src_crs = 'EPSG:32634+5773'
dst_crs_list = ['EPSG:32634', 'EPSG:32634+4326', 'EPSG:32634+3855']
src_array = np.ones((1, 1, 1)) * 10
src_transform = rio.transform.from_origin(10, 10, 1, 1)
for dst_crs in dst_crs_list:
dst_array, dst_transform = reproject(
src_array, src_transform=src_transform, src_crs=src_crs, dst_crs=dst_crs,
apply_vertical_shift=True
)
print(f'{src_crs}: {src_array.item(0):.4f}, {dst_crs}: {dst_array.item(0):.4f}') Which outputs:
In the first line it seems the
Replicating with pyproj, I get the first output with pyproj version 3.3.1 (PROJ version 8.2.0), and the second output with pyproj version 3.6.1 (PROJ version 9.3.0). So it seems the anomaly relates to the PROJ version, if that all makes sense... |
Perhaps there could be a note with the |
Expected behavior and actual behavior.
Hello.
rasterio.warp.reproject()
withapply_vertical_shift=True
is not applying vertical shifts. When bothsrc_crs
anddst_crs
have vertical components, I would expect a vertical shift to be applied. I see the same issue withrasterio.warp.transform()
.FYI this behaviour does not seem to be consistent across different
rasterio
packages - theconda-forge
packages work ok.Steps to reproduce the problem.
This gives me::
But I think it should give::
which is what I get with a conda-forge
rasterio
package.Environment Information
Installation Method
rasterio-1.3.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
installed from PyPI with pip 22.0.2,The text was updated successfully, but these errors were encountered: