Skip to content

Latest commit

 

History

History
94 lines (73 loc) · 3.9 KB

readme.md

File metadata and controls

94 lines (73 loc) · 3.9 KB

MapboxGL Ocean Map

This is a collection of notes taken during the process of experimenting with MapboxGL, PBF Vector Tiles, and ENC data from NOAA.

Links

Steps

Data

At its core, it's about data. You'll need to be able to understand the data that you have and import it into your data store (ie PostGIS).

Links

Import the data:

Below is an example of importing only the SOUNDG layer (soundings) of a single S57 file.

export OGR_S57_OPTIONS="RETURN_PRIMITIVES=ON,RETURN_LINKAGES=ON,LNAM_REFS=ON,SPLIT_MULTIPOINT=ON,ADD_SOUNDG_DEPTH=ON"
ogr2ogr \
  -append \
  -nlt POINT25D \
  -f PostgreSQL PG:"dbname=s57 user=anthony" \
  US5WA70M.000 SOUNDG

About the options:

-update  # Open existing output datasource in update mode rather than trying to create a new one
-append  # Append to existing layer instead of creating new
-nlt type:
   Define the geometry type for the created layer. One of NONE, GEOMETRY, POINT, LINESTRING,
   POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON or MULTILINESTRING. Add '25D' to the name
   to get 2.5D versions.

Below is an example of iterating through a collection of files and importing just the SOUNDG layers.

export OGR_S57_OPTIONS="RETURN_PRIMITIVES=ON,RETURN_LINKAGES=ON,LNAM_REFS=ON,SPLIT_MULTIPOINT=ON,ADD_SOUNDG_DEPTH=ON"

find . -name "US*.000" -exec ogr2ogr -append -nlt POINT25D -f PostgreSQL PG:"dbname=s57 user=anthony" {} SOUNDG \;

Below is an example of importing an entire S57 file.

export OGR_S57_OPTIONS="RETURN_PRIMITIVES=ON,RETURN_LINKAGES=ON,LNAM_REFS=ON,SPLIT_MULTIPOINT=ON,ADD_SOUNDG_DEPTH=ON"

ogr2ogr -append -f PostgreSQL PG:"dbname=s57_2 user=anthony" US1HA02M.000 -skipfailures \;

Tying it all together, below is an example of searching recursively through a collection of S57 files and importing all layers into PostGIS.

export OGR_S57_OPTIONS="RETURN_PRIMITIVES=ON,RETURN_LINKAGES=ON,LNAM_REFS=ON,SPLIT_MULTIPOINT=ON,ADD_SOUNDG_DEPTH=ON"

find . -name "US*.000" -exec ogr2ogr -append -f PostgreSQL PG:"dbname=enc user=anthony" {} -skipfailures \;

Visualization

  1. Set up a basic page after reading this tutorial. index0.html
  2. How do you serve it? Implementations, node-mapnik, tutorial, mapnik vectortile api, vector-tile-server

Mapbox Studio

  1. Create an input layer: adding-layers, quick-start

    (
      SELECT
        depth,
        scamin,
        scamax,
        sorind,
        sordat,
        wkb_geometry
      FROM soundg
    ) as data
  2. Annotate data (see S-57 info, GDAL S-57)

  3. Build scale system. source

    scale = lambda x: 295829355.45 / (2**(x-1))
    for i in xrange(1, 23):
        rule = "[zoom>={zoom}][scamin>{scale}],"
        print rule.format(zoom=i, scale=scale(i))