I'm trying to extract the layer DEPARE from an S-57 datafile and convert it into a shapefile. I'm using ogr2ogr from OpenGeo Suite 4.5 (GDAL 1.11.1) on Windows 7 64 bit.
The problem is that when I issue ogr2ogr -f "ESRI shapefile" depare.shp US6RI26M.000 DEPARE
I get an error FAILURE: Couldn't fetch requested layer 'DEPARE'!
.
This seems odd because when I load the same s-57 file into QGis I can choose the layer DEPARE among all other layers. I've tried calling ogrinfo -ro -summary US6RI26M.000
which returns the follwing:
INFO: Open of `US6RI26M.000'
using driver `S57' successful.
1: DSID (None)
2: Point (Point)
3: Line (Line String)
4: Area (Polygon)
5: Meta (None)
I struggle to understand why I don't see the same layers that I get when opening the file in QGis – DISD, BRIDGE, BUISGL, BUAARE, CTNARE, DEPARE… Is the DEPARE layer part of a higher-level layer 4: Area (Polygon)
as shown by ogrinfo?
Question: How can I extract the DEPARE layer from an S-57 file and convert it into a shapefile using the ogr2ogr tool?
I'm clearly missing something. I've searched for related q&a but none I've found so far solves my problem.
Best Answer
I found the answer on the gdal-dev mailing list.
In summary, there are some .csv-files needed by the S-57 (ENC) reader. These are by default put in the GDAL_HOME/data directory (at least in GDAL 2.0.0), so for using ogrinfo you first need to do
SET S57_CSV=C:\gdal\install\dir\data
, then everything (both ogrinfo and your own programs) should be able to read ENC files correctly.This is also documented on the S-57 driver page.