OpenLayers.Format.GML - OpenLayers

# OpenLayers. Format.GML

Read/Wite GML. Create a new instance with the OpenLayers.Format.GML constructor. Supports the GML simple features profile.

#### Inherits from

- OpenLayers.Format

Summary

OpenLayers. Format.GML | Read/Wite GML.
Properties |
featureNS | {String} Namespace used for feature attributes.
featurePrefix | {String} Namespace alias (or prefix) for feature nodes.
featureName | {String} Element name for features.
layerName | {String} Name of data layer.
geometryName | {String} Name of geometry element.
collectionName | {String} Name of featureCollection element.
gmlns | {String} GML Namespace.
extractAttributes | {Boolean} Extract attributes from GML.
xy | {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x) Changing is not recommended, a new Format should be instantiated.
Constructor |
OpenLayers. Format.GML | Create a new parser for GML.
Functions and Properties |
read | Read data from a string, and return a list of features.
parseFeature | This function is the core of the GML parsing code in OpenLayers.
parseGeometry | Properties of this object are the functions that parse geometries based on their type.
parseGeometry. point | Given a GML node representing a point geometry, create an OpenLayers point geometry.
parseGeometry. multipoint | Given a GML node representing a multipoint geometry, create an OpenLayers multipoint geometry.
parseGeometry. linestring | Given a GML node representing a linestring geometry, create an OpenLayers linestring geometry.
parseGeometry. multilinestring | Given a GML node representing a multilinestring geometry, create an OpenLayers multilinestring geometry.
parseGeometry. polygon | Given a GML node representing a polygon geometry, create an OpenLayers polygon geometry.
parseGeometry. multipolygon | Given a GML node representing a multipolygon geometry, create an OpenLayers multipolygon geometry.
parseAttributes |
write | Generate a GML document string given a list of features.
createFeatureXML | Accept an OpenLayers.Feature.Vector, and build a GML node for it.
buildGeometryNode |
buildGeometry | Object containing methods to do the actual geometry node building based on geometry type.
buildGeometry. point | Given an OpenLayers point geometry, create a GML point.
buildGeometry. multipoint | Given an OpenLayers multipoint geometry, create a GML multipoint.
buildGeometry. linestring | Given an OpenLayers linestring geometry, create a GML linestring.
buildGeometry. multilinestring | Given an OpenLayers multilinestring geometry, create a GML multilinestring.
buildGeometry. linearring | Given an OpenLayers linearring geometry, create a GML linearring.
buildGeometry. polygon | Given an OpenLayers polygon geometry, create a GML polygon.
buildGeometry. multipolygon | Given an OpenLayers multipolygon geometry, create a GML multipolygon.
buildGeometry. bounds | Given an OpenLayers bounds, create a GML box.
buildCoordinates | builds the coordinates XmlNode

### Properties

### featureNS

{String} Namespace used for feature attributes. Default is “http://mapserver.gis.umn.edu/mapserver”.

### featurePrefix

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

### featureName

{String} Element name for features. Default is “featureMember”.

### layerName

{String} Name of data layer. Default is “features”.

### geometryName

{String} Name of geometry element. Defaults to “geometry”.

### collectionName

{String} Name of featureCollection element.

### gmlns

{String} GML Namespace.

### extractAttributes

{Boolean} Extract attributes from GML.

### xy

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

### Constructor

### OpenLayers. Format.GML

Create a new parser for GML.

#### Parameters

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

### Functions and Properties

### read

> read: function( | data | )

Read data from a string, and return a list of features.

#### Parameters

data | {String} or {DOMElement} data to read/parse.

#### Returns

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

### parseFeature

> parseFeature: function( | node | )

This function is the core of the GML parsing code in OpenLayers. It creates the geometries that are then attached to the returned feature, and calls parseAttributes() to get attribute data out.

#### Parameters

node | {DOMElement} A GML feature node.

### parseGeometry

Properties of this object are the functions that parse geometries based on their type.

### parseGeometry. point

Given a GML node representing a point geometry, create an OpenLayers point geometry.

#### Parameters

node | {DOMElement} A GML node.

#### Returns

{OpenLayers.Geometry.Point} A point geometry.

### parseGeometry. multipoint

Given a GML node representing a multipoint geometry, create an OpenLayers multipoint geometry.

#### Parameters

node | {DOMElement} A GML node.

#### Returns

{OpenLayers.Geometry.MultiPoint} A multipoint geometry.

### parseGeometry. linestring

Given a GML node representing a linestring geometry, create an OpenLayers linestring geometry.

#### Parameters

node | {DOMElement} A GML node.

#### Returns

{OpenLayers.Geometry.LineString} A linestring geometry.

### parseGeometry. multilinestring

Given a GML node representing a multilinestring geometry, create an OpenLayers multilinestring geometry.

#### Parameters

node | {DOMElement} A GML node.

#### Returns

{OpenLayers.Geometry.MultiLineString} A multilinestring geometry.

### parseGeometry. polygon

Given a GML node representing a polygon geometry, create an OpenLayers polygon geometry.

#### Parameters

node | {DOMElement} A GML node.

#### Returns

{OpenLayers.Geometry.Polygon} A polygon geometry.

### parseGeometry. multipolygon

Given a GML node representing a multipolygon geometry, create an OpenLayers multipolygon geometry.

#### Parameters

node | {DOMElement} A GML node.

#### Returns

{OpenLayers.Geometry.MultiPolygon} A multipolygon geometry.

### parseAttributes

> parseAttributes: function( | node | )

#### Parameters

node | {<DOMElement>}

#### Returns

{Object} An attributes object.

### write

> write: function( | features | )

Generate a GML document string given a list of features.

#### Parameters

features | {Array(OpenLayers.Feature.Vector)} List of features to serialize into a string.

#### Returns

{String} A string representing the GML document.

### createFeatureXML

> createFeatureXML: function( | feature | )

Accept an OpenLayers.Feature.Vector, and build a GML node for it.

#### Parameters

feature | {OpenLayers.Feature.Vector} The feature to be built as GML.

#### Returns

{DOMElement} A node reprensting the feature in GML.

### buildGeometryNode

> buildGeometryNode: function( | geometry | )

### buildGeometry

Object containing methods to do the actual geometry node building based on geometry type.

### buildGeometry. point

Given an OpenLayers point geometry, create a GML point.

#### Parameters

geometry | {OpenLayers.Geometry.Point} A point geometry.

#### Returns

{DOMElement} A GML point node.

### buildGeometry. multipoint

Given an OpenLayers multipoint geometry, create a GML multipoint.

#### Parameters

geometry | {OpenLayers.Geometry.MultiPoint} A multipoint geometry.

#### Returns

{DOMElement} A GML multipoint node.

### buildGeometry. linestring

Given an OpenLayers linestring geometry, create a GML linestring.

#### Parameters

geometry | {OpenLayers.Geometry.LineString} A linestring geometry.

#### Returns

{DOMElement} A GML linestring node.

### buildGeometry. multilinestring

Given an OpenLayers multilinestring geometry, create a GML multilinestring.

#### Parameters

geometry | {OpenLayers.Geometry.MultiLineString} A multilinestring geometry.

#### Returns

{DOMElement} A GML multilinestring node.

### buildGeometry. linearring

Given an OpenLayers linearring geometry, create a GML linearring.

#### Parameters

geometry | {OpenLayers.Geometry.LinearRing} A linearring geometry.

#### Returns

{DOMElement} A GML linearring node.

### buildGeometry. polygon

Given an OpenLayers polygon geometry, create a GML polygon.

#### Parameters

geometry | {OpenLayers.Geometry.Polygon} A polygon geometry.

#### Returns

{DOMElement} A GML polygon node.

### buildGeometry. multipolygon

Given an OpenLayers multipolygon geometry, create a GML multipolygon.

#### Parameters

geometry | {OpenLayers.Geometry.MultiPolygon} A multipolygon geometry.

#### Returns

{DOMElement} A GML multipolygon node.

### buildGeometry. bounds

Given an OpenLayers bounds, create a GML box.

#### Parameters

bounds | {<OpenLayers.Geometry.Bounds>} A bounds object.

#### Returns

{DOMElement} A GML box node.

### buildCoordinates

> buildCoordinatesNode: function( | geometry | )

builds the coordinates XmlNode

>     <gml:coordinates decimal="." cs="," ts=" ">...</gml:coordinates>

Parameters: geometry - {OpenLayers.Geometry}

#### Returns

{XmlNode} created xmlNode

> read: function( | data | )

Read data from a string, and return a list of features.

> parseFeature: function( | node | )

This function is the core of the GML parsing code in OpenLayers.

> parseAttributes: function( | node | )

> write: function( | features | )

Generate a GML document string given a list of features.

> createFeatureXML: function( | feature | )

Accept an OpenLayers.Feature.Vector, and build a GML node for it.

> buildGeometryNode: function( | geometry | )

> buildCoordinatesNode: function( | geometry | )

builds the coordinates XmlNode
Create a new parser for GML.
Base class for format reading/writing a variety of formats.
Vector features use the OpenLayers.Geometry classes as geometry description.
Point geometry class.
MultiPoint is a collection of Points.
A LineString is a Curve which, once two points have been added to it, can never be less than two points long.
A MultiLineString is a geometry with multiple OpenLayers.Geometry.LineString components.
Polygon is a collection of Geometry.LinearRings.
MultiPolygon is a geometry with multiple OpenLayers.Geometry.Polygon components.
A Linear Ring is a special LineString which is closed.
A Geometry is a description of a geographic object.
Close