Abstract class for for v1.0.0 and v1.1.0 protocol.
OpenLayers. | Abstract class for for v1.0.0 and v1.1.0 protocol. |
Properties | |
version | {String} WFS version number. |
srsName | {String} Name of spatial reference system. |
featureType | {String} Local feature typeName. |
featureNS | {String} Feature namespace. |
geometryName | {String} Name of the geometry attribute for features. |
schema | {String} Optional schema location that will be included in the schemaLocation attribute value. |
featurePrefix | {String} Namespace alias for feature type. |
formatOptions | {Object} Optional options for the format. |
readFormat | {OpenLayers.Format} For WFS requests it is possible to get a different output format than GML. |
readOptions | {Object} Optional object to pass to format’s read. |
Constructor | |
OpenLayers. | A class for giving layers WFS protocol. |
Functions | |
destroy | Clean up the protocol. |
read | Construct a request for reading new features. |
setFeatureType | Change the feature type on the fly. |
setGeometryName | Sets the geometryName option after instantiation. |
handleRead | Deal with response from the read request. |
parseResponse | Read HTTP response body and return features |
commit | Given a list of feature, assemble a batch request for update, create, and delete transactions. |
handleCommit | Called when the commit request returns. |
filterDelete | Send a request that deletes all features by their filter. |
abort | Abort an ongoing request, the response object passed to this method must come from this protocol (as a result of a read, or commit operation). |
{String} Name of the geometry attribute for features. Default is “the_geom” for WFS version 1.0, and null for higher versions.
{String} Optional schema location that will be included in the schemaLocation attribute value. Note that the feature type schema is required for a strict XML validator (on transactions with an insert for example), but is not required by the WFS specification (since the server is supposed to know about feature type schemas).
{OpenLayers.Format} For WFS requests it is possible to get a different output format than GML. In that case, we cannot parse the response with the default format (WFST) and we need a different format for reading.
A class for giving layers WFS protocol.
options | {Object} Optional object whose properties will be set on the instance. |
url | {String} URL to send requests to (required). |
featureType | {String} Local (without prefix) feature typeName (required). |
featureNS | {String} Feature namespace (required, but can be autodetected during the first query if GML is used as readFormat and featurePrefix is provided and matches the prefix used by the server for this featureType). |
featurePrefix | {String} Feature namespace alias (optional - only used for writing if featureNS is provided). Default is ‘feature’. |
geometryName | {String} Name of geometry attribute. The default is ‘the_geom’ for WFS version 1.0, and null for higher versions. If null, it will be set to the name of the first geometry found in the first read operation. |
multi | {Boolean} If set to true, geometries will be casted to Multi geometries before they are written in a transaction. No casting will be done when reading features. |
read: function( options )
Construct a request for reading new features. Since WFS splits the basic CRUD operations into GetFeature requests (for read) and Transactions (for all others), this method does not make use of the format’s read method (that is only about reading transaction responses).
options | {Object} Options for the read operation, in addition to the options set on the instance (options set here will take precedence). |
To use a configured protocol to get e.g. a WFS hit count, applications could do the following:
protocol.read({ readOptions: {output: "object"}, resultType: "hits", maxFeatures: null, callback: function(resp) { // process resp.numberOfFeatures here } });
To use a configured protocol to use WFS paging (if supported by the server), applications could do the following:
protocol.read({ startIndex: 0, count: 50 });
To limit the attributes returned by the GetFeature request, applications can use the propertyNames option to specify the properties to include in the response:
protocol.read({ propertyNames: ["DURATION", "INTENSITY"] });
handleRead: function( response, options )
Deal with response from the read request.
response | {OpenLayers.Protocol.Response} The response object to pass to the user callback. |
options | {Object} The user options passed to the read call. |
parseResponse: function( request, options )
Read HTTP response body and return features
request | {XMLHttpRequest} The request object |
options | {Object} Optional object to pass to format’s read |
{Object} or {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} An object with a features property, an array of features or a single feature.
commit: function( features, options )
Given a list of feature, assemble a batch request for update, create, and delete transactions. A commit call on the prototype amounts to writing a WFS transaction - so the write method on the format is used.
features | {Array(OpenLayers.Feature.Vector)} |
options | {Object} |
nativeElements | {Array({Object})} Array of objects with information for writing out <Native> elements, these objects have vendorId, safeToIgnore and value properties. The <Native> element is intended to allow access to vendor specific capabilities of any particular web feature server or datastore. |
{OpenLayers.Protocol.Response} A response object with a features property containing any insertIds and a priv property referencing the XMLHttpRequest object.
handleCommit: function( response, options )
Called when the commit request returns.
response | {OpenLayers.Protocol.Response} The response object to pass to the user callback. |
options | {Object} The user options passed to the commit call. |
filterDelete: function( filter, options )
Send a request that deletes all features by their filter.
filter | {OpenLayers.Filter} filter |
abort: function( response )
Abort an ongoing request, the response object passed to this method must come from this protocol (as a result of a read, or commit operation).
response | {OpenLayers.Protocol.Response} |
Clean up the protocol.
destroy: function()
Construct a request for reading new features.
read: function( options )
Change the feature type on the fly.
setFeatureType: function( featureType )
Sets the geometryName option after instantiation.
setGeometryName: function( geometryName )
Deal with response from the read request.
handleRead: function( response, options )
Read HTTP response body and return features
parseResponse: function( request, options )
Given a list of feature, assemble a batch request for update, create, and delete transactions.
commit: function( features, options )
Called when the commit request returns.
handleCommit: function( response, options )
Send a request that deletes all features by their filter.
filterDelete: function( filter, options )
Abort an ongoing request, the response object passed to this method must come from this protocol (as a result of a read, or commit operation).
abort: function( response )