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 \

I get this output:

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

  • So you downloaded the files to /usr/local/bin?
    – Jamie
    Mar 28, 2013 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, 2013 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, 2013 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.
    – bcm
    Oct 18, 2013 at 9:14

4 Answers 4


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.

  • 1
    Move all the files over (yes all of them, not just the .shp file) solved my issue. Thanks for this answer.
    – robe007
    Jan 11, 2016 at 16:57
  • Yes, "move all the files over" worked perfectly here. The tutorial only told me about the .shp, but moving all of them fixed this error.
    – r3bl
    Oct 9, 2019 at 10:12

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 \

  • 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, 2013 at 15:59
  • I downloaded them to the wrong directory. This makes a lot more sense now. Thanks for your help!
    – Dom
    Mar 28, 2013 at 16:09
  • No problem, if this solved your issue, then please mark it as the answer for future reference.
    – Jamie
    Mar 28, 2013 at 16:30

If you are using windows 10, try to execute this command from any "bash" e.g. Git Bash, MINGW64, Bash on Ubuntu on Windows ect. It should help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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