Converting S-101 to S-57
EncDotNet.S100 can convert an S-101 dataset back into an IHO S-57 Edition 3.1 base cell. The conversion follows IHO S-65 Annex C, S-101 to S-57 ENC Conversion Guidance (Edition 1.0.0), which is written against S-101 Edition 2.0.0.
Use it for two things:
- Testing. Converting S-57 → S-101 → S-57 and comparing the result with the source shows differences that Annex C doesn't explain, which usually point to a bug in the forward translation described in Bringing S-57 into the pipeline.
- Tools that read only S-57. GDAL/OGR, OpenCPN and S-52 viewers can't read S-101 yet. A converted cell lets you look at S-101 test or trial data in them.
Important
The output isn't a production ENC and mustn't be used for navigation. Nothing checks it against S-58, the ENC validation checks. Annex C itself expects the producer to review and finish each converted cell by hand before distributing it. Hydrographic offices that must issue S-57 cells during the dual-fuel period should use a certified production tool.
S101ToS57Translator does the conversion and S57DocumentWriter from
EncDotNet encodes the result. The
Datasets.S57 README
covers using them from code and lists every Annex C clause with the rule that
converts it.
Convert a dataset
Convert a base dataset with s100 s101 convert:
s100 s101 convert --to s57 -o path/to/XX5CELL1.000 path/to/101XX00CELL1.000
Update datasets (.001, .002, and so on) next to the base dataset are
applied first. Pass --no-updates to convert the base dataset alone.
The output is an ISO/IEC 8211 encoded S-57 base cell. Read it back with
s100 info, which reports it as S-57, or open it in any S-57 reader. For the
command's options, see s101 convert.
S-57 tools expect an 8-character cell name such as XX5CELL1, so name the
output file that way. S-101 names, such as 101XX00CELL1, are longer.
Read the summary
After converting, the command prints a translation summary built from
S101ToS57TranslationDiagnostics:
- how many S-101 features were read and how many S-57 feature records were
written, including objects made from part of a feature, such as a
TOPMARfrom atopmarkor oneLIGHTSper sector; - features that Annex C restructures, whose primitive changes, or whose skin of the earth is cut;
- text folded into
INFORM, values moved to national attributes, lists cut to their first value and mandatory attributes left empty; - features, attributes and information types that Annex C drops, and those that have no rule at all.
Add --report <path> to also write this information as JSON. The report gives
each Annex C drop with its clause, so you can check it against the guidance,
and records the options the command used.
Features and attributes reported as unmapped have no conversion rule. In a cell converted from S-101 Edition 2.0.0 they're rare, and each one is worth a look. Drops by Annex C are expected.
Convert an older edition
Annex C converts S-101 Edition 2.0.0. Earlier editions name some classes
differently: Edition 1.0.0 has BuoyLateral and BeaconCardinal where 2.0.0
has LateralBuoy and CardinalBeacon. The converter has no rule for the
older names, so it reports those features as unmapped and leaves them out of
the cell. The command warns when a dataset declares an edition other than
2.0.0.
The IHO S-101 test datasets are Edition 1.0.0, so their buoys, beacons and restricted areas don't convert. Across the 19 test datasets, 2,072 features read give 1,917 S-57 records.
What Annex C drops or folds
Annex C aims for a minimal conversion: an S-57 cell that's safe to use and passes S-58, not one that matches a native S-57 cell. Content that S-57 can't hold is dropped or folded into text. A round trip from S-57 is therefore never an exact copy.
- Dropped. Time, URI and URN attributes, Text Placement features (S-57 has no cartographic features), the Update Information meta-feature, and the Service Hours and Non-standard Working Day information types. Each feature clause also lists attributes that aren't converted on that class.
- Folded into
INFORMandNINFOM. Nautical Information and Contact Details information types, the text ofinformation,sectorInformationandshapeInformation, enumeration values S-57 lacks, andmultiplicityOfFeatures(as text such as "3 features"). Several strings are joined with a separator. - Multiple values. A list of enumeration values becomes a comma-separated list when the S-57 attribute is a List, and keeps only its first value when it's Enumerated.
- Mandatory attributes. A mandatory S-57 attribute with no S-101 value is written empty, for the producer to fill.
- Names and files. A
featureNamebecomesOBJNAMorNOBJNMby itsnameUsage. A file reference becomesTXTDSCorNTXTDSby language, and only the first picture reference is kept, asPICREP. Support files aren't copied or renamed. - Restructured features. A bridge becomes one
BRIDGEper span. Range systems, fairway systems and similar collections becomeC_AGGRaggregations. Structure and equipment become master and slave pointers. - Coverage. Data Coverage features become
M_COVRobjects that tile the cell's bounding box, and anM_CSCLfor each coverage at another scale. - Primitives. Where S-57 doesn't allow the S-101 primitive (Annex C Table 2-1), a curve becomes a narrow area and a surface becomes a point.
- Skin of the earth. The S-101 skin of the earth is cut around
FLODOC,HULKESandPONTONareas, which are skin of the earth in S-57.
Annex C doesn't cover update datasets. The command converts the up-to-date base dataset into a new base cell; it doesn't write S-57 update cells.
Choose the Annex C options
Annex C leaves some choices to the converter. The command's options set them:
| Option | Default | Annex C |
|---|---|---|
--no-optional-inform |
off | Skips the conversions to INFORM that Annex C marks optional, such as multiplicityOfFeatures. |
--inform-separator <text> |
; |
The separator between strings folded into one INFORM or NINFOM (§2.4.6). |
--max-inform-length <n> |
300 |
The recommended maximum length of INFORM and NINFOM (§2.4.6). |
--inform-length keep\|truncate |
keep |
Keeps a longer text and reports it, or cuts it at the maximum. |
--national-language <code> |
first | The ISO 639-2 language, such as fra, to prefer for NOBJNM, NINFOM and NTXTDS when there are several (§2.4.12.1). |
--name-without-usage by-language\|drop |
by-language |
A name without a nameUsage: an English or unlabelled one becomes OBJNAM and any other NOBJNM, or it isn't converted (§27.132). |
Write an exchange set
Some S-57 tools open an exchange set rather than a single cell. Add
--exchange-set and give a directory with -o:
s100 s101 convert --to s57 --exchange-set --cell-name XX5CELL1 -o path/to/s57set path/to/101XX00CELL1.000
The command writes the cell to ENC_ROOT/XX5CELL1/XX5CELL1.000 and a
CATALOG.031 to ENC_ROOT. The catalogue lists the cell with its extent and
CRC. Without --cell-name, the cell is named after the source file, and the
command warns if that isn't an 8-character S-57 name. Check the catalogue with
s100 validate:
s100 validate path/to/s57set/ENC_ROOT/CATALOG.031
What a producer still has to do
Annex C Appendix A lists the work each feature class may need after conversion. The converter doesn't do any of it. Before a converted cell could be distributed, a producer would at least:
- fill the mandatory attributes left empty, which the summary counts;
- shorten
INFORMandNINFOMtexts over the recommended length; - rename and supply the support files that
TXTDSC,NTXTDSandPICREPrefer to; - review the objects Annex C restructures or changes the primitive of;
- run S-58 validation and resolve the errors, ignoring the S-58 checks that Annex C says to expect.
The conversion doesn't encode spatial quality on spatial records (QUAPOS,
and POSACC and SOUACC on vector records), and doesn't make the optional
M_QUAL fill. See the
Datasets.S57 README
for the full list of what's covered.
See also
s101 convert: the command's options.- Bringing S-57 into the pipeline: the forward conversion, from S-57 to S-101.
- Datasets.S57 README:
S101ToS57Translator, its options and diagnostics, and the Annex C coverage table.