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 ?

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. – user2856 Aug 16 '20 at 1:53
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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