Topics

GDAL doesn't include file gcs.csv anymore


pierrick.rambaud49@...
 

description 

 
I'm using [geemap](https://github.com/giswqs/geemap) to display a raster on a created map. 
This lib use `xarray_leaflet` to display the raster and this lib will end up using `rasterio` to manipulate the .tif file. 
 
When I launch my display :

m = geemap.Map()
m.add_raster(clip_map, colormap='terrain', layer_name='gfc')
 
I get the following error :
> CRSError: Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.
 
This error is everywhere on SO so I tried to verify if my GDAL_DATA env variable was coorectly set : 
 
import os
import stat
gdal_data = os.environ['GDAL_DATA']
print('is dir: ' + str(os.path.isdir(gdal_data)))
gcs_csv = os.path.join(gdal_data, 'gcs.csv')
print('is file: ' + str(os.path.isfile(gcs_csv)))
st = os.stat(gcs_csv)
print('is readable: ' + str(bool(st.st_mode & stat.S_IRGRP)))
 
# out 
# is dir: True
#is file: False
#FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/gdal/gcs.csv'
 
going to the glad distrib inb the `NEWS` file, I read that they removed lots of file in 3.0 including `gcs.csv`. So it's no longer included in my folder. 
 
Is there a workaround ? 


setup 

rasterio==1.1.5
python==3.6
geemap==0.7.9
gdal==3.0.4
 


Sean Gillies
 

Hi,

On Mon, Sep 7, 2020 at 8:18 AM <pierrick.rambaud49@...> wrote:

description 

 
I'm using [geemap](https://github.com/giswqs/geemap) to display a raster on a created map. 
This lib use `xarray_leaflet` to display the raster and this lib will end up using `rasterio` to manipulate the .tif file. 
 
When I launch my display :

m = geemap.Map()
m.add_raster(clip_map, colormap='terrain', layer_name='gfc')
 
I get the following error :
> CRSError: Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.
 
This error is everywhere on SO so I tried to verify if my GDAL_DATA env variable was coorectly set : 
 
import os
import stat
gdal_data = os.environ['GDAL_DATA']
print('is dir: ' + str(os.path.isdir(gdal_data)))
gcs_csv = os.path.join(gdal_data, 'gcs.csv')
print('is file: ' + str(os.path.isfile(gcs_csv)))
st = os.stat(gcs_csv)
print('is readable: ' + str(bool(st.st_mode & stat.S_IRGRP)))
 
# out 
# is dir: True
#is file: False
#FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/gdal/gcs.csv'
 
going to the glad distrib inb the `NEWS` file, I read that they removed lots of file in 3.0 including `gcs.csv`. So it's no longer included in my folder. 
 
Is there a workaround ? 


setup 

rasterio==1.1.5
python==3.6
geemap==0.7.9
gdal==3.0.4

How did you install rasterio? If you got it with `pip install rasterio` you will have installed a wheel file that includes GDAL 2.4.4 and data files and which will be incompatible with the GDAL 3.0.4 installed on your system. If that is the case, you should unset GDAL_DATA. Rasterio in the wheel will detect its own data files and does not need GDAL_DATA to be set.

--
Sean Gillies


pierrick.rambaud49@...
 

Thank you for your quick answer,

I'm working on a production cloud company service so I don't have control on the way libs are installed. I can just ask the people in charge and they reply that they installed it with apt. 


in some notebook if I del the os.environ['GDAL_DATA'] at the start it mange to find back the gcs.csv file. Problem is: if I then use a gdal function it's the other way around. 
Is there a way to make them both compatible with gdal 3.0.4 as suggested in the README ?