1

I am interested in reading an S-57 file into R, as a sf or terra object. My data is from https://charts.noaa.gov/InteractiveCatalog/ and specifically chart number US5MD23M.

My question is similar to How to open the Electronic nautical chart S-57 data? but specifically for R users.

1 Answer 1

2

You should be able to read this using the sf package as a vector data source.

Extracting the ZIP file of the chart I think you are referencing gets me a US5MD23M.000 file. With sf package I can see its lots of layers:

> st_layers("US5MD23M.000")
Driver: S57 
Available layers:
   layer_name  geometry_type features fields
1        DSID             NA        1     36
2      BCNLAT          Point      121     43
3      BCNSPP          Point       10     43
4      BRIDGE                      40     40
[etc etc]

You can read a layer by name:

> rivers = st_read("US5MD23M.000","RIVERS")
Reading layer `RIVERS' from data source 
  `/nobackup/rowlings/Downloads/ENC_ROOT/US5MD23M/US5MD23M.000' 
  using driver `S57'
Simple feature collection with 518 features and 24 fields
Geometry type: GEOMETRY
Dimension:     XY
Bounding box:  xmin: -76.1938 ymin: 38.23361 xmax: -75.5877 ymax: 38.64338
Geodetic CRS:  WGS 84
> plot(rivers$geom)

enter image description here

You'll have to consult a data dictionary to find out what the layers and fields mean, if you need that information:

> names(rivers)
 [1] "RCID"      "PRIM"      "GRUP"      "OBJL"      "RVER"      "AGEN"     
 [7] "FIDN"      "FIDS"      "LNAM"      "NOBJNM"    "OBJNAM"    "STATUS"   
[13] "INFORM"    "NINFOM"    "NTXTDS"    "SCAMAX"    "SCAMIN"    "TXTDSC"   
[19] "RECDAT"    "RECIND"    "SORDAT"    "SORIND"    "LNAM_REFS" "FFPT_RIND"
[25] "geometry" 

More info about reading S57 in R via GDAL here:

https://gdal.org/drivers/vector/s57.html#vector-s57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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