I may have missed this in your explanation, but for the record MapServer can read and display S-57 data in its raw format, through the OGR library (CONNECTIONTYPE OGR)...meaning no conversion is necessary.

And a shameful plug: in our upcoming MapServer workshop at FOSS4G in Barcelona we will demonstrate this (http://2010.foss4g.org/workshop08.php). :)

-jeff


--
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




easyl wrote:
Since several months I was looking for an good example or tutorial for
rendering S-57 nautical charts on MapServer. After searching without any success I tried to build up my first map with
limit knowledge.

IMO, the most hardest part is how to render them with S-52 style standard.
(The project http://www.opencpn.org/ has done a really good work to render
nautical map in an application.)

Some resource:
http://home.gdal.org/projects/s57/index.html
http://grass.osgeo.org/wiki/S-57_data
http://www.s-57.com/

Here is a short description of what I have done.

1) Conver S-57 (*.000) files into shapefiles by using ogr2ogr.
An S-57 file is split into several shapefiles; Each shapefile contains single one layer of single geometry type.
    For example:
    src.000 ------ DEPARE ------> Area    (a shapefile)
                  +                  +--> Line     (a shapefile)
                  |
                  +-- (other layer)  .........................    (a
shapefile) Here is the ogr2ogr commands > ogr2ogr -skipfailure -append -f "ESRI Shapefile" output/DEPARE/A src.000 -nlt POLYGON DEPARE > ogr2ogr -skipfailure -append -f "ESRI Shapefile" output/DEPARE/L src.000 -nlt LINESTRING DEPARE
   The SOUNDG layer must be converted with special care.
  > export OGR_S57_OPTIONS="SPLIT_MULTIPOINT=ON,ADD_SOUNDG_DEPTH=ON"
  > ogr2ogr -skipfailure -append -f "ESRI Shapefile" output/SOUNDG/P src.000
-nlt POINT SOUNDG 2) Construct mapfile
  2.1) Generally there are (at least) two things to take care: scale and
layer priority.
S-57 data may have different scale value and overlap with each other. Moreover, a S-57 data may not have a rectangle extent.

For those reasons, I construct mapfile with the following manner: Sort layers after scale value, then layer priority.
         Group them if necessary.
         MAP
           LAYER
               // scale:       1:100,000
               // priority:    low
              CONNECTION "shapefile/100000/DEPARE/A/DEPARE.shp"
              DATA "DEPARE"
              GROUP "DEPARE"
           END

           LAYER
               // scale:       1:100,000
               // priority:    high
              CONNECTION "shapefile/100000/LIGHTS/P/LIGHTS.shp"
              DATA "LIGHTS"
              GROUP "LIGHTS"
           END

           LAYER
               // scale:       1:10,000
               // priority:    low
              CONNECTION "shapefile/10000/DEPARE/A/DEPARE.shp"
              DATA "DEPARE"
              GROUP "DEPARE"
           END

           LAYER
               // scale:       1:10,000
               // priority:    high
              CONNECTION "shapefile/10000/LIGHTS/P/LIGHTS.shp"
              DATA "LIGHTS"
              GROUP "LIGHTS"
           END
         END

2.2) apply style. It is the hardest part. Here I give abother two examples.

  LAYER
    NAME DEPARE_A_1500000_1
    GROUP "DEPARE"
    STATUS ON
    TYPE POLYGON
    CONNECTIONTYPE OGR
    CONNECTION "shapefile/1500000/DEPARE/A/DEPARE.shp"
    PROCESSING "CLOSE_CONNECTION=DEFER"
    PROCESSING "LABEL_NO_CLIP=ON"
    DATA "DEPARE"
    PROJECTION
      "proj=longlat"
      "ellps=WGS84"
      "datum=WGS84"
      "no_defs"
    END
    CLASSITEM DRVAL1
    CLASS
      EXPRESSION ([DRVAL1] < 3)
      STYLE
        COLOR 115 182 239
      END
    END
    CLASS
      EXPRESSION ([DRVAL1] >= 3 && [DRVAL1] < 8)
      STYLE
        COLOR 156 198 247
      END
    END
    CLASS
      EXPRESSION ([DRVAL1] >= 8)
      STYLE
        COLOR 214 235 239
      END
    END
  END


  LAYER
    NAME LIGHTS_P_1500_1
    GROUP "LIGHTS"
    STATUS ON
    TYPE POINT
    #MAXSCALEDENOM 1501
    CONNECTIONTYPE OGR
    CONNECTION "shapefile/1500/LIGHTS/P/LIGHTS.shp"
    PROCESSING "CLOSE_CONNECTION=DEFER"
    PROCESSING "LABEL_NO_CLIP=ON"
    DATA "LIGHTS"
    PROJECTION
      "proj=longlat"
      "ellps=WGS84"
      "datum=WGS84"
      "no_defs"
    END
    CLASSITEM COLOUR
    CLASS
      EXPRESSION ([COLOUR] == 3)
      STYLE
        COLOR 255 0 0
        SIZE [VALNMR]
        OPACITY 50
        OUTLINECOLOR 0 0 0
      END
    END
    CLASS
      EXPRESSION ([COLOUR] == 4)
      STYLE
        COLOR 0 255 0
        SIZE [VALNMR]
        OPACITY 50
        OUTLINECOLOR 0 0 0
      END
    END
    ...
  END

  Here is the result:
http://osgeo-org.1803224.n2.nabble.com/file/n5329589/s57MS.png http://osgeo-org.1803224.n2.nabble.com/file/n5329589/s57MS.PNG s57MS.PNG Of course, it needs still a lot of symbols, color encoding, customized
style after standards ....

I have wrote some script to automatically convert S-57 files and construct
mapfile (manually writing a mapfile for 100+ layers from 20+ S-57 files is
not practical...). If anyone has interest, I can share them or even make a
project to let everyone contribute.....

Now the task to be done is to encode every possible style in
mapfile............................:(

Any suggestion is welcome!




_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to