【发布时间】:2017-05-18 13:52:22
【问题描述】:
我正在尝试将 geojson 文件转换为 shapefile。 我正在尝试这种方式(我对 Python 很陌生,所以可能不正确)。
import urllib, geojson, gdal
url= ' http://ig3is.grid.unep.ch/istsos/wa/istsos/services/ghg/procedures/operations/geojson?epsg=4326'
response = urllib.urlopen(url)
data = geojson.loads(response.read())
file = open ('data.geojson', 'w')
pickle.dump(data,file)
file.close()
ogr2ogr -f "ESRI Shapefile" destination_data.shp "data.geojson"
所以我从 url 获取数据,将其放入文件中,当我尝试将其转换为 shapefile 时出现此错误:
File "<stdin>", line 1
ogr2ogr -f "ESRI Shapefile" destination_data.shp "data.geojson"
^
SyntaxError: invalid syntax
由于我是新手,我尝试了在网上找到的解决方案。有什么办法可以使这项工作?
【问题讨论】: