有关如何将此 shapefile剪辑到适当的边界框的任何建议?特别是,我只想查看这些界限:[(-105.53 , 39.9) (-104.93,40.27)]。ogr2ogr的站点有一个使用-clipdst
看起来很有希望的选项的示例。我使用Anaconda来管理我的 python 安装。我安装了GDAL,这样conda update gdal
会产生:
Fetching package metadata: ..
# All requested packages already installed.
# packages in environment at /Users/<me>/anaconda:
#
gdal 1.10.1 np18py27_2
跑步which ogr2ogr
ogr2ogr is /Users/<me>/anaconda/bin/ogr2ogr
下载并解压缩 Natural Earth 子单元文件后,我运行以下命令:
ogr2ogr -f GeoJSON -clipdst -105.53 39.9 -104.93 40.27 places.json ne_10m_admin_0_map_subunits.shp
不幸的是,我收到此错误:
ERROR 6: GEOS support not enabled.
我查看了这个错误,这里的建议是启用geos
(我使用安装的一个包conda install geos
)。所以我有geos
版本 3.3.3。但是,我不知道如何启用ogr2ogr
访问geos
库。
任何帮助是极大的赞赏。我不打算使用ogr2ogr
,但我没有看到很多替代品。
更新:2015-02-26
重新安装 anaconda 后,我安装了 gdal 和 geos。这是目前的情况:
$ ogr2ogr -f GeoJSON -clipdst -105.53 39.9 -104.93 40.27 places.json ne_10m_admin_0_map_subunits.shp
FAILURE:
Unable to open datasource `ne_10m_admin_0_map_subunits.shp' with the following drivers.
-> ESRI Shapefile
-> MapInfo File
-> UK .NTF
-> SDTS
-> TIGER
-> S57
-> DGN
-> VRT
-> REC
-> Memory
-> BNA
-> CSV
-> GML
-> GPX
-> KML
-> GeoJSON
-> GMT
-> GPKG
-> SQLite
-> WAsP
-> PostgreSQL
-> PCIDSK
-> OpenFileGDB
-> XPlane
-> AVCBin
-> AVCE00
-> DXF
-> Geoconcept
-> GeoRSS
-> GPSTrackMaker
-> VFK
-> PGDump
-> OSM
-> GPSBabel
-> SUA
-> OpenAir
-> PDS
-> WFS
-> HTF
-> AeronavFAA
-> EDIGEO
-> GFT
-> GME
-> SVG
-> CouchDB
-> Idrisi
-> ARCGEN
-> SEGUKOOA
-> SEGY
-> ODS
-> XLSX
-> ElasticSearch
-> PDF
-> CartoDB
-> SXF