2

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.

6
  • Which GDAL version that might be? The driver info is different from the example at mapserver.org/fr/input/vector/S57.html which shows the driver name as using driver IHO S-57 (ENC) successful
    – user30184
    Dec 20 '14 at 12:50
  • I'm using GDAL 1.11.1, released 2014/09/24 (updated above).
    – David
    Dec 20 '14 at 13:21
  • 1
    You may have a OSGeo4W shell on your computer. Try from that or download Windows binaries from gisinternals.com/sdk.
    – user30184
    Dec 21 '14 at 9:21
  • It does indeed work using OSGeo4W shell! Will you please shed a bit of light on why that is?
    – David
    Dec 21 '14 at 16:06
  • The GDAL in OpenGeo Suite must have been compiled somehow differently than the OSGeo4W version. Perhaps with older source code for the driver or libraries that S-57 driver depends. Because of the different name of the driver in your ogr2ogr example I guess that GDAL in OpenGeo Suite builds with some old version of the S-57 driver. Write a message to Boundless and ask.
    – user30184
    Dec 22 '14 at 5:50
2

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.

0

The problem is that you haven't set your system variables for GDAL. If you do the following:

GDAL_DATA=C:\PATH\TO\gdal\bin\gdal-data
GDAL_DRIVER_PATH=C:\PATH\TO\gdal\bin\gdal\plugins

With the important one being the GDAL_DATA path

It happens on about every machine of mine when I load S57 data

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.