Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
So you downloaded the files to /usr/local/bin? –  Jamie Mar 28 '13 at 15:25
    
i'm not sure, I did brew install gdal, how would I figure out where I downloaded the files to? –  Dom Mar 28 '13 at 16:01
    
In the tutorial I downloaded both folders ne_10m_populated_places and ne_10m_admin_0_map_subunits, and I was working out of the folder that had both of the unzipped folders in them. I needed to open ne_10m_admin_0_map_subunits. Thanks for the help! –  Dom Mar 28 '13 at 16:12
    
Didn't 'get it' with the answer below. The key to resolving this error for me was knowing that the rest of the files in that zip folder, besides the shape(.shp) file(!), were important in the process of converting it to GeoJSON format using ogr2ogr. –  bcm Oct 18 '13 at 9:14
add comment

2 Answers

up vote 1 down vote accepted

So I just install ogr2ogr on Ubuntu 12.10.

I then downloaded the files that that tutorial said to download.

I then created a directory in my home directory called d3.

I unzipped the zip files in the d3 directory.

I then navigated to the d3 directory in the terminal.

I then ran the command and it worked.

I then rant he command with a bad file name and recieved the same error as you just did.

This leads me to believe that the ogr2ogr command cannot find the filename you are entering because you do not have that file in the directory you are running the command. You do not need to run the command from the usr/bin/local directory. If it will not run in the directory with the data you may need to give the full path before runnning the commnad in the direcotry with the data. It would look like this:

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

share|improve this answer
    
so I ran the command with the full path, and it gives me: -bash: /local/bin/ogr2ogr: No such file or directory. i must have downloaded the files to the wrong directory. –  Dom Mar 28 '13 at 15:59
    
I downloaded them to the wrong directory. This makes a lot more sense now. Thanks for your help! –  Dom Mar 28 '13 at 16:09
    
No problem, if this solved your issue, then please mark it as the answer for future reference. –  Jamie Mar 28 '13 at 16:30
add comment

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)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.