|
|
|
@@ -3,6 +3,7 @@
|
|
|
|
|
*/
|
|
|
|
|
import GML2 from './GML2.js';
|
|
|
|
|
import GML3 from './GML3.js';
|
|
|
|
|
import GML32 from './GML32.js';
|
|
|
|
|
import GMLBase, {GMLNS} from './GMLBase.js';
|
|
|
|
|
import XMLFeature from './XMLFeature.js';
|
|
|
|
|
import {
|
|
|
|
@@ -39,6 +40,9 @@ const FEATURE_COLLECTION_PARSERS = {
|
|
|
|
|
'bounds'
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/wfs/2.0': {
|
|
|
|
|
'member': makeArrayPusher(GMLBase.prototype.readFeaturesInternal),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -51,6 +55,11 @@ const TRANSACTION_SUMMARY_PARSERS = {
|
|
|
|
|
'totalUpdated': makeObjectPropertySetter(readNonNegativeInteger),
|
|
|
|
|
'totalDeleted': makeObjectPropertySetter(readNonNegativeInteger),
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/wfs/2.0': {
|
|
|
|
|
'totalInserted': makeObjectPropertySetter(readNonNegativeInteger),
|
|
|
|
|
'totalUpdated': makeObjectPropertySetter(readNonNegativeInteger),
|
|
|
|
|
'totalDeleted': makeObjectPropertySetter(readNonNegativeInteger),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -65,6 +74,13 @@ const TRANSACTION_RESPONSE_PARSERS = {
|
|
|
|
|
),
|
|
|
|
|
'InsertResults': makeObjectPropertySetter(readInsertResults, 'insertIds'),
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/wfs/2.0': {
|
|
|
|
|
'TransactionSummary': makeObjectPropertySetter(
|
|
|
|
|
readTransactionSummary,
|
|
|
|
|
'transactionSummary'
|
|
|
|
|
),
|
|
|
|
|
'InsertResults': makeObjectPropertySetter(readInsertResults, 'insertIds'),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -74,6 +90,9 @@ const QUERY_SERIALIZERS = {
|
|
|
|
|
'http://www.opengis.net/wfs': {
|
|
|
|
|
'PropertyName': makeChildAppender(writeStringTextNode),
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/wfs/2.0': {
|
|
|
|
|
'PropertyName': makeChildAppender(writeStringTextNode),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -87,14 +106,23 @@ const TRANSACTION_SERIALIZERS = {
|
|
|
|
|
'Property': makeChildAppender(writeProperty),
|
|
|
|
|
'Native': makeChildAppender(writeNative),
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/wfs/2.0': {
|
|
|
|
|
'Insert': makeChildAppender(writeFeature),
|
|
|
|
|
'Update': makeChildAppender(writeUpdate),
|
|
|
|
|
'Delete': makeChildAppender(writeDelete),
|
|
|
|
|
'Property': makeChildAppender(writeProperty),
|
|
|
|
|
'Native': makeChildAppender(writeNative),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @typedef {Object} Options
|
|
|
|
|
* @property {Object<string, string>|string} [featureNS] The namespace URI used for features.
|
|
|
|
|
* @property {Array<string>|string} [featureType] The feature type to parse. Only used for read operations.
|
|
|
|
|
* @property {GMLBase} [gmlFormat] The GML format to use to parse the response. Default is `ol/format/GML3`.
|
|
|
|
|
* @property {GMLBase} [gmlFormat] The GML format to use to parse the response.
|
|
|
|
|
* Default is `ol/format/GML2` for WFS 1.0.0, `ol/format/GML3` for WFS 1.1.0 and `ol/format/GML32` for WFS 2.0.0.
|
|
|
|
|
* @property {string} [schemaLocation] Optional schemaLocation to use for serialization, this will override the default.
|
|
|
|
|
* @property {string} [version='1.1.0'] WFS version to use. Can be either `1.0.0`, `1.1.0` or `2.0.0`.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -134,7 +162,7 @@ const TRANSACTION_SERIALIZERS = {
|
|
|
|
|
* a 3D layer. This will allow the Z coordinate to be included in the transaction.
|
|
|
|
|
* @property {Array<Object>} nativeElements Native elements. Currently not supported.
|
|
|
|
|
* @property {import("./GMLBase.js").Options} [gmlOptions] GML options for the WFS transaction writer.
|
|
|
|
|
* @property {string} [version='1.1.0'] WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`.
|
|
|
|
|
* @property {string} [version='1.1.0'] WFS version to use for the transaction. Can be either `1.0.0`, `1.1.0` or `2.0.0`.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -164,30 +192,53 @@ const FEATURE_PREFIX = 'feature';
|
|
|
|
|
const XMLNS = 'http://www.w3.org/2000/xmlns/';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {string}
|
|
|
|
|
* @type {Object<string, string>}
|
|
|
|
|
*/
|
|
|
|
|
const OGCNS = 'http://www.opengis.net/ogc';
|
|
|
|
|
const OGCNS = {
|
|
|
|
|
'2.0.0': 'http://www.opengis.net/ogc/1.1',
|
|
|
|
|
'1.1.0': 'http://www.opengis.net/ogc',
|
|
|
|
|
'1.0.0': 'http://www.opengis.net/ogc',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {string}
|
|
|
|
|
* @type {Object<string, string>}
|
|
|
|
|
*/
|
|
|
|
|
const WFSNS = 'http://www.opengis.net/wfs';
|
|
|
|
|
const WFSNS = {
|
|
|
|
|
'2.0.0': 'http://www.opengis.net/wfs/2.0',
|
|
|
|
|
'1.1.0': 'http://www.opengis.net/wfs',
|
|
|
|
|
'1.0.0': 'http://www.opengis.net/wfs',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {string}
|
|
|
|
|
* @type {Object<string, string>}
|
|
|
|
|
*/
|
|
|
|
|
const FESNS = 'http://www.opengis.net/fes';
|
|
|
|
|
const FESNS = {
|
|
|
|
|
'2.0.0': 'http://www.opengis.net/fes/2.0',
|
|
|
|
|
'1.1.0': 'http://www.opengis.net/fes',
|
|
|
|
|
'1.0.0': 'http://www.opengis.net/fes',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {Object<string, string>}
|
|
|
|
|
*/
|
|
|
|
|
const SCHEMA_LOCATIONS = {
|
|
|
|
|
'2.0.0':
|
|
|
|
|
'http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd',
|
|
|
|
|
'1.1.0':
|
|
|
|
|
'http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd',
|
|
|
|
|
'1.0.0':
|
|
|
|
|
'http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {Object<string, object>}
|
|
|
|
|
*/
|
|
|
|
|
const GML_FORMATS = {
|
|
|
|
|
'2.0.0': GML32,
|
|
|
|
|
'1.1.0': GML3,
|
|
|
|
|
'1.0.0': GML2,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @const
|
|
|
|
|
* @type {string}
|
|
|
|
@@ -198,7 +249,7 @@ const DEFAULT_VERSION = '1.1.0';
|
|
|
|
|
* @classdesc
|
|
|
|
|
* Feature format for reading and writing data in the WFS format.
|
|
|
|
|
* By default, supports WFS version 1.1.0. You can pass a GML format
|
|
|
|
|
* as option if you want to read a WFS that contains GML2 (WFS 1.0.0).
|
|
|
|
|
* as option to override the default.
|
|
|
|
|
* Also see {@link module:ol/format/GMLBase~GMLBase} which is used by this format.
|
|
|
|
|
*
|
|
|
|
|
* @api
|
|
|
|
@@ -212,6 +263,12 @@ class WFS extends XMLFeature {
|
|
|
|
|
|
|
|
|
|
const options = opt_options ? opt_options : {};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @private
|
|
|
|
|
* @type {string}
|
|
|
|
|
*/
|
|
|
|
|
this.version_ = options.version ? options.version : DEFAULT_VERSION;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @private
|
|
|
|
|
* @type {Array<string>|string|undefined}
|
|
|
|
@@ -228,7 +285,9 @@ class WFS extends XMLFeature {
|
|
|
|
|
* @private
|
|
|
|
|
* @type {GMLBase}
|
|
|
|
|
*/
|
|
|
|
|
this.gmlFormat_ = options.gmlFormat ? options.gmlFormat : new GML3();
|
|
|
|
|
this.gmlFormat_ = options.gmlFormat
|
|
|
|
|
? options.gmlFormat
|
|
|
|
|
: new GML_FORMATS[this.version_]();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @private
|
|
|
|
@@ -236,7 +295,7 @@ class WFS extends XMLFeature {
|
|
|
|
|
*/
|
|
|
|
|
this.schemaLocation_ = options.schemaLocation
|
|
|
|
|
? options.schemaLocation
|
|
|
|
|
: SCHEMA_LOCATIONS[DEFAULT_VERSION];
|
|
|
|
|
: SCHEMA_LOCATIONS[this.version_];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -262,7 +321,7 @@ class WFS extends XMLFeature {
|
|
|
|
|
readFeaturesFromNode(node, opt_options) {
|
|
|
|
|
/** @type {import("../xml.js").NodeStackItem} */
|
|
|
|
|
const context = {
|
|
|
|
|
node: node,
|
|
|
|
|
node,
|
|
|
|
|
};
|
|
|
|
|
assign(context, {
|
|
|
|
|
'featureType': this.featureType_,
|
|
|
|
@@ -271,12 +330,15 @@ class WFS extends XMLFeature {
|
|
|
|
|
|
|
|
|
|
assign(context, this.getReadOptions(node, opt_options ? opt_options : {}));
|
|
|
|
|
const objectStack = [context];
|
|
|
|
|
this.gmlFormat_.FEATURE_COLLECTION_PARSERS[GMLNS][
|
|
|
|
|
'featureMember'
|
|
|
|
|
] = makeArrayPusher(GMLBase.prototype.readFeaturesInternal);
|
|
|
|
|
let featuresNS;
|
|
|
|
|
if (this.version_ === '2.0.0') {
|
|
|
|
|
featuresNS = FEATURE_COLLECTION_PARSERS;
|
|
|
|
|
} else {
|
|
|
|
|
featuresNS = this.gmlFormat_.FEATURE_COLLECTION_PARSERS;
|
|
|
|
|
}
|
|
|
|
|
let features = pushParseAndPop(
|
|
|
|
|
[],
|
|
|
|
|
this.gmlFormat_.FEATURE_COLLECTION_PARSERS,
|
|
|
|
|
featuresNS,
|
|
|
|
|
node,
|
|
|
|
|
objectStack,
|
|
|
|
|
this.gmlFormat_
|
|
|
|
@@ -406,9 +468,9 @@ class WFS extends XMLFeature {
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
writeGetFeature(options) {
|
|
|
|
|
const node = createElementNS(WFSNS, 'GetFeature');
|
|
|
|
|
const node = createElementNS(WFSNS[this.version_], 'GetFeature');
|
|
|
|
|
node.setAttribute('service', 'WFS');
|
|
|
|
|
node.setAttribute('version', '1.1.0');
|
|
|
|
|
node.setAttribute('version', this.version_);
|
|
|
|
|
let filter;
|
|
|
|
|
if (options) {
|
|
|
|
|
if (options.handle) {
|
|
|
|
@@ -455,9 +517,10 @@ class WFS extends XMLFeature {
|
|
|
|
|
);
|
|
|
|
|
/** @type {import("../xml.js").NodeStackItem} */
|
|
|
|
|
const context = {
|
|
|
|
|
node: node,
|
|
|
|
|
node,
|
|
|
|
|
};
|
|
|
|
|
assign(context, {
|
|
|
|
|
'version': this.version_,
|
|
|
|
|
'srsName': options.srsName,
|
|
|
|
|
'featureNS': options.featureNS ? options.featureNS : this.featureNS_,
|
|
|
|
|
'featurePrefix': options.featurePrefix,
|
|
|
|
@@ -487,101 +550,41 @@ class WFS extends XMLFeature {
|
|
|
|
|
*/
|
|
|
|
|
writeTransaction(inserts, updates, deletes, options) {
|
|
|
|
|
const objectStack = [];
|
|
|
|
|
const node = createElementNS(WFSNS, 'Transaction');
|
|
|
|
|
const version = options.version ? options.version : DEFAULT_VERSION;
|
|
|
|
|
const gmlVersion = version === '1.0.0' ? 2 : 3;
|
|
|
|
|
const version = options.version ? options.version : this.version_;
|
|
|
|
|
const node = createElementNS(WFSNS[version], 'Transaction');
|
|
|
|
|
|
|
|
|
|
node.setAttribute('service', 'WFS');
|
|
|
|
|
node.setAttribute('version', version);
|
|
|
|
|
let baseObj;
|
|
|
|
|
/** @type {import("../xml.js").NodeStackItem} */
|
|
|
|
|
let obj;
|
|
|
|
|
if (options) {
|
|
|
|
|
baseObj = options.gmlOptions ? options.gmlOptions : {};
|
|
|
|
|
if (options.handle) {
|
|
|
|
|
node.setAttribute('handle', options.handle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const schemaLocation = SCHEMA_LOCATIONS[version];
|
|
|
|
|
node.setAttributeNS(
|
|
|
|
|
XML_SCHEMA_INSTANCE_URI,
|
|
|
|
|
'xsi:schemaLocation',
|
|
|
|
|
schemaLocation
|
|
|
|
|
SCHEMA_LOCATIONS[version]
|
|
|
|
|
);
|
|
|
|
|
const featurePrefix = options.featurePrefix
|
|
|
|
|
? options.featurePrefix
|
|
|
|
|
: FEATURE_PREFIX;
|
|
|
|
|
|
|
|
|
|
const request = createTransactionRequest(node, baseObj, version, options);
|
|
|
|
|
if (inserts) {
|
|
|
|
|
obj = assign(
|
|
|
|
|
{node: node},
|
|
|
|
|
{
|
|
|
|
|
'featureNS': options.featureNS,
|
|
|
|
|
'featureType': options.featureType,
|
|
|
|
|
'featurePrefix': featurePrefix,
|
|
|
|
|
'gmlVersion': gmlVersion,
|
|
|
|
|
'hasZ': options.hasZ,
|
|
|
|
|
'srsName': options.srsName,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
assign(obj, baseObj);
|
|
|
|
|
pushSerializeAndPop(
|
|
|
|
|
obj,
|
|
|
|
|
TRANSACTION_SERIALIZERS,
|
|
|
|
|
makeSimpleNodeFactory('Insert'),
|
|
|
|
|
inserts,
|
|
|
|
|
objectStack
|
|
|
|
|
);
|
|
|
|
|
serializeTransactionRequest('Insert', inserts, objectStack, request);
|
|
|
|
|
}
|
|
|
|
|
if (updates) {
|
|
|
|
|
obj = assign(
|
|
|
|
|
{node: node},
|
|
|
|
|
{
|
|
|
|
|
'featureNS': options.featureNS,
|
|
|
|
|
'featureType': options.featureType,
|
|
|
|
|
'featurePrefix': featurePrefix,
|
|
|
|
|
'gmlVersion': gmlVersion,
|
|
|
|
|
'hasZ': options.hasZ,
|
|
|
|
|
'srsName': options.srsName,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
assign(obj, baseObj);
|
|
|
|
|
pushSerializeAndPop(
|
|
|
|
|
obj,
|
|
|
|
|
TRANSACTION_SERIALIZERS,
|
|
|
|
|
makeSimpleNodeFactory('Update'),
|
|
|
|
|
updates,
|
|
|
|
|
objectStack
|
|
|
|
|
);
|
|
|
|
|
serializeTransactionRequest('Update', updates, objectStack, request);
|
|
|
|
|
}
|
|
|
|
|
if (deletes) {
|
|
|
|
|
pushSerializeAndPop(
|
|
|
|
|
{
|
|
|
|
|
node: node,
|
|
|
|
|
'featureNS': options.featureNS,
|
|
|
|
|
'featureType': options.featureType,
|
|
|
|
|
'featurePrefix': featurePrefix,
|
|
|
|
|
'gmlVersion': gmlVersion,
|
|
|
|
|
'srsName': options.srsName,
|
|
|
|
|
},
|
|
|
|
|
TRANSACTION_SERIALIZERS,
|
|
|
|
|
makeSimpleNodeFactory('Delete'),
|
|
|
|
|
deletes,
|
|
|
|
|
objectStack
|
|
|
|
|
);
|
|
|
|
|
serializeTransactionRequest('Delete', deletes, objectStack, request);
|
|
|
|
|
}
|
|
|
|
|
if (options.nativeElements) {
|
|
|
|
|
pushSerializeAndPop(
|
|
|
|
|
{
|
|
|
|
|
node: node,
|
|
|
|
|
'featureNS': options.featureNS,
|
|
|
|
|
'featureType': options.featureType,
|
|
|
|
|
'featurePrefix': featurePrefix,
|
|
|
|
|
'gmlVersion': gmlVersion,
|
|
|
|
|
'srsName': options.srsName,
|
|
|
|
|
},
|
|
|
|
|
TRANSACTION_SERIALIZERS,
|
|
|
|
|
makeSimpleNodeFactory('Native'),
|
|
|
|
|
serializeTransactionRequest(
|
|
|
|
|
'Native',
|
|
|
|
|
options.nativeElements,
|
|
|
|
|
objectStack
|
|
|
|
|
objectStack,
|
|
|
|
|
request
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return node;
|
|
|
|
@@ -625,6 +628,57 @@ class WFS extends XMLFeature {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {Element} node Node.
|
|
|
|
|
* @param {*} baseObj Base object.
|
|
|
|
|
* @param {string} version Version.
|
|
|
|
|
* @param {WriteTransactionOptions} options Options.
|
|
|
|
|
* @return {Object} Request object.
|
|
|
|
|
*/
|
|
|
|
|
function createTransactionRequest(node, baseObj, version, options) {
|
|
|
|
|
const featurePrefix = options.featurePrefix
|
|
|
|
|
? options.featurePrefix
|
|
|
|
|
: FEATURE_PREFIX;
|
|
|
|
|
let gmlVersion;
|
|
|
|
|
if (version === '1.0.0') {
|
|
|
|
|
gmlVersion = 2;
|
|
|
|
|
} else if (version === '1.1.0') {
|
|
|
|
|
gmlVersion = 3;
|
|
|
|
|
} else if (version === '2.0.0') {
|
|
|
|
|
gmlVersion = 3.2;
|
|
|
|
|
}
|
|
|
|
|
const obj = assign(
|
|
|
|
|
{node},
|
|
|
|
|
{
|
|
|
|
|
version,
|
|
|
|
|
'featureNS': options.featureNS,
|
|
|
|
|
'featureType': options.featureType,
|
|
|
|
|
'featurePrefix': featurePrefix,
|
|
|
|
|
'gmlVersion': gmlVersion,
|
|
|
|
|
'hasZ': options.hasZ,
|
|
|
|
|
'srsName': options.srsName,
|
|
|
|
|
},
|
|
|
|
|
baseObj
|
|
|
|
|
);
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {string} type Request type.
|
|
|
|
|
* @param {Array<import("../Feature.js").default>} features Features.
|
|
|
|
|
* @param {Array<*>} objectStack Object stack.
|
|
|
|
|
* @param {Element} request Transaction Request.
|
|
|
|
|
*/
|
|
|
|
|
function serializeTransactionRequest(type, features, objectStack, request) {
|
|
|
|
|
pushSerializeAndPop(
|
|
|
|
|
request,
|
|
|
|
|
TRANSACTION_SERIALIZERS,
|
|
|
|
|
makeSimpleNodeFactory(type),
|
|
|
|
|
features,
|
|
|
|
|
objectStack
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {Element} node Node.
|
|
|
|
|
* @param {Array<*>} objectStack Object stack.
|
|
|
|
@@ -644,6 +698,11 @@ const OGC_FID_PARSERS = {
|
|
|
|
|
return node.getAttribute('fid');
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/ogc/1.1': {
|
|
|
|
|
'FeatureId': makeArrayPusher(function (node, objectStack) {
|
|
|
|
|
return node.getAttribute('fid');
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -662,6 +721,9 @@ const INSERT_RESULTS_PARSERS = {
|
|
|
|
|
'http://www.opengis.net/wfs': {
|
|
|
|
|
'Feature': fidParser,
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/wfs/2.0': {
|
|
|
|
|
'Feature': fidParser,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -687,8 +749,10 @@ function writeFeature(node, feature, objectStack) {
|
|
|
|
|
node.appendChild(child);
|
|
|
|
|
if (gmlVersion === 2) {
|
|
|
|
|
GML2.prototype.writeFeatureElement(child, feature, objectStack);
|
|
|
|
|
} else {
|
|
|
|
|
} else if (gmlVersion === 3) {
|
|
|
|
|
GML3.prototype.writeFeatureElement(child, feature, objectStack);
|
|
|
|
|
} else {
|
|
|
|
|
GML32.prototype.writeFeatureElement(child, feature, objectStack);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -698,8 +762,11 @@ function writeFeature(node, feature, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeOgcFidFilter(node, fid, objectStack) {
|
|
|
|
|
const filter = createElementNS(OGCNS, 'Filter');
|
|
|
|
|
const child = createElementNS(OGCNS, 'FeatureId');
|
|
|
|
|
const context = objectStack[objectStack.length - 1];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
const ns = OGCNS[version];
|
|
|
|
|
const filter = createElementNS(ns, 'Filter');
|
|
|
|
|
const child = createElementNS(ns, 'FeatureId');
|
|
|
|
|
filter.appendChild(child);
|
|
|
|
|
child.setAttribute('fid', /** @type {string} */ (fid));
|
|
|
|
|
node.appendChild(filter);
|
|
|
|
@@ -749,6 +816,7 @@ function writeDelete(node, feature, objectStack) {
|
|
|
|
|
function writeUpdate(node, feature, objectStack) {
|
|
|
|
|
const context = objectStack[objectStack.length - 1];
|
|
|
|
|
assert(feature.getId() !== undefined, 27); // Features must have an id set
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
const featureType = context['featureType'];
|
|
|
|
|
const featurePrefix = context['featurePrefix'];
|
|
|
|
|
const featureNS = context['featureNS'];
|
|
|
|
@@ -775,8 +843,9 @@ function writeUpdate(node, feature, objectStack) {
|
|
|
|
|
}
|
|
|
|
|
pushSerializeAndPop(
|
|
|
|
|
/** @type {import("../xml.js").NodeStackItem} */ ({
|
|
|
|
|
version,
|
|
|
|
|
'gmlVersion': context['gmlVersion'],
|
|
|
|
|
node: node,
|
|
|
|
|
node,
|
|
|
|
|
'hasZ': context['hasZ'],
|
|
|
|
|
'srsName': context['srsName'],
|
|
|
|
|
}),
|
|
|
|
@@ -795,13 +864,15 @@ function writeUpdate(node, feature, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeProperty(node, pair, objectStack) {
|
|
|
|
|
const name = createElementNS(WFSNS, 'Name');
|
|
|
|
|
const context = objectStack[objectStack.length - 1];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
const ns = WFSNS[version];
|
|
|
|
|
const name = createElementNS(ns, 'Name');
|
|
|
|
|
const gmlVersion = context['gmlVersion'];
|
|
|
|
|
node.appendChild(name);
|
|
|
|
|
writeStringTextNode(name, pair.name);
|
|
|
|
|
if (pair.value !== undefined && pair.value !== null) {
|
|
|
|
|
const value = createElementNS(WFSNS, 'Value');
|
|
|
|
|
const value = createElementNS(ns, 'Value');
|
|
|
|
|
node.appendChild(value);
|
|
|
|
|
if (
|
|
|
|
|
pair.value &&
|
|
|
|
@@ -810,8 +881,10 @@ function writeProperty(node, pair, objectStack) {
|
|
|
|
|
) {
|
|
|
|
|
if (gmlVersion === 2) {
|
|
|
|
|
GML2.prototype.writeGeometryElement(value, pair.value, objectStack);
|
|
|
|
|
} else {
|
|
|
|
|
} else if (gmlVersion === 3) {
|
|
|
|
|
GML3.prototype.writeGeometryElement(value, pair.value, objectStack);
|
|
|
|
|
} else {
|
|
|
|
|
GML32.prototype.writeGeometryElement(value, pair.value, objectStack);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
writeStringTextNode(value, pair.value);
|
|
|
|
@@ -843,6 +916,9 @@ const GETFEATURE_SERIALIZERS = {
|
|
|
|
|
'http://www.opengis.net/wfs': {
|
|
|
|
|
'Query': makeChildAppender(writeQuery),
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/wfs/2.0': {
|
|
|
|
|
'Query': makeChildAppender(writeQuery),
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/ogc': {
|
|
|
|
|
'During': makeChildAppender(writeDuringFilter),
|
|
|
|
|
'And': makeChildAppender(writeLogicalFilter),
|
|
|
|
@@ -862,6 +938,27 @@ const GETFEATURE_SERIALIZERS = {
|
|
|
|
|
'PropertyIsBetween': makeChildAppender(writeIsBetweenFilter),
|
|
|
|
|
'PropertyIsLike': makeChildAppender(writeIsLikeFilter),
|
|
|
|
|
},
|
|
|
|
|
'http://www.opengis.net/fes/2.0': {
|
|
|
|
|
'During': makeChildAppender(writeDuringFilter),
|
|
|
|
|
'And': makeChildAppender(writeLogicalFilter),
|
|
|
|
|
'Or': makeChildAppender(writeLogicalFilter),
|
|
|
|
|
'Not': makeChildAppender(writeNotFilter),
|
|
|
|
|
'BBOX': makeChildAppender(writeBboxFilter),
|
|
|
|
|
'Contains': makeChildAppender(writeContainsFilter),
|
|
|
|
|
'Disjoint': makeChildAppender(writeDisjointFilter),
|
|
|
|
|
'Intersects': makeChildAppender(writeIntersectsFilter),
|
|
|
|
|
'ResourceId': makeChildAppender(writeResourceIdFilter),
|
|
|
|
|
'Within': makeChildAppender(writeWithinFilter),
|
|
|
|
|
'PropertyIsEqualTo': makeChildAppender(writeComparisonFilter),
|
|
|
|
|
'PropertyIsNotEqualTo': makeChildAppender(writeComparisonFilter),
|
|
|
|
|
'PropertyIsLessThan': makeChildAppender(writeComparisonFilter),
|
|
|
|
|
'PropertyIsLessThanOrEqualTo': makeChildAppender(writeComparisonFilter),
|
|
|
|
|
'PropertyIsGreaterThan': makeChildAppender(writeComparisonFilter),
|
|
|
|
|
'PropertyIsGreaterThanOrEqualTo': makeChildAppender(writeComparisonFilter),
|
|
|
|
|
'PropertyIsNull': makeChildAppender(writeIsNullFilter),
|
|
|
|
|
'PropertyIsBetween': makeChildAppender(writeIsBetweenFilter),
|
|
|
|
|
'PropertyIsLike': makeChildAppender(writeIsLikeFilter),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -871,6 +968,7 @@ const GETFEATURE_SERIALIZERS = {
|
|
|
|
|
*/
|
|
|
|
|
function writeQuery(node, featureType, objectStack) {
|
|
|
|
|
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
const featurePrefix = context['featurePrefix'];
|
|
|
|
|
const featureNS = context['featureNS'];
|
|
|
|
|
const propertyNames = context['propertyNames'];
|
|
|
|
@@ -882,7 +980,13 @@ function writeQuery(node, featureType, objectStack) {
|
|
|
|
|
} else {
|
|
|
|
|
typeName = featureType;
|
|
|
|
|
}
|
|
|
|
|
node.setAttribute('typeName', typeName);
|
|
|
|
|
let typeNameAttr;
|
|
|
|
|
if (version === '2.0.0') {
|
|
|
|
|
typeNameAttr = 'typeNames';
|
|
|
|
|
} else {
|
|
|
|
|
typeNameAttr = 'typeName';
|
|
|
|
|
}
|
|
|
|
|
node.setAttribute(typeNameAttr, typeName);
|
|
|
|
|
if (srsName) {
|
|
|
|
|
node.setAttribute('srsName', srsName);
|
|
|
|
|
}
|
|
|
|
@@ -903,7 +1007,7 @@ function writeQuery(node, featureType, objectStack) {
|
|
|
|
|
);
|
|
|
|
|
const filter = context['filter'];
|
|
|
|
|
if (filter) {
|
|
|
|
|
const child = createElementNS(OGCNS, 'Filter');
|
|
|
|
|
const child = createElementNS(getFilterNS(version), 'Filter');
|
|
|
|
|
node.appendChild(child);
|
|
|
|
|
writeFilterCondition(child, filter, objectStack);
|
|
|
|
|
}
|
|
|
|
@@ -915,8 +1019,10 @@ function writeQuery(node, featureType, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeFilterCondition(node, filter, objectStack) {
|
|
|
|
|
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
/** @type {import("../xml.js").NodeStackItem} */
|
|
|
|
|
const item = {node: node};
|
|
|
|
|
const item = {node};
|
|
|
|
|
assign(item, {context});
|
|
|
|
|
pushSerializeAndPop(
|
|
|
|
|
item,
|
|
|
|
|
GETFEATURE_SERIALIZERS,
|
|
|
|
@@ -932,11 +1038,14 @@ function writeFilterCondition(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeBboxFilter(node, filter, objectStack) {
|
|
|
|
|
const context = objectStack[objectStack.length - 1];
|
|
|
|
|
context['srsName'] = filter.srsName;
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
parent['srsName'] = filter.srsName;
|
|
|
|
|
const format = GML_FORMATS[version];
|
|
|
|
|
|
|
|
|
|
writeOgcPropertyName(node, filter.geometryName);
|
|
|
|
|
GML3.prototype.writeGeometryElement(node, filter.extent, objectStack);
|
|
|
|
|
writePropertyName(version, node, filter.geometryName);
|
|
|
|
|
format.prototype.writeGeometryElement(node, filter.extent, objectStack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -945,11 +1054,14 @@ function writeBboxFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeContainsFilter(node, filter, objectStack) {
|
|
|
|
|
const context = objectStack[objectStack.length - 1];
|
|
|
|
|
context['srsName'] = filter.srsName;
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
parent['srsName'] = filter.srsName;
|
|
|
|
|
const format = GML_FORMATS[version];
|
|
|
|
|
|
|
|
|
|
writeOgcPropertyName(node, filter.geometryName);
|
|
|
|
|
GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack);
|
|
|
|
|
writePropertyName(version, node, filter.geometryName);
|
|
|
|
|
format.prototype.writeGeometryElement(node, filter.geometry, objectStack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -958,11 +1070,39 @@ function writeContainsFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeIntersectsFilter(node, filter, objectStack) {
|
|
|
|
|
const context = objectStack[objectStack.length - 1];
|
|
|
|
|
context['srsName'] = filter.srsName;
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
parent['srsName'] = filter.srsName;
|
|
|
|
|
const format = GML_FORMATS[version];
|
|
|
|
|
|
|
|
|
|
writeOgcPropertyName(node, filter.geometryName);
|
|
|
|
|
GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack);
|
|
|
|
|
writePropertyName(version, node, filter.geometryName);
|
|
|
|
|
format.prototype.writeGeometryElement(node, filter.geometry, objectStack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {Node} node Node.
|
|
|
|
|
* @param {import("./filter/Disjoint.js").default} filter Filter.
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeDisjointFilter(node, filter, objectStack) {
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
parent['srsName'] = filter.srsName;
|
|
|
|
|
const format = GML_FORMATS[version];
|
|
|
|
|
|
|
|
|
|
writePropertyName(version, node, filter.geometryName);
|
|
|
|
|
format.prototype.writeGeometryElement(node, filter.geometry, objectStack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {Element} node Element.
|
|
|
|
|
* @param {import("./filter/ResourceId.js").default} filter Filter.
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeResourceIdFilter(node, filter, objectStack) {
|
|
|
|
|
node.setAttribute('rid', /** @type {string} */ (filter.rid));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -971,11 +1111,14 @@ function writeIntersectsFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeWithinFilter(node, filter, objectStack) {
|
|
|
|
|
const context = objectStack[objectStack.length - 1];
|
|
|
|
|
context['srsName'] = filter.srsName;
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
parent['srsName'] = filter.srsName;
|
|
|
|
|
const format = GML_FORMATS[version];
|
|
|
|
|
|
|
|
|
|
writeOgcPropertyName(node, filter.geometryName);
|
|
|
|
|
GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack);
|
|
|
|
|
writePropertyName(version, node, filter.geometryName);
|
|
|
|
|
format.prototype.writeGeometryElement(node, filter.geometry, objectStack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -984,7 +1127,11 @@ function writeWithinFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeDuringFilter(node, filter, objectStack) {
|
|
|
|
|
const valueReference = createElementNS(FESNS, 'ValueReference');
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
const ns = FESNS[version];
|
|
|
|
|
const valueReference = createElementNS(ns, 'ValueReference');
|
|
|
|
|
writeStringTextNode(valueReference, filter.propertyName);
|
|
|
|
|
node.appendChild(valueReference);
|
|
|
|
|
|
|
|
|
@@ -1007,8 +1154,11 @@ function writeDuringFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeLogicalFilter(node, filter, objectStack) {
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
/** @type {import("../xml.js").NodeStackItem} */
|
|
|
|
|
const item = {node: node};
|
|
|
|
|
const item = {node};
|
|
|
|
|
assign(item, {context});
|
|
|
|
|
const conditions = filter.conditions;
|
|
|
|
|
for (let i = 0, ii = conditions.length; i < ii; ++i) {
|
|
|
|
|
const condition = conditions[i];
|
|
|
|
@@ -1028,8 +1178,11 @@ function writeLogicalFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeNotFilter(node, filter, objectStack) {
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
/** @type {import("../xml.js").NodeStackItem} */
|
|
|
|
|
const item = {node: node};
|
|
|
|
|
const item = {node};
|
|
|
|
|
assign(item, {context});
|
|
|
|
|
const condition = filter.condition;
|
|
|
|
|
pushSerializeAndPop(
|
|
|
|
|
item,
|
|
|
|
@@ -1046,11 +1199,15 @@ function writeNotFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeComparisonFilter(node, filter, objectStack) {
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
const ns = OGCNS[context['version']];
|
|
|
|
|
if (filter.matchCase !== undefined) {
|
|
|
|
|
node.setAttribute('matchCase', filter.matchCase.toString());
|
|
|
|
|
}
|
|
|
|
|
writeOgcPropertyName(node, filter.propertyName);
|
|
|
|
|
writeOgcLiteral(node, '' + filter.expression);
|
|
|
|
|
writePropertyName(version, node, filter.propertyName);
|
|
|
|
|
writeOgcLiteral(ns, node, '' + filter.expression);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -1059,7 +1216,10 @@ function writeComparisonFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeIsNullFilter(node, filter, objectStack) {
|
|
|
|
|
writeOgcPropertyName(node, filter.propertyName);
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
writePropertyName(version, node, filter.propertyName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -1068,15 +1228,20 @@ function writeIsNullFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeIsBetweenFilter(node, filter, objectStack) {
|
|
|
|
|
writeOgcPropertyName(node, filter.propertyName);
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
const ns = OGCNS[context['version']];
|
|
|
|
|
|
|
|
|
|
const lowerBoundary = createElementNS(OGCNS, 'LowerBoundary');
|
|
|
|
|
writePropertyName(version, node, filter.propertyName);
|
|
|
|
|
|
|
|
|
|
const lowerBoundary = createElementNS(ns, 'LowerBoundary');
|
|
|
|
|
node.appendChild(lowerBoundary);
|
|
|
|
|
writeOgcLiteral(lowerBoundary, '' + filter.lowerBoundary);
|
|
|
|
|
writeOgcLiteral(ns, lowerBoundary, '' + filter.lowerBoundary);
|
|
|
|
|
|
|
|
|
|
const upperBoundary = createElementNS(OGCNS, 'UpperBoundary');
|
|
|
|
|
const upperBoundary = createElementNS(ns, 'UpperBoundary');
|
|
|
|
|
node.appendChild(upperBoundary);
|
|
|
|
|
writeOgcLiteral(upperBoundary, '' + filter.upperBoundary);
|
|
|
|
|
writeOgcLiteral(ns, upperBoundary, '' + filter.upperBoundary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -1085,41 +1250,61 @@ function writeIsBetweenFilter(node, filter, objectStack) {
|
|
|
|
|
* @param {Array<*>} objectStack Node stack.
|
|
|
|
|
*/
|
|
|
|
|
function writeIsLikeFilter(node, filter, objectStack) {
|
|
|
|
|
const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
|
|
|
const context = parent['context'];
|
|
|
|
|
const version = context['version'];
|
|
|
|
|
const ns = OGCNS[version];
|
|
|
|
|
node.setAttribute('wildCard', filter.wildCard);
|
|
|
|
|
node.setAttribute('singleChar', filter.singleChar);
|
|
|
|
|
node.setAttribute('escapeChar', filter.escapeChar);
|
|
|
|
|
if (filter.matchCase !== undefined) {
|
|
|
|
|
node.setAttribute('matchCase', filter.matchCase.toString());
|
|
|
|
|
}
|
|
|
|
|
writeOgcPropertyName(node, filter.propertyName);
|
|
|
|
|
writeOgcLiteral(node, '' + filter.pattern);
|
|
|
|
|
writePropertyName(version, node, filter.propertyName);
|
|
|
|
|
writeOgcLiteral(ns, node, '' + filter.pattern);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {string} ns Namespace.
|
|
|
|
|
* @param {string} tagName Tag name.
|
|
|
|
|
* @param {Node} node Node.
|
|
|
|
|
* @param {string} value Value.
|
|
|
|
|
*/
|
|
|
|
|
function writeOgcExpression(tagName, node, value) {
|
|
|
|
|
const property = createElementNS(OGCNS, tagName);
|
|
|
|
|
function writeOgcExpression(ns, tagName, node, value) {
|
|
|
|
|
const property = createElementNS(ns, tagName);
|
|
|
|
|
writeStringTextNode(property, value);
|
|
|
|
|
node.appendChild(property);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {string} version Version.
|
|
|
|
|
* @param {Node} node Node.
|
|
|
|
|
* @param {string} value PropertyName value.
|
|
|
|
|
*/
|
|
|
|
|
function writeOgcPropertyName(node, value) {
|
|
|
|
|
writeOgcExpression('PropertyName', node, value);
|
|
|
|
|
function writePropertyName(version, node, value) {
|
|
|
|
|
if (version === '2.0.0') {
|
|
|
|
|
writeFesValueReference(FESNS[version], node, value);
|
|
|
|
|
} else {
|
|
|
|
|
writeOgcExpression(OGCNS[version], 'PropertyName', node, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {string} ns Namespace.
|
|
|
|
|
* @param {Node} node Node.
|
|
|
|
|
* @param {string} value PropertyName value.
|
|
|
|
|
*/
|
|
|
|
|
function writeOgcLiteral(node, value) {
|
|
|
|
|
writeOgcExpression('Literal', node, value);
|
|
|
|
|
function writeFesValueReference(ns, node, value) {
|
|
|
|
|
writeOgcExpression(ns, 'ValueReference', node, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {string} ns Namespace.
|
|
|
|
|
* @param {Node} node Node.
|
|
|
|
|
* @param {string} value PropertyName value.
|
|
|
|
|
*/
|
|
|
|
|
function writeOgcLiteral(ns, node, value) {
|
|
|
|
|
writeOgcExpression(ns, 'Literal', node, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -1139,12 +1324,20 @@ function writeTimeInstant(node, time) {
|
|
|
|
|
* Encode filter as WFS `Filter` and return the Node.
|
|
|
|
|
*
|
|
|
|
|
* @param {import("./filter/Filter.js").default} filter Filter.
|
|
|
|
|
* @param {string} version Version.
|
|
|
|
|
* @return {Node} Result.
|
|
|
|
|
* @api
|
|
|
|
|
*/
|
|
|
|
|
export function writeFilter(filter) {
|
|
|
|
|
const child = createElementNS(OGCNS, 'Filter');
|
|
|
|
|
writeFilterCondition(child, filter, []);
|
|
|
|
|
export function writeFilter(filter, version) {
|
|
|
|
|
const child = createElementNS(OGCNS[version], 'Filter');
|
|
|
|
|
const context = {
|
|
|
|
|
node: child,
|
|
|
|
|
};
|
|
|
|
|
assign(context, {
|
|
|
|
|
'version': version,
|
|
|
|
|
'filter': filter,
|
|
|
|
|
});
|
|
|
|
|
writeFilterCondition(child, filter, [context]);
|
|
|
|
|
return child;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1169,4 +1362,14 @@ function writeGetFeature(node, featureTypes, objectStack) {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getFilterNS(version) {
|
|
|
|
|
let ns;
|
|
|
|
|
if (version === '2.0.0') {
|
|
|
|
|
ns = FESNS[version];
|
|
|
|
|
} else {
|
|
|
|
|
ns = OGCNS[version];
|
|
|
|
|
}
|
|
|
|
|
return ns;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default WFS;
|
|
|
|
|