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.
getParserGet the WMC parser given a version.
getLayerFromContextCreate a WMS layer from a layerContext object.
getLayersFromContextCreate an array of WMS layers from an array of layerContext objects.
contextToMapCreate a map given a context object.
mergeContextToMapAdd layers from a context object to a map.
writeWrite a WMC document given a map.
layerToContextCreate a layer context object given a wms layer object.
toContextCreate a context object free from layer given a map or a context object.

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.  If the map property is an object, this will be considered as options to create the map with, in most cases, it would have a div property.

Returns

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

getParser

getParser: function(version)

Get the WMC parser given a version.  Create a new parser if it does not already exist.

Parameters

version{String} The version of the parser.

Returns

{OpenLayers.Format.WMC.v1} A WMC parser.

getLayerFromContext

getLayerFromContext: function(layerContext)

Create a WMS layer from a layerContext object.

Parameters

layerContext{Object} An object representing a WMS layer.

Returns

{OpenLayers.Layer.WMS} A WMS layer.

getLayersFromContext

getLayersFromContext: function(layersContext)

Create an array of WMS layers from an array of layerContext objects.

Parameters

layersContext{Array(Object)} An array of objects representing WMS layers.

Returns

{Array(OpenLayers.Layer.WMS)} An array of WMS layers.

contextToMap

contextToMap: function(context,
options)

Create a map given a context object.

Parameters

context{Object} The context object.
options{Object} Default map options.

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.

layerToContext

layerToContext: function(layer)

Create a layer context object given a wms layer object.

Parameters

obj{OpenLayers.Layer.WMS} The layer.

Returns

{Object} A layer context object.

toContext

toContext: function(obj)

Create a context object free from layer given a map or a context object.

Parameters

obj{OpenLayers.Map | Object} The map or context.

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.
getParser: function(version)
Get the WMC parser given a version.
getLayerFromContext: function(layerContext)
Create a WMS layer from a layerContext object.
getLayersFromContext: function(layersContext)
Create an array of WMS layers from an array of layerContext objects.
contextToMap: function(context,
options)
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.
layerToContext: function(layer)
Create a layer context object given a wms layer object.
toContext: function(obj)
Create a context object free from layer given a map or a context object.
Read and write XML.
Instances of OpenLayers.Map are interactive maps embedded in a web page.
Superclass for WMC version 1 parsers.
Instances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services.
Close