OpenLayers.Format.GML.Base

Superclass for GML parsers.

Inherits from

Summary
OpenLayers.Format.GML.BaseSuperclass for GML parsers.
Properties
namespaces{Object} Mapping of namespace aliases to namespace URIs.
defaultPrefix
schemaLocation{String} Schema location for a particular minor version.
featureType{Array(String) or String} The local (without prefix) feature typeName(s).
featureNS{String} The feature namespace.
featurePrefix{String} Namespace alias (or prefix) for feature nodes.
geometry{String} Name of geometry element.
extractAttributes{Boolean} Extract attributes from GML.
srsName{String} URI for spatial reference system.
xy{Boolean} Order of the GML coordinate true:(x,y) or false:(y,x) Changing is not recommended, a new Format should be instantiated.
geometryTypes{Object} Maps OpenLayers geometry class names to GML element names.
singleFeatureType{Boolean} True if there is only 1 featureType, and not an array of featuretypes.
autoConfig{Boolean} Indicates if the format was configured without a featureNS, but auto-configured featureNS and featureType during read.
regExesCompiled regular expressions for manipulating strings.
Constructor
OpenLayers.Format.GML.BaseInstances of this class are not created directly.
Functions and Properties
read
readNodeShorthand for applying one of the named readers given the node namespace and local name.
readersContains public functions, grouped by namespace prefix, that will be applied when a namespaced node is found matching the function name.
write
writersAs a compliment to the readers property, this structure contains public writing functions grouped by namespace alias and named like the node names they produce.
setGeometryTypesSets the geometryTypes mapping.

Properties

namespaces

{Object} Mapping of namespace aliases to namespace URIs.

defaultPrefix

schemaLocation

{String} Schema location for a particular minor version.

featureType

{Array(String) or String} The local (without prefix) feature typeName(s).

featureNS

{String} The feature namespace.  Must be set in the options at construction.

featurePrefix

{String} Namespace alias (or prefix) for feature nodes.  Default is “feature”.

geometry

{String} Name of geometry element.  Defaults to “geometry”.  If null, it will be set on read when the first geometry is parsed.

extractAttributes

{Boolean} Extract attributes from GML.  Default is true.

srsName

{String} URI for spatial reference system.  This is optional for single part geometries and mandatory for collections and multis.  If set, the srsName attribute will be written for all geometries.  Default is null.

xy

{Boolean} Order of the GML coordinate true:(x,y) or false:(y,x) Changing is not recommended, a new Format should be instantiated.

geometryTypes

{Object} Maps OpenLayers geometry class names to GML element names.  Use setGeometryTypes before accessing this property.

singleFeatureType

{Boolean} True if there is only 1 featureType, and not an array of featuretypes.

autoConfig

{Boolean} Indicates if the format was configured without a featureNS, but auto-configured featureNS and featureType during read.  Subclasses making use of featureType auto-configuration should make the first call to the readNode method (usually in the read method) with true as 3rd argument, so the auto-configured featureType can be reset and the format can be reused for subsequent reads with data from different featureTypes.  Set to false after read if you want to keep the auto-configured values.

regExes

Compiled regular expressions for manipulating strings.

Constructor

OpenLayers.Format.GML.Base

Instances of this class are not created directly.  Use the OpenLayers.Format.GML.v2 or OpenLayers.Format.GML.v3 constructor instead.

Parameters

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

Valid options properties

featureType{Array(String) or String} Local (without prefix) feature typeName(s) (required for write).
featureNS{String} Feature namespace (required for write).
geometryName{String} Geometry element name (required for write).

Functions and Properties

read

read: function(data)

Parameters

data{DOMElement} A gml:featureMember element, a gml:featureMembers element, or an element containing either of the above at any level.

Returns

{Array(OpenLayers.Feature.Vector)} An array of features.

readNode

readNode: function(node,
obj,
first)

Shorthand for applying one of the named readers given the node namespace and local name.  Readers take two args (node, obj) and generally extend or modify the second.

Parameters

node{DOMElement} The node to be read (required).
obj{Object} The object to be modified (optional).
first{Boolean} Should be set to true for the first node read.  This is usually the readNode call in the read method.  Without this being set, auto-configured properties will stick on subsequent reads.

Returns

{Object} The input object, modified (or a new one if none was provided).

readers

Contains public functions, grouped by namespace prefix, that will be applied when a namespaced node is found matching the function name.  The function will be applied in the scope of this parser with two arguments: the node being read and a context object passed from the parent.

write

write: function(features)

Parameters

features{Array(OpenLayers.Feature.Vector) | OpenLayers.Feature.Vector} An array of features or a single feature.

Returns

{String} Given an array of features, a doc with a gml:featureMembers element will be returned.  Given a single feature, a doc with a gml:featureMember element will be returned.

writers

As a compliment to the readers property, this structure contains public writing functions grouped by namespace alias and named like the node names they produce.

setGeometryTypes

setGeometryTypes: function()

Sets the geometryTypes mapping.

{String} The feature namespace.
{Array(String) or String} The local (without prefix) feature typeName(s).
read: function(data)
readNode: function(node,
obj,
first)
Shorthand for applying one of the named readers given the node namespace and local name.
write: function(features)
setGeometryTypes: function()
Sets the geometryTypes mapping.
{Object} Maps OpenLayers geometry class names to GML element names.
Read and write XML.
Parses GML version 2.
Parses GML version 3.
Vector features use the OpenLayers.Geometry classes as geometry description.
Close