[GIS] How to move and open shapefiles with ogr2ogr

d3ogr2ogr

I'm a total newb following along the d3 map tutorial.

at this line:

    ogr2ogr \
  -f GeoJSON \
  -where "adm0_a3 IN ('GBR', 'IRL')" \
  subunits.json \
  ne_10m_admin_0_map_subunits.shp

I get this output:

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
  -> PCIDSK
  -> XPlane
  -> AVCBin
  -> AVCE00
  -> DXF
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> PGDump
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> PDS
  -> HTF
  -> AeronavFAA
  -> EDIGEO
  -> SVG
  -> Idrisi
  -> ARCGEN
  -> SEGUKOOA
  -> SEGY

This has been asked before, but I have ogr2ogr installed correctly, and my question is much more basic.

I haven't moved any .shp, .shx, .dbf, and .prj files. I'm following the tutorial closely, and haven't created any type of project directory, so I am still working out of usr/bin/local. Do I need to move certain files to a new project folder? If so where can I find them?

Best Answer

I think ogr is expecting the shapefile to be in whatever the current directory is--are you sure you got to the correct directory before running ogr2ogr? you can also use ogrinfo to check on the file (for ex: ogrinfo -so filename.shp)

Related Question