无法打开 EPSG 支持文件 gcs.csv.\ 设置 GDAL_DATA 环境变量
Unable to open EPSG support file gcs.csv.\ setting the GDAL_DATA environment variable
我尝试使用 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')
我正在使用 pycharm 3.6,conda 版本 4.7.10,python 3.7 on win 8.1
由于您使用的是PyCharm,您可以在运行配置中设置环境变量
转到 Run -> Edit Configurations
并在此处设置您的 GDAL_DATA 变量
这仍然需要您为每个项目设置配置,但是它会将系统特定配置排除在您的代码之外。
我尝试使用 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')
我正在使用 pycharm 3.6,conda 版本 4.7.10,python 3.7 on win 8.1
由于您使用的是PyCharm,您可以在运行配置中设置环境变量
转到 Run -> Edit Configurations
并在此处设置您的 GDAL_DATA 变量
这仍然需要您为每个项目设置配置,但是它会将系统特定配置排除在您的代码之外。