< Queries

Export Plugins >

10. Annotation and Redlining

Imagine you want to draw some features (points, lines, polygons ...) in your map to show specific data and/or print it. The outline plugin is what you need.

It allows you to draw features and to annotate them with label texts.

It's also possible to use polygons shapes as a mask layer see "Mask mode". User can choose between mask or draw mode with radio buttons. See Section 10.2.1, “outline.ini” for more information.

Shapes colors and styles should be set with specific configuration in the mapfile (See Section 10.3, “Related Elements in Mapfile”).

The total area of the drawn polygons is displayed on the interface.

10.1. Client-side Configuration

10.1.1. outline.ini

Here are the options that can be set on the client:

  • multipleShapes: boolean, if true, the user is allowed to draw multiple shapes. That means that drawn features remain until browser session is closed. If false, will outline only one shape at a time, new feature simply erases / overrides currently drawn one. When he wants, the user can erase all the drawn feature by clicking on the "outline_clear" form button (default true).
  • labelMode: boolean, if true, user is asked to input a label text that is drawn to annotate drawn shape.
  • weightOutlinePoint: integer defining display order of the outline_point tool icon in toolbar (if not specified, default to 70). A negative weight disables the tool.
  • weightOutlineLine: see weightOutlinePoint (default to 71)
  • weightOutlineRectangle: see weightOutlinePoint (default to 72)
  • weightOutlinePoly: see weightOutlinePoint (default to 73)

10.2. Server-side Configuration

10.2.1. outline.ini

Here are the options that can be set on the server:

  • pointLayer: defines the name of the mapserver LAYER set in the mapfile to display points. If not set, the polygon layer is automatically used instead.
  • lineLayer: defines the name of the mapserver LAYER set in the mapfile to display lines.
  • polyLayer: defines the name of the mapserver LAYER set in the mapfile to display polygons. Note that rectangles are displayed as polygons.
  • maskColor: defines the RGB color of the mask. This color is used to fill the polygons outside's area. Drawn polys will appear as holes in a colored sheet, showing the map under. This parameter is optional and set by default to 255 255 255 (white).
  • areaFactor: defines an optional value for ratio by which the area is multiplied before it is returned to the client. For example, people can use it to convert square meters to square kilometers.

10.3. Related Elements in Mapfile

10.3.1. Layers

Specific layers must be set in the mapfile in order to draw the shapes:

LAYER
  NAME "cartoweb_point_outline"
  TYPE POINT
  ...
END

LAYER
  NAME "cartoweb_line_outline"
  TYPE LINE
  ...
END

LAYER
  NAME "cartoweb_polygon_outline"
  TYPE POLYGON
  ...
END

The point layer is optional as it can be replaced by polygon layer when missing.

Don't forget that layers names must be set in the server-side outline.ini file (See Section 10.2.1, “outline.ini”)

10.3.2. Labels

In case of using labels (i.e. labelMode set to true, see Section 10.1.1, “outline.ini”), a LABEL object is needed in the layers' class.

Example:

LAYER
  NAME "cartoweb_point_outline"
  TYPE POINT
  ...
  CLASS
    STYLE
      ...
    END
    LABEL
      FONT Vera
      TYPE truetype
      COLOR 51 51 51
      SIZE 10
    END
  END
END

You will find more examples looking in the test.map file in server_conf directory.

valid xhtml 1.0 valid css