Conversion of S75 charts to GeoJSON with GDAL org2org utility.

The original S57 map consists of the following layers:

ogrinfo E:\temp\ENC_ROOT\US4CA11M\US4CA11M.000
INFO: Open of `E:\temp\ENC_ROOT\US4CA11M\US4CA11M.000'
      using driver `S57' successful.
1: DSID (None)
2: Point (Point)
3: Line (Line String)
4: Area (Polygon)
5: Meta (None)

So I was able to convert each layer separately one by one without errors:

ogr2ogr -f GeoJSON US1HA02M-Area.json E:\temp\ENC_ROOT\US1HA02M\US1HA02M.000 Area -lco RFC7946=YES -skipfailures
ogr2ogr -f GeoJSON US1HA02M-Point.json E:\temp\ENC_ROOT\US1HA02M\US1HA02M.000 Point -lco RFC7946=YES -skipfailures
ogr2ogr -f GeoJSON US1HA02M-Line.json E:\temp\ENC_ROOT\US1HA02M\US1HA02M.000 Line -lco RFC7946=YES -skipfailures
ogr2ogr -f GeoJSON US1HA02M-DSID.json E:\temp\ENC_ROOT\US1HA02M\US1HA02M.000 DSID -lco RFC7946=YES -skipfailures
Warning 1: No SRS set on layer. Assuming it is long/lat on WGS84 ellipsoid
ogr2ogr -f GeoJSON US1HA02M-Meta.json E:\temp\ENC_ROOT\US1HA02M\US1HA02M.000 Meta -lco RFC7946=YES -skipfailures
Warning 1: No SRS set on layer. Assuming it is long/lat on WGS84 ellipsoid

For example, resulting US1HA02M-Area.json file contains this:

{
"type": "FeatureCollection",
"name": "Area",
"features": [
{ "type": "Feature", "properties": { "RCID": 188, "PRIM": 3, "GRUP": 2, "OBJL": 27, "RVER": 1, "AGEN": 550, "FIDN": 1184050210, "FIDS": 240, "LNAM": "022646932C2200F0" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -158.2571653, 21.5803311 ], [ -158.252962, 21.581313 ], [ -158.2482617, 21.5823018 ], [ -158.242808, 21.583449 ], [ -158.230622, 21.586296 ], [ -158.209552, 21.58677 ], [ -158.1892112, 21.5868791 ], [ -158.140379, 21.634842 ], [ -158.04872, 21.707345 ], [ -158.0545, 21.721225 ], [ -158.085053, 21.759001 ], [ -158.146985, 21.803703 ], [ -158.165152, 21.811409 ], [ -158.193227, 21.824508 ], [ -158.227083, 21.833753 ], [ -158.265894, 21.838376 ], [ -158.315439, 21.837605 ], [ -158.35425, 21.829901 ], [ -158.386454, 21.817573 ], [ -158.412052, 21.807556 ], [ -158.427742, 21.796767 ], [ -158.456643, 21.7775 ], [ -158.47481, 21.760543 ], [ -158.494628, 21.7405 ], [ -158.510317, 21.722767 ], [ -158.526833, 21.68421 ], [ -158.53509, 21.664927 ], [ -158.540045, 21.647957 ], [ -158.466552, 21.622497 ], [ -158.2571653, 21.5803311 ] ] ] } },
{ "type": "Feature", "properties": { "RCID": 189, "PRIM": 3, "GRUP": 2, "OBJL": 27, "RVER": 1, "AGEN": 550, "FIDN": 1184050210, "FIDS": 238, "LNAM": "022646932C2200EE" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -156.504654, 20.589614 ], [ -156.51579, 20.601046 ], [ -156.525408, 20.612953 ], [ -156.53452, 20.622954 ], [ -156.540088, 20.62724 ], [ -156.547681, 20.628669 ], [ -156.561855, 20.630098 ], [ -156.570461, 20.629621 ], [ -156.590709, 20.625812 ], [ -156.602858, 20.623907 ], [ -156.61855, 20.618668 ], [ -156.648923, 20.601046 ], [ -156.661071, 20.594378 ], [ -156.704605, 20.587709 ], [ -156.715742, 20.585327 ], [ -156.732953, 20.562461 ], [ -156.738521, 20.546261 ], [ -156.739533, 20.533873 ], [ -156.735484, 20.521959 ], [ -156.692456, 20.471436 ], [ -156.605389, 20.475727 ], [ -156.498073, 20.481447 ], [ -156.50111, 20.544355 ], [ -156.504654, 20.589614 ] ], [ [ -156.552164, 20.590701 ], [ -156.5501706, 20.5879597 ], [ -156.547611, 20.58444 ], [ -156.546561, 20.582793 ], [ -156.546561, 20.575872 ], [ -156.549362, 20.569941 ], [ -156.554265, 20.556098 ], [ -156.558467, 20.543244 ], [ -156.558467, 20.53764 ], [ -156.557066, 20.535992 ], [ -156.551113, 20.535992 ], [ -156.543409, 20.536651 ], [ -156.541308, 20.536322 ], [ -156.540257, 20.534344 ], [ -156.540257, 20.532366 ], [ -156.540608, 20.52841 ], [ -156.54586, 20.51951 ], [ -156.545985, 20.5181017 ], [ -156.546211, 20.515554 ], [ -156.547261, 20.513576 ], [ -156.550063, 20.513246 ], [ -156.552514, 20.513905 ], [ -156.5540443, 20.5170748 ], [ -156.554265, 20.517532 ], [ -156.556716, 20.519839 ], [ -156.559868, 20.519839 ], [ -156.562669, 20.518521 ], [ -156.564771, 20.517202 ], [ -156.567922, 20.516213 ], [ -156.569323, 20.516213 ], [ -156.573175, 20.517861 ], [ -156.576327, 20.517861 ], [ -156.579829, 20.516543 ], [ -156.584031, 20.513246 ], [ -156.586832, 20.513246 ], [ -156.589984, 20.513905 ], [ -156.594186, 20.51885 ], [ -156.597688, 20.520828 ], [ -156.607144, 20.520828 ], [ -156.609245, 20.518521 ], [ -156.612046, 20.517532 ], [ -156.620451, 20.517532 ], [ -156.622552, 20.515554 ], [ -156.626054, 20.514235 ], [ -156.631307, 20.514235 ], [ -156.634458, 20.512586 ], [ -156.63726, 20.50863 ], [ -156.6381928, 20.5083372 ], [ -156.640411, 20.507641 ], [ -156.643563, 20.50863 ], [ -156.6447004, 20.509558 ], [ -156.648816, 20.512916 ], [ -156.651968, 20.513576 ], [ -156.6553136, 20.5116857 ], [ -156.657221, 20.510608 ], [ -156.664575, 20.505993 ], [ -156.669827, 20.504674 ], [ -156.67543, 20.504674 ], [ -156.682434, 20.506982 ], [ -156.685586, 20.50896 ], [ -156.686636, 20.512586 ], [ -156.686636, 20.515883 ], [ -156.688387, 20.517532 ], [ -156.695041, 20.51885 ], [ -156.700644, 20.522477 ], [ -156.702745, 20.526433 ], [ -156.703446, 20.531707 ], [ -156.702395, 20.535663 ], [ -156.698193, 20.540277 ], [ -156.69294, 20.545551 ], [ -156.688738, 20.550166 ], [ -156.686286, 20.552473 ], [ -156.678232, 20.558406 ], [ -156.668427, 20.561372 ], [ -156.659322, 20.563349 ], [ -156.648466, 20.566974 ], [ -156.640411, 20.572247 ], [ -156.625704, 20.581804 ], [ -156.607844, 20.594655 ], [ -156.593836, 20.601575 ], [ -156.583681, 20.603881 ], [ -156.5778922, 20.603881 ], [ -156.566872, 20.603881 ], [ -156.561619, 20.601245 ], [ -156.552164, 20.590701 ] ], [ [ -156.620067, 20.505737 ], [ -156.6194966, 20.5079611 ], [ -156.619473, 20.508053 ], [ -156.617438, 20.510449 ], [ -156.615148, 20.511487 ], [ -156.612094, 20.511646 ], [ -156.6120802, 20.5116408 ], [ -156.610822, 20.511167 ], [ -156.609889, 20.510209 ], [ -156.60938, 20.508452 ], [ -156.60938, 20.506616 ], [ -156.610228, 20.504699 ], [ -156.611755, 20.503182 ], [ -156.613536, 20.502224 ], [ -156.615487, 20.501505 ], [ -156.617099, 20.501505 ], [ -156.61888, 20.502064 ], [ -156.619643, 20.503022 ], [ -156.619898, 20.50422 ], [ -156.620067, 20.505737 ] ] ] } },

Point:

{
"type": "FeatureCollection",
"name": "Point",
"features": [
{ "type": "Feature", "properties": { "RCID": 1, "PRIM": 1, "GRUP": 2, "OBJL": 9, "RVER": 1, "AGEN": 550, "FIDN": 1184230191, "FIDS": 34, "LNAM": "02264695EB2F0022", "LNAM_REFS": [ "02264695EB2F0023" ], "FFPT_RIND": [ 2 ] }, "geometry": { "type": "Point", "coordinates": [ -160.0982981, 22.026059 ] } },
{ "type": "Feature", "properties": { "RCID": 2, "PRIM": 1, "GRUP": 2, "OBJL": 9, "RVER": 1, "AGEN": 550, "FIDN": 203785031, "FIDS": 3733, "LNAM": "02260C2583470E95", "LNAM_REFS": [ "02260C2584DA0E95", "02260C258ACF0E95" ], "FFPT_RIND": [ 2, 2 ] }, "geometry": { "type": "Point", "coordinates": [ -157.3051047, 21.0996956 ] } },

Line:

{
"type": "FeatureCollection",
"name": "Line",
"features": [
{ "type": "Feature", "properties": { "RCID": 120, "PRIM": 2, "GRUP": 2, "OBJL": 30, "RVER": 1, "AGEN": 550, "FIDN": 1184050208, "FIDS": 117, "LNAM": "022646932C200075" }, "geometry": { "type": "LineString", "coordinates": [ [ -160.54665, 21.655932 ], [ -160.54665, 21.659451 ], [ -160.543511, 21.662971 ], [ -160.540999, 21.662971 ], [ -160.538801, 21.661798 ], [ -160.537859, 21.659451 ], [ -160.537859, 21.655639 ], [ -160.5380282, 21.6542162 ], [ -160.538173, 21.652999 ], [ -160.540999, 21.652119 ], [ -160.543825, 21.651532 ], [ -160.5458146, 21.6533921 ], [ -160.546022, 21.653586 ], [ -160.54665, 21.655932 ] ] } },
{ "type": "Feature", "properties": { "RCID": 121, "PRIM": 2, "GRUP": 2, "OBJL": 30, "RVER": 1, "AGEN": 550, "FIDN": 1184050208, "FIDS": 124, "LNAM": "022646932C20007C" }, "geometry": { "type": "LineString", "coordinates": [ [ -160.239628, 21.90212 ], [ -160.23878, 21.904403 ], [ -160.237273, 21.906423 ], [ -160.234165, 21.907741 ], [ -160.231716, 21.907741 ], [ -160.229644, 21.906863 ], [ -160.228608, 21.905106 ], [ -160.228608, 21.90291 ], [ -160.229455, 21.900539 ], [ -160.231433, 21.898694 ], [ -160.233976, 21.897377 ], [ -160.236048, 21.897201 ], [ -160.237744, 21.89764 ], [ -160.239157, 21.898782 ], [ -160.239722, 21.900714 ], [ -160.239628, 21.90212 ] ] } },

DSID:

{
"type": "FeatureCollection",
"name": "DSID",
"features": [
{ "type": "Feature", "properties": { "DSID_EXPP": 1, "DSID_INTU": 1, "DSID_DSNM": "US1HA02M.000", "DSID_EDTN": "11", "DSID_UPDN": "2", "DSID_UADT": "20180614", "DSID_ISDT": "20180614", "DSID_STED": 3.1, "DSID_PRSP": 1, "DSID_PSDN": "", "DSID_PRED": "2.0", "DSID_PROF": 1, "DSID_AGEN": 550, "DSID_COMT": "STED:3.1.3; Produced by NOAA", "DSSI_DSTR": 2, "DSSI_AALL": 1, "DSSI_NALL": 1, "DSSI_NOMR": 9, "DSSI_NOCR": 0, "DSSI_NOGR": 1227, "DSSI_NOLR": 0, "DSSI_NOIN": 380, "DSSI_NOCN": 989, "DSSI_NOED": 1290, "DSSI_NOFA": 0, "DSPM_HDAT": 2, "DSPM_VDAT": 16, "DSPM_SDAT": 12, "DSPM_CSCL": 1650000, "DSPM_DUNI": 1, "DSPM_HUNI": 1, "DSPM_PUNI": 1, "DSPM_COUN": 1, "DSPM_COMF": 10000000, "DSPM_SOMF": 10, "DSPM_COMT": "Produced by ESRI Nautical Solution" }, "geometry": null }
]
}

But Meta looks like an empty file:

{
"type": "FeatureCollection",
"name": "Meta",
"features": [
]
}

It is also was possible to convert S57 first to ESRI Shapefile and then to GeoJSON:

ogr2ogr -f "ESRI Shapefile" US4CA11M.shp E:\temp\ENC_ROOT\US4CA11M\US4CA11M.000 -skipfailures
ogr2ogr -f GeoJSON US4CA11M.json US4CA11M.shp  -lco RFC7946=YES -skipfailures

but only one layer ‘Area’ was converted and the errors were:

ERROR 1: Layer 'Line' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'Point' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'DSID' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'Meta' does not already exist in the output dataset, and cannot be created by the output driver.

To make ogr2ogr work with S57 I assigned the following environment variables:

set S57_CSV=E:\repos\gdal-2.3.2\data 
set GDAL_DATA=E:\repos\gdal-2.3.2\data
set PATH=%PATH%;E:\repos\gdal-2.3.2\apps
set PATH=%PATH%;E:\repos\gdal-2.3.2

Leave a Reply

Your email address will not be published.