Thursday, 15 May 2014

S-57 Styling ENC Group 1 Classes (Skin of the Earth) for #GeoServer #ECDIS

Class LNDARE (Land area) requires a simple color fill with color token LANDA.

The S-52 Specification for ECDIS Display consists of 64 color tokens, in three (or five - depending on the version of the Spec) color palettes for DAY (DAY BRIGHT, DAY WHITE, and DAY BLACK), DUSK, and NIGHT displays. The differing color palettes enables the ECDIS to behave in a similar fashion to how a GPS Navigator in your car turns from a bright white display into a dark navy display in order to preserve your night vision during night time driving.

These color tokens are provided as CIE Yxy colors, and need to be converted into RGB colors by the ECDIS manufacturers.

For the DAY BRIGHT palette, LANDA maps to a soft yellow/light brown color. This shifts to a very dark e brown tone for night time use.

The next Class we want to show s DEPARE (Depth area) – this is the water, essentially. The DEPARE can be rendered in either 2 (default) or 4 distinguishing shades (of greyish blue for DAY BRIGHT palette, and dark violet/black for NIGHT) - DEPDW (deep water), DEPMD (medium deep water), DEPMS (medium shallow), DEPVS (very shallow), plus DEPIT (intertidal).

The NIGHT palette can only distinguish three shades – deep (using DEPDW), shallow (DEPVS), and intertidal (DEPIT). Note that deep and shallow are in reference to the safety contour.
The S-52 Specification recommends that the ECDIS allow the mariner to select a deep contour (default 30 metres) and a shallow contour (default 2.0 metres) in addition to safety contour (default 30 metres).
The actual contour lines are handled by the Class DEPCNT which is a Line Geometry. We shall look at this later.

In order to show the WRECKS layer with the LNDARE and DEPARE layers, we need to create a Layer Group, and this brings up the issue of the order of layering. The S-52 Specification consists of a field called Display Priority which is a number between 0 and 9, with the lowest priority 0 being laid down first and higher numbers being displayed on top. In cases where the Display Priority is the same, Geometries of type Point go on top of Lines, which go on top of Areas.

To facilitate this layering, I have developed a naming convention for these SLD Style files like so:

LNDARE_A1.sld – this signifies that style LNDARE is for Area Geometry, Display Priority 1
DEPARE_A1.sld – also for Area Geometry, Display Priority 1
WRECKS_P4.sld – this is for Point Geometry, Display Priority 4 (goes on top of the other two)

Putting all this together, we now have this for Cell US5FL24M:

Saturday, 10 May 2014

S-57 ENC Styling for GeoServer

To get started styling S-57 ENC, I selected a layer of Point geometries from the previously converted S-57 ENC Cell US5FL24M that would be interesting for me to display – WRECKS. This Class actually comes in two flavours -  Point and Area, and we will revisit the latter at a later date.

I proceeded to load in the WRECKS, and it picked up the default point style as shown here:

Looking at the S-52 Specification, WRECKS has two important attributes that affect the styling – CATWRK (Category of wreck) and also VALSOU (Value of sounding). Keeping things simple, I developed an SLD with rules based on the CATWRK values. I also created three graphics based on the designs in the S-52 ENC Symbol Catalog – WRECKS01, WRECKS04, and WRECKS05 using the DAY BRIGHT (more about this later) palette. Loading all that into GeoServer and reloading the layer produced this display:

Some progress, but showing the positions of the wrecks without any further reference to shore is not very useful. I have also simplified these rules somewhat - S-52 actually contains Conditional Symbology Procedures (CSP) - these are essentially rendering rules based on values of attributes and specified using UML Activity Diagrams.

The S-57 Specification consists of over 170 Classes, each of which is presented as one or more Geometric primitives of type Point, Line, or Area (P, L, A) - this could potentially result in several hundred layers and styles. Fortunately, by rendering a small subset of these we can obtain very useful results in an iterative fashion.

Of these 170 or so Classes, there are seven Classes (using Area Geometric primitive only) that make up what is known as the "Skin of the Earth". These are the ENC Group 1 Classes:

LNDARE (Land area)
DEPARE (Depth area)
DRGARE (Dredged area)
FLODOC (Floating dock)
PONTON (Pontoon)
UNSARE (Unsurveyed area)

As an example, Land Area (LNDARE) has Point, Line, and Area. Only the Area Geometry forms part of the Skin. We will look at these next.

Tuesday, 29 April 2014

Creating an S-57 ENC Display with OpenLayers and GeoServer

Something that I have been wanting to do for a long time - that is to render S-57 ENC (Electronic Navigation Charts) using OpenLayers and GeoServer.

The process starts with converting the S-57 ".000" file in numerous Shapefiles using ogr2ogr. S-57 Objects have Geometric Primitives like Points, Lines, and Polygons; and are tied to Spatial Objects that have coordinates. The conversion then has to be done for each Geometry type:

ogr2ogr -skipfailures -f "ESRI Shapefile" point US5FL24M.000 -nlt POINT
ogr2ogr -skipfailures -f "ESRI Shapefile" line US5FL24M.000 -nlt LINESTRING
ogr2ogr -skipfailures -f "ESRI Shapefile" area US5FL24M.000 -nlt POLYGON

These commands will create point, line, polygon Shapefiles in corresponding folders for S-57 file US5FL24M.000 - note that many of the output files will be not-applicable (possibly blank) and we need to refer to the S-57 Specification to see which Class has which Geometric Primitives. Example is LNDARE which is "land area" - this supports both area and point geometries and needed to be styled for both.

Next step then was to figure out the specification for each S-57 Class and how it is styled based on the S-52 Specification for ECDIS Display. I created several styles using SLD for several key layers. The initial results look promising:

There are many complexities built into the rules of S-52, some Classes have several pages of Activity Diagrams that need to be translated into SLD.

Comments are most welcome.