Logger Insight MapServer Configuration

In MapServer, two layers need to be configured in the .map file - one for the actual asset data and one to display symbols for the data that was originally POINT-based. This is in addition to the layer for the fault reports (which works as normal).

If all asset data were of one type then only one layer would be needed.

BRIGAssets & BRIGSymbols Layers
   LAYER
      NAME "BRIGAssets"
      DATA "Overlays\Logger\Highways\BRIG"
      METADATA
         qstring_validation_pattern "."
         "wms_title" "bridges"
      END
      STATUS OFF
      TYPE POLYGON
      UNITS METERS
      CLASSITEM "asset_type"
      CLASS
         EXPRESSION 'nsg'
         STYLE
            COLOR 80 80 80
         END
      END
      CLASS
         EXPRESSION 'bridges'
         STYLE
            COLOR 255 255 0
         END
      END
   END
   LAYER
      NAME "BRIGSymbols"
      DATA "Overlays\Logger\Highways\BRIG"
      METADATA
         qstring_validation_pattern "."
         "wms_title" "bridges"
      END
      REQUIRES "[BRIGAssets]"
      STATUS DEFAULT
      TYPE ANNOTATION
      UNITS METERS
      LABELITEM "symlink"
      CLASSITEM "asset_type"
      CLASS
         EXPRESSION 'bridges'
         MAXSCALE 10000
         STYLE
            SYMBOL "square"
            COLOR 255 255 0
            OUTLINECOLOR 0 0 0
            SIZE 12
         END
         LABEL
            FONT "sans"
         END
         TEXT " "
      END
      CLASS
         EXPRESSION 'bridges'
         MAXSCALE 25000
         MINSCALE 10000
         STYLE
            SYMBOL "square"
            COLOR 255 255 32
            OUTLINECOLOR 16 16 0
            SIZE 8
         END
         LABEL
            FONT "sans"
         END
         TEXT " "
      END
      CLASS
         EXPRESSION 'bridges'
         MINSCALE 25000
         STYLE
            SYMBOL "square"
            COLOR 255 255 64
            OUTLINECOLOR 32 32 0
            SIZE 4
         END
         LABEL
            FONT "sans"
         END
         TEXT " "
      END
   END

The Assets Layer

NAME "BRIGAssets"
DATA "Overlays\Logger\Highways\BRIG"
METADATA
         qstring_validation_pattern "."
         "wms_title" "bridges"
END
STATUS OFF
TYPE POLYGON
UNITS METERS

 

This is the layer used for line and polygon display [BRIG.shp] as well as for data queries. This is standard layer configuration - note the TYPE is POLYGON.

CLASSITEM "asset_type"

This tells MapServer to filter on the asset_type field.

 

CLASS
     EXPRESSION 'nsg'
     STYLE
          COLOR 80 80 80
     END
END

 This styles the nsg assets (these will be very thin grey polygons). A similar configuration is done for the bridges assets. The bridges features will be hidden by the following 'symbols' layer.

The Symbols Layer

This is essentially the same as a normal POINT layer with the following alterations:

 

REQUIRES "[BRIGAssets]"
STATUS DEFAULT

Setting the STATUS to DEFAULT would normally mean the layer is on all the time but having a REQUIRES setting means the layer can only be enabled when the specified layer is also enabled (in this case BRIGAssets). The two work together to make sure both layers are always displayed together.

 

TYPE ANNOTATION
LABELITEM "symlink"

MapServer can create a layer dedicated to symbology - labels and symbols. The centroid of the polygon will be used (which is ideal, since that will be exactly the location of the original POINT). Thesymlink field is specified here (even though its values won't be used in this case) as one is required in order for labels to be drawn.

 

CLASSITEM "asset_type"
      ...
EXPRESSION 'bridges'

Here the data is being filtered again, so the CLASS directives only set symbols on the features to be treated as point data.

 

CLASS
         STYLE
                 SYMBOL "square"
                 COLOR 255 255 64
                 OUTLINECOLOR 32 32 0
                 SIZE 4
         END
         LABEL
                 FONT "sans"
         END
         TEXT " "
END

The symbols are defined here by setting the symbol style (small yellow squares) and label text. In this particular instance no label text is required so the label field value is overridden through use of aTEXT object with a space character as its value. If an empty string were to be specified then the symbol would not be drawn - this is also true when TEXT is not used and the LABELITEM field's value is empty.