OpenLayers.Format.WMC

Read and write Web Map Context documents.

Inherits from

Summary
OpenLayers.Format.WMCRead and write Web Map Context documents.
Properties
defaultVersion{String} Version number to assume if none found.
version{String} Specify a version string if one is known.
layerOptions{Object} Default options for layers created by the parser.
layerParams{Object} Default parameters for layers created by the parser.
parser{Object} Instance of the versioned parser.
Constructor
OpenLayers.Format.WMCCreate a new parser for WMC docs.
Functions
readRead WMC data from a string, and return an object with map properties and a list of layers.
contextToMapCreate a map given a context object.
mergeContextToMapAdd layers from a context object to a map.
writeWrite a WMC document given a map.
mapToContextCreate a context object given a map.

Properties

defaultVersion

{String} Version number to assume if none found.  Default is “1.1.0”.

version

{String} Specify a version string if one is known.

layerOptions

{Object} Default options for layers created by the parser.  These options are overridden by the options which are read from the capabilities document.

layerParams

{Object} Default parameters for layers created by the parser.  This can be used to override DEFAULT_PARAMS for OpenLayers.Layer.WMS.

parser

{Object} Instance of the versioned parser.  Cached for multiple read and write calls of the same version.

Constructor

OpenLayers.Format.WMC

Create a new parser for WMC docs.

Parameters

options{Object} An optional object whose properties will be set on this instance.

Functions

read

read: function(data,
options)

Read WMC data from a string, and return an object with map properties and a list of layers.

Parameters

data{String} or {DOMElement} data to read/parse.
options{Object} The options object must contain a map property.  If the map property is a string, it must be the id of a dom element where the new map will be placed.  If the map property is an OpenLayers.Map, the layers from the context document will be added to the map.

Returns

{OpenLayers.Map} A map based on the context.

contextToMap

contextToMap: function(context,
id)

Create a map given a context object.

Parameters

context{Object} The context object.
id{String | Element} The dom element or element id that will contain the map.

Returns

{OpenLayers.Map} A map based on the context object.

mergeContextToMap

mergeContextToMap: function(context,
map)

Add layers from a context object to a map.

Parameters

context{Object} The context object.
map{OpenLayers.Map} The map.

Returns

{OpenLayers.Map} The same map with layers added.

write

write: function(obj,
options)

Write a WMC document given a map.

Parameters

obj{OpenLayers.Map | Object} A map or context object.
options{Object} Optional configuration object.

Returns

{String} A WMC document string.

mapToContext

mapToContext: function(map)

Create a context object given a map.

Parameters

map{OpenLayers.Map} The map.

Returns

{Object} A context object.

read: function(data,
options)
Read WMC data from a string, and return an object with map properties and a list of layers.
contextToMap: function(context,
id)
Create a map given a context object.
mergeContextToMap: function(context,
map)
Add layers from a context object to a map.
write: function(obj,
options)
Write a WMC document given a map.
mapToContext: function(map)
Create a context object given a map.
Read and write XML.
Instances of OpenLayers.Map are interactive maps embedded in a web page.
Close