OpenLayers.Format.Context - OpenLayers

# OpenLayers.Format.Context

Base class for both Format.WMC and Format.OWSContext

#### Inherits from

- OpenLayers.Format.XML.VersionedOGC

Summary

OpenLayers.Format.Context | Base class for both Format.WMC and Format.OWSContext
Properties |
layerOptions | {Object} Default options for layers created by the parser.
layerParams | {Object} Default parameters for layers created by the parser.
Constructor |
OpenLayers.Format.Context | Create a new parser for Context documents.
Functions |
read | Read Context data from a string, and return an object with map properties and a list of layers.
getLayerFromContext | Create a WMS layer from a layerContext object.
getLayersFromContext | Create an array of layers from an array of layerContext objects.
contextToMap | Create a map given a context object.
mergeContextToMap | Add layers from a context object to a map.
write | Write a context document given a map.
Constants |
OpenLayers.Format.Context.serviceTypes | Enumeration for service types

### Properties

### 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 e.g. to override DEFAULT_PARAMS for OpenLayers.Layer.WMS.

### Constructor

### OpenLayers.Format.Context

Create a new parser for Context documents.

#### Parameters

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

### Functions

### read

> read: function( | data,
> | options | )

Read Context 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.

### 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 layers from an array of layerContext objects.

#### Parameters

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

#### Returns

{Array(OpenLayers.Layer)} An array of 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 context document given a map.

#### Parameters

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

#### Returns

{String} A context document string.

### Constants

### OpenLayers.Format.Context.serviceTypes

Enumeration for service types

> read: function( | data,
> | options | )

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

> getLayerFromContext: function( | layerContext | )

Create a WMS layer from a layerContext object.

> getLayersFromContext: function( | layersContext | )

Create an array of 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 context document given a map.
Base class for versioned formats, i.e.
Instances of OpenLayers.Map are interactive maps embedded in a web page.
Instances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services.
Close