ENC Geopackage maps in QGis Final version: part two

The project to integrate ENC maps into QGis in the form of Geopackage is now complete. This article completes the two previously published articles on ENC symbology in the Geopackage database.

Adding symbology to Geopackage

The default symbology of a geopackage’s tables is contained in a table named layer_styles, which is only created if you use the save default option of the style button.

After cloning the tables in the ENC file, the table does not exist. So we’re going to import the table containing all ENC map symbology.

Please note: the layer_styles table is a system table, unlike the natsurf table, which is a simple data table. Unlike data tables, system tables do not appear in the explorer panel. You need to use the QGis Database Manager (Database menu -> DB Manager) to view and manipulate system tables like layer_styles. Natsurf, on the other hand, can be viewed and manipulated like any other data layer.

Download layer_natsurfV3.gpkg

This geopackage contains a table, named layer_styles, with symbology definitions for 153 S57 tables, as well as a table named natsurf, which will be used to format the rendering of the “nature of seabed” table (SBDARE).

To integrate these tables into your ENC file (here ENC.gpkg):

  • Open the database manager in QGis.
  • You should already have the geopackage->ENC.gpkg connection. If not, right-click on ‘Geopackage’->new connection, then point to your ENC.gpkg file.
  • Connect to the downloaded layers_natsurf.gpkg table (right-click on ‘Geopackage’->new connection, then point to the downloaded geopackage)
  • Select layer_styles in layers_natsurf.gpkg, then right-click->add to canvas, and you’ll have the layer_styles table in the list of loaded layers.
  • Select natsurf in layers_natsurf.gpkg, then right-click->add to canvas, and you’ll have the natsurf table in the list of loaded layers.
  • Select the ENC.gpkg geopackage in the database manager.
  • In the Table menu, select Import layer/file.
  • In the list of layers, select natsurf, then OK
  • Repeat the operation for the layer_styles layer.

The current version of layer_styles contains symbology layouts for 153 layers. Check regularly for updates available for download.

This symbology uses svg symbols that you need to download to your machine. Clicking here will download a ‘nauticalV3’ file containing all the necessary svg symbols, as well as a directory named ‘XML’ with additional symbols for QGis.

To install the nautical directory, please refer to the article Creating a Geopackage database for ENC maps (part 2: adding symbology).

The layer_styles table contains the symbology of 153 layers, the usual layers for ENC files. However, there can be up to 210 possible layers. If, in your case, the layer_styles table does not contain one or more layers from your project, please refer to the article Updating(2) : ENC symbology with Geopackage under QGis for adding these missing symbologies from the .qml style files for all layers (V1, V2 and V3), which can be downloaded here.

Symbologies that change with this new version

The qml files contained in the qmlV3 directory are adapted to the updated processing chain, which not only retrieves primitives and assigns POSACC and QUAPOS values to the various S57 layers, but also to certain symbologies that have been specified. If you start with the V3 processing chain, you don’t need to do anything to set up these symbologies. They are defined by default in layer_stylesV3. If you’re migrating from a Geopackage V2 base to V3, please refer to the article Update(2) : Symbologie ENC avec Geopackage sous QGis for the addition of these missing symbologies from the .qml style files of all layers (V1, V2 and V3).

Soundg (bathymetric probes)

The following table shows the V3 symbology of the SOUNDG layer and the attribute values used to format it.

SymboleQUASOUQUAPOSLabel
1Sounding in true position
Sonde dans sa position vraie
5No bottom found at depth shown
Pas de fond trouvé à la profondeur indiquée
44Soundings which are unreliable or taken from smaller scale
source
Sondes qui sont nonfiables ou provenant de sources à plus
petite échelle
1 (DEPTH<0)Drying heights above chart datum
Sondes découvrantes audessus du zéro des cartes
3Sounding doubtful
Sonde douteuse
98Reported, but not confirmed sounding or danger
Sonde ou danger signalé mais non confirmé

Obstrn (Obstructions)

The following table shows the V3 symbology of the OBSTRN (points) layer and the attribute values used to format it.

SymboleQUASOUTECSOULabel
2Obstruction, depth unknown
Obstruction de profondeur inconnue
1 or 6Obstruction, least depth known by sounding only
Obstruction, profondeur moindre connue, a été déterminé
seulement par sondage
66Obstruction, least depth known, swept by wire drag or diver
Obstruction, profondeur moindre connue, vérifiée à la
drague hydrographique ou par plongeur

UWTROC (submerged / exposed rock)

The following table shows the V3 symbology of the UWTROC layer and the attribute values used to format it.

SymboleWATLEVQUASOULabel
42Rock which covers and uncovers, with height
unknown above chart datum
Roche qui couvre et découvre, avec cote audessus du zéro
des cartes inconnue
4!=2Rock which covers and uncovers, with height known above chart datum
Roche qui couvre et découvre, avec cote audessus du zéro
des cartes connue
5Rock awash at chart datum
Roche à fleur d’eau au zéro des cartes
32Underwater rock of unknown depth, dangerous to surface
navigation
Roche submergée de profondeur inconnue, présentant un
danger à la navigation de surface
3!=2Underwater rock of known depth
Roche submergée, de profondeur connue

Wrecks

The following table shows the V3 symbology of the WRECKS layer and the attribute values used to format it.

SymboleCATWRKWATLEVQUASOUTECSOULabel
5Wreck showing any portion of hull or superstructure at level
of chart datum
Épave montrant une portion de la coque ou superstructure
au niveau du zéro des cartes
4Wreck of which only the mast or masts are visible at chart
datum
Épave dont seul(s) le(s) mât(s) est (sont) visible(s) au niveau
du zero des cartes
31 or 6Wreck, least depth known by sounding only
Épave, la profondeur connue a été déterminé seulement par
sondage
31 or 64Wreck, least depth known, swept by wire drag or diver
Épave, profondeur moindre connue vérifiée à la drague
hydrographique ou par plongeur
232Wreck, least depth unknown, considered to be potentially
dangerous to some surface vessels
Épave de brassiage inconnu, constituant un danger
potentiel pour certains bâtiments de surface.
132Wreck, least depth unknown
Caution: On many charts, this symbol is used for wrecks of
unknown least depth, but considered to be covered by more
than 20m of water. The wrecks thus represented are then
potentially dangerous to vessels with a draught greater than
20m. Note: This symbol is also used for all wrecks in water
over 200m deep.
Épave de brassiage inconnu
Avertissement important : sur de nombreuses cartes, ce
symbole est utilisé pour les épaves de brassiage inconnu,
supposées couvertes de plus de 20 mètres d’eau. Les
épaves ainsi représentées sont alors potentiellement
dangereuses pour les navires d’un tirant d’eau supérieur à
20 mètres. Note : ce symbole est aussi utilisé pour toutes
les épaves dans des fonds supérieurs à 200m
37Wreck, least depth unknown, but considered to have a safe
clearance to depth shown
Épave, profondeur moindre inconnue, mais avec estimation
du plafond de brassiage à la profondeur indiquée
3Remains of a wreck or other foul ground, non dangerous to
navigation but to be avoided by vessels anchoring, trawling etc.
Vestige d’une épave ou autre sol de fonds malsains, non dangereux
pour la navigation mais qui constituent un danger pour le mouillage,
le chalutage, etc.

DEPCNT (Bathymetric contours)

The new version of the symbology takes into account data quality (approximate isobaths).

SymboleVALDCOQUAPOSLabel
>=0Isobathes
Depth contours
<0Isobathe découvrante
Drying contour
4 ou 5Isobathes approchées
Approximate depth
contours

COALNE (coastline)

A new category has been added: Unsurveyed when the QUAPOS attribute is 4 or 5. It is symbolized by a dashed line

LNDELV (contour lines)

Like isobaths, contour lines are now symbolized with a dashed line when the QUAPOS value is 4 or 5.

LNDMRK, SEAARE,UWTROC , LNDELV, OBSTRN, WRECKS(Point type)

The labels for the depth or elevation values of these layers take the QUAPOS value into account. They now have a PA (Approximate Position) prefix when QUAPOS has a value of 4 and a PD (Doubtful Position) prefix when QUAPOS has a value of 5.

SBDARE (nature of seabed)

The new symbology requires some special work. In earlier versions, we had set up a symbology that used the natsurf table to format the labels required for background types. The whole process was managed at the level of the label generation expression. While this solution was viable for a small number of maps in the database, the calculation times required for larger numbers became prohibitive.
For this final version, we opted for the implementation of a python script that generates a “Label” attribute in the SBDARE table. This attribute is used as a label and enables almost instantaneous display of the layer.

Load the pt_SBDARE layer and the natsurf table into your project.

Create the Label attribute in the pt_SBDARE table:

Open the attribute table -> Field calculator

Name the Label field, of type Text, and enter a default value of ”.

In the python console, load the Label_sbdare.py script, which you can download here.

Once executed, you’ll get the labels in the table’s Label attribute:

LIGHTS

The symbology of lights has been enriched. Three types of lights are now symbolized

  • Sector lights

  • Directional lights

  • Main and secondary lights

For this last category, two types of representation are available

  • ECDIS type with colored circles

  • Paper map with colored symbols

The qmlV3 directory contains two symbology files for the Lights layer

  • pt_lightsPoint.qml
  • pt_lightsMultipoint.qml

The Lights table resulting from the V1 and V2 import process is of type Point. However, in order to retrieve primitives, modifications to the ogr2ogr command produce a Multipoint Lights layer. By default, the symbology of the layer_styles V3 table is Multipoint.

If you are working with a base with the Points type table, you can load the corresponding symbology and save it as the default symbology in layer_styles.

Both symbologies have been corrected by an angular deviation compared to previous versions. Working with layers in geographic coordinates means that latitudinal and longitudinal distances are not of a constant ratio. If a delta X and a delta Y have the same length on the equator, the further away you are from the equator, the more the delta X decreases in relation to the delta Y. To draw the lines of the sectors starting from the fire, we create a point at the same distance X and Y in the direction of the sector. To ensure that the resulting angle is that of the sector, apply a correction by multiplying by the tangent of the point’s latitude. The actual angles displayed in previous versions deviated by up to 10° from the value of the SECTR1 and SECTR2 attributes. The tangent(Latitude) correction is an approximation that reduces this deviation to around 1°.

Si cet article vous a intéressé et que vous pensez qu'il pourrait bénéficier à d'autres personnes, n'hésitez pas à le partager sur vos réseaux sociaux en utilisant les boutons ci-dessous. Votre partage est apprécié !

Leave a Reply

Your email address will not be published. Required fields are marked *