I try to reproject a raster using gdalwarp.
To do so I use the subprocess package of Python3 :
command = [
'gdalwarp',
map_raster,
map_raster_proj,
'-t_srs', 'ESRI:54009'
]
print(' '.join(command))
kwargs = {
'args' : command,
'cwd' : os.path.expanduser('~'),
'stdout' : subprocess.PIPE,
'stderr' : subprocess.PIPE,
'universal_newlines' : True
}
with subprocess.Popen(**kwargs) as p:
for line in p.stdout:
print(line)
unfortunately I get the following error :
ERROR 1: PROJ: proj_get_authorities_from_database: Cannot find proj.db ERROR 1: Translating source or target SRS failed: ESRI:54009
When I run the command directly from my terminal It works flowlessly.
I imagine that I have some environment parameter missing or pointing to the wrong direction but I don't know where to start.
Any idea where I should check differences between the two execution env?
EDIT
I run Jupyter notebook from a company cloud interface, I have 0 idea of the installation, I have 0 right to access it. It's running on linux AWS instances.
several test that I performed :
!gdalwarp --version
give me the same result in the terminal and the jupyter notebook : GDAL 3.0.4, released 2020年01月28日
!printenv | grep PROJ_LIB
I have nothing in the terminal env and PROJ_LIB=/usr/local/lib/python3.6/dist-packages/rasterio/proj_data in the notebook.
If I run this command in another notebook I get 0 errors and the PROJ_LIB
variable is not set. I think my install of rasterio and gdal are coliding is it possible ?
-
You haven't got PROJ_LIB set or it's set incorrectly. Please edit your question and specify what OS you use, how you installed gdal and jupyter (pip, pipenv, conda, virtualenv, something else), how you run jupyter.user2856– user28562020年08月16日 01:53:50 +00:00Commented Aug 16, 2020 at 1:53
1 Answer 1
for those who may fall here, rasterio and gdal python bindiing are not supposed to live in the same notebook ref. So rasterio was changing my PROJ_LIB env variable
Explore related questions
See similar questions with these tags.