2

I'm following along the D3 tutorial, and on this line:

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

run into the following problem:

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

I have the .shp, .shx, .dbf, and .prj files all in this directory. Why is ogr2ogr unable to read them with anything? (Shapelib is installed.)

I'm using Ubuntu 12.10 if that makes any difference, and had to compile GDAL from scratch, using version 1.9.0.

6
  • I wonder if there is something missing or broken in your compilation because this works for me using pre-compiled binaries (admittedly for Windows). Have you tried using pre-compiled Binaries? I'm not so familiar with Ubuntu but perhaps this site might help: launchpad.net/~ubuntugis Commented Jan 8, 2013 at 8:33
  • 1
    what happens if you try ogrinfo ne_10m_admin_0_map_subunits.shp
    – Ian Turton
    Commented Jan 8, 2013 at 8:41
  • Unclear what happened, but it seems to work now. I made no changes, just rebooted today and the command mysteriously worked. I'll take it. Thanks guys! Commented Jan 8, 2013 at 22:09
  • 1
    @Sylvester, unfortunately, I was unable to use the pre-compiled binaries. I certainly would have preferred that method, but gdal kept failing to install, whether I used stable or unstable ubuntugis ppa---it had a cryptic "installation failed" message, and took some serious (and frustrating) sleuthing to learn I had to compile successfully from source (something I'd never done before). Commented Jan 8, 2013 at 22:26
  • I can't vote up yet so I'm typing my answer, probably some issue with my installation but anyway, reboot worked!
    – curiousCat
    Commented Jan 1, 2015 at 6:14

2 Answers 2

3

I ran into this exact problem because I hadn't extracted the zip file into the working directory. I was rushing to get the files converted and when I checked to make sure they were there, the "preview" that I got when I double-clicked on the zipped file tricked me into thinking they were available for conversion. Even if this wasn't the solution to your problem, maybe someone else with the same error will benefit from my haste.

1
  • 1
    Thank you for posting this. I made the same hasty error.
    – Marty
    Commented Nov 18, 2014 at 16:55
-5

I don't know the formal answer to this question, and I'm unable to provide more details of what was going wrong, or what was done to fix it. However, strangely, it started working again.

In response to Dave X's comment above, I'm going to accept this as the correct answer---since I won't be able to provide additional information that will lead to adequately solving it.

If you're in the same position I was at the time of asking this, I can only advise you to keep re-installing all the stuff you've already installed several times, reboot occasionally and hope.

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