1

Any suggestions for how to clip this shapefile to the appropriate bounding box? In particular, I'd like to view only these bounds: [(-105.53 , 39.9) (-104.93,40.27)]. The site for ogr2ogr has an example fo using the -clipdst option that looks promising. I use Anaconda to manage my python installs. I have GDAL installed such that conda update gdal produces:

Fetching package metadata: ..
# All requested packages already installed.
# packages in environment at /Users/<me>/anaconda:
#
gdal                      1.10.1               np18py27_2

Running which ogr2ogr

ogr2ogr is /Users/<me>/anaconda/bin/ogr2ogr

With the Natural Earth subunits files downloaded and unzipped, I run the following:

ogr2ogr -f GeoJSON -clipdst -105.53 39.9 -104.93 40.27 places.json ne_10m_admin_0_map_subunits.shp

Unfortunately, I receive this error:

ERROR 6: GEOS support not enabled.

I've looked up this error and the suggestion here is to enable geos (a package that I installed using conda install geos). So I have geos version 3.3.3. However, I am lost as to how to enable ogr2ogr to access the geos library.

Any help is greatly appreciated. I'm not set on using ogr2ogr but I didn't see many alternatives.


UPDATE: 2015-02-26

After reinstalling anaconda, I then installed gdal and geos. This is the current situation:

$ 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
chrki
  • 6,143
  • 6
  • 35
  • 55
blehman
  • 1,870
  • 7
  • 28
  • 39
  • 1
    You need to have GDAL compiled with GEOS. If Anaconda doesn't have this, then ask their user list why this is, look elsewhere for a different precompiled package, or compile your own. – Mike T Sep 09 '14 at 04:16
  • @vitale232 - not yet. See update above. – blehman Feb 25 '15 at 17:48
  • @simplyclimb what OS are you running? I just tried to create a conda package with GEOS support for linux-64. I'm curious if it would resolve the issue for you. – vitale232 Feb 25 '15 at 23:51
  • @vitale232 - OS X 10.9.5 – blehman Mar 10 '15 at 11:22
  • conda ain't easy. i still haven't got my package to install right on two machines. deps galore. I'll let you know if i can get it, and hopefully it'll solve your issues, too – vitale232 Mar 10 '15 at 17:50

1 Answers1

0

I faced the same problem and found the solution. The solution is you must have qt libraries installed on your system.After installing qt rpm packages, install geos and re-install gdal with --with-geos option.

user1381361
  • 19
  • 1
  • 3