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?

So you downloaded the files to /usr/local/bin?
–
JamieMar 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?
–
DomMar 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!
–
DomMar 28 '13 at 16:12

1

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.
–
bcmOct 18 '13 at 9:14

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:

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)

Dom's comment solved my issue so I wanted to provide it as an actual answer (in case someone else is following the d3 tutorial).

Make sure tools are installed correctly

To do this, type which ogr2ogr and which topojson on the console. It should return /usr/local/bin/ogr2ogr and /usr/local/bin/topojson.

Move all the files over (yes all of them, not just the .shp file)

E.g. I moved all the files to my folder '/Users/williamliu/GitHub/d3-examples/maps' and placed the contents of 'ne_10m_admin_0_map_subunits' in there. The relevant files include:

ne_10m_admin_0_map_subunits.cpg

ne_10m_admin_0_map_subunits.dbf

ne_10m_admin_0_map_subunits.prj

ne_10m_admin_0_map_subunits.shp

ne_10m_admin_0_map_subunits.shx

Run the command

Navigate to your folder and in the console, run: ogr2ogr -f geoJSON -where "ADM0_A3 IN ('GBR', 'IRL')" subunits.json ne10m_admin_0_map_subunits.shp. You should now have a new file 'subunits.json' in your folder.