1

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 ?

asked Aug 14, 2020 at 18:13
1
  • 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. Commented Aug 16, 2020 at 1:53

1 Answer 1

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

answered Mar 27, 2021 at 18:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.