我尝试使用GDAL库并收到此错误:
ERROR 4: Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.
我创建了这些解决方案 How to set the GDAL_DATA environment variable to point to the directory containing EPSG csv files?
所以我更改了工作环境,GDAL-DATA文件夹的路径,没有任何帮助。
然后,我看到了这个:How to fix the enviroment variable GDAL_DATA path set?
现在就可以了,但是现在我必须每次都定义GDAL_DATA文件夹的路径。
import os
import ospybook as pb
from ospybook.vectorplotter import VectorPlotter
#Theese two lines are the new solution from the 2nd link that I want to stop adding at the begining of each code
# os.environ['GDAL_DATA'] = r'C:\Users\royanc\Anaconda3\Library\share\gdal'
# os.environ['proj'] = r'C:\Users\royanc\Anaconda3\Library\share'
os.chdir(r'C:\Users\royanc\Desktop\ospybook\osgeopy-data\global')
# Plot populated places on top of countries from an interactive session.
vp = VectorPlotter(True)
vp.plot('ne_50m_admin_0_countries.shp', fill=False)
vp.plot('ne_50m_populated_places.shp', 'bo')
我在Win 8.1上使用pycharm 3.6,conda版本4.7.10,python 3.7