Home | Docs | Issue Tracker | FAQ | Download | |
Date: | 2009/03/01 |
---|---|
Authors: | Dvaid Kana (david.kana at gmail.com) |
Authors: | Thomas.Bonfort (thomas.bonfort at gmail.com) |
Authors: | Yewondwossen Assefa (yassefa at dmsolutions.ca) |
Authors: | Michael Smith (michael.smith at usace.army.mil) |
Status: | Planning |
Version: | MapServer 6.0 |
Id: | $ |
This purpose of this RFC is to provide a KML output for MapServer 6.0. The initial work was done by David Kana during the 2009 Google Summer of Code.
The main task of the project is the implementation of the KML driver for generating KML output used mainly by Google Earth application. Code for KML rendering is based on new renderer API described in MS RFC 54
First intention was to use original KML library libkml provided by Google but due to its complexity libxml2 already included in MapServer was selected for xml generating.
The general idea is to provide an output format that can be set at the map level and allows to generate a kml or kmz output from a MapServer map file. Output can be generated using MapServer cgi (example mode=map) or through a WMS request.
The default name of the output format is kml, and this name can be used to set the imagetype parameter in the map file.
The format can also be defined in the map file:
OUTPUTFORMAT
NAME kml
DRIVER "KML"
MIMETYPE "application/vnd.google-earth.kml+xml"
IMAGEMODE RGB
EXTENSION "kml"
FORMATOPTION 'ATTACHMENT=gmap75.kml' #name of kml file returned
END
kmz output will also be supported through the minizip library.
In terms for Kml object, the MapServer KML output will produce a <Document> element to include all the layers that are part of the MapServer map file. Features supported for the Document are:
Document element | Supported | MapServer equivalence/Notes |
---|---|---|
name | Yes | Name in the map file |
visibility | No | Can be supported if needed. Default is 1 |
open | No | Can be supported if needed. Default is 0 |
address | No | Could be supported for example using ows_address if available |
AdressDetails | No | |
phoneNumber | No | Could be supported using ows_contactvoicetelephone is available |
Snippet | No | |
description | No | |
AbstractView | No | |
TimePrimitive | No | |
styleURL | No | |
StyleSelector | Yes | Style element will be supported. All different styles from the layers will be stored here and referenced from the folders using a styleUrl.In addition to the Styles related to features, there is a ListStyle element added at the document level. This allows to control the way folders are presented.See Layers section (styleUrl) setting for more details. |
Region | No | |
Metadata | No | |
ExtendedData | No |
Each layer of the MapServer map file will be inside a Kml <Folder> element. Supported Folder elements are:
Folder element | Supported | MapServer equivalence/Notes |
---|---|---|
name | Yes | Name of the layer. If not available the name will be Layer concatenated with the layer’s index (Layer1) |
visibility | Yes | Always set to 1 |
open | No | Default is 0 |
atom:authoratom:linkaddressAddressDetailsphoneNumberSnippet | No | |
description | No | Could be supported using ows_description |
AbstarctView | No | |
TimePrimitive | No | |
styleUrl | Yes | The user can use the kml_folder_display layer or map level metedata to choose a setting. Possible values are ‘check’ (default), ‘radioFolder’, ‘checkOffOnly’, ‘checkHideChildren’. |
RegionMetadataExtendedData | No |
Each element in the Layer will be inside a Kml <Placemark> element. As described in the Kml reference : « A Placemark is a Feature with associated Geometry. In Google Earth, a Placemark appears as a list item in the Places panel. A Placemark with a Point has an icon associated with it that marks a point on the Earth in the 3D viewer. (In the Google Earth 3D viewer, a Point Placemark is the only object you can click or roll over. Other Geometry objects do not have an icon in the 3D viewer. To give the user something to click in the 3D viewer, you would need to create a MultiGeometry object that contains both a Point and the other Geometry object.) »
For Polygon and Line layers, when a feature is associated with a label, a MultiGeometry element containing a point geometry and the geometry of the feature is created. The point feature will be located in the middle of the polygon or line
<Folder>
<name>park</name>
<visibility>1</visibility>
<styleUrl>#LayerFolder_check</styleUrl>
<Placemark>
<name>Ellesmere Island National Park Reserve</name>
<styleUrl>#style_line_ff787878_w4.0_polygon_ff00ffc8_label_ff0000ff</styleUrl>
<MultiGeometry>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
…
<Point>
<coordinates>
-70.86810858,82.12291871
</coordinates>
</Point>
</MultiGeometry>
</Placemark>
</Folder>
Supported Features in the Placemark element are:
Palcemark element | Supported | MapServer equivalence/Notes |
name | Yes | Label attached with the feature. If there is no label a default name is assigned using the layer name and the shape id (ex. park.1) |
visibility | No | Is is by default set to true |
open | No | |
address | No | |
AddessDetails | No | |
phoneNumber | No | |
Snippet | No | This is a short description the feature. If needed It could be supported. |
description | Yes | This information is what appears in the description balloon when the user clicks on the feature. The <description> element supports plain text as well as a subset of HTML formatting elements.Two ways of defining the description: |
AbstractView | No | |
TimePrimitive | No | |
styleUrl | Yes | Refers to a Style defined in the Document |
StyleSelector | No | |
Region | No | |
Metadata | No | |
Geometry | Yes | Depends on the layer type |
Not supported yet.
Not supported yet.
As described in Section 4, all different styles from the layers will be stored at the Document level and referenced from the folders using a styleUrl.
Point layers will be styled using the IconStyle styling element of kml. An image representing the symbol will be created and referenced from the IconStyle object. If a label is attached to the point, a LabelStyle element will also be used. The LabelStyle will have the color parameter set.
<Style id="style_label_ff0000ff_symbol_star_13.0_ff000000">
<IconStyle>
<Icon>
<href>>http://localhost/ms_tmp/4beab862_19bc_0.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<color>ff0000ff</color>
</LabelStyle>
</Style>
Line layers will be styled using the LineStyle styling element of kml. Color and width parameters of the LineStyle will be used. If a label is attached to the layer, a LabelStyle element will also be used.
Polygon layers will be styled using the PolyStyle styling element of kml. Color parameter of the PolyStyle will be used. If an outline is defined in the map file, an addition LineStyle will be used. If a label is attached to the layer, a LabelStyle element will also be used.
As described in section on Layers, two ways of defining the description:
The map level projection should be set to epsg:4326. If not set, the driver will automatically set it. Layers are expected to have projection block if their projection is different from epsg:4326.
Development is done in mapserver svn (http://svn.osgeo.org/mapserver/trunk/mapserver/). It was initially in http://svn.osgeo.org/mapserver/sandbox/davidK/
Adopted 2010/04/08 on the condition that this RFC should be cleaned and upadted with more details. This allows to move the source code from the sand box to trunk