From 90bd1d10df12f458eb2e64e8de2b225f45d02153 Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期三, 14 四月 2021 17:34:08 +0800 Subject: [PATCH] 管网、环保设施、附属设施搜索定位 --- src/components/helpers/WfsHelper.js | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/helpers/WfsHelper.js b/src/components/helpers/WfsHelper.js index 64a6dd3..20093e6 100644 --- a/src/components/helpers/WfsHelper.js +++ b/src/components/helpers/WfsHelper.js @@ -1,10 +1,11 @@ /** * 鍔犺浇WMS,鎷兼帴FILTER,LAYERS鍙傛暟绛� */ +import { PIPELINE_WFS } from '../../conf/Constants' function WfsHelper () { this.filters = [] this.typeNames = [] - this.url = 'http://xearth.cn:6289/server/ogcserver/PipeLine/wfs' + this.url = PIPELINE_WFS this.params = { REQUEST: 'getfeature', OUTPUTFORMAT: 'JSON', @@ -16,11 +17,22 @@ this.typeNames.push(typeName) } - this.appendEquals = (property, literal) => { + this.addEquals = (property, literal) => { var filter = '<PropertyIsEqualTo><PropertyName>' + property + '</PropertyName><Literal>' + literal + '</Literal></PropertyIsEqualTo>' this.filters.push(filter) } + this.addLike = (property, literal) => { + if (property && literal) { + var filter = '<PropertyIsLike><PropertyName>' + property + '</PropertyName><Literal>*' + literal + '*</Literal></PropertyIsLike>' + this.filters.push(filter) + } + } + + /** + * 寰楀埌filter鍙傛暟鍊� + * @returns {string|null} + */ this.getFilterParams = () => { var head = '<Filter xmlns="http://www.opengis.net/ogc">' var end = '</Filter>' @@ -29,6 +41,10 @@ for (var i = 0; i < this.filters.length; i++) { filter += this.filters[i] } + // 褰撴潯浠舵暟 > 1鏃讹紝闇�瑕佺敤and鏍囩鍖呰9 + if (this.filters.length > 1) { + return ('FILTER=' + head + '<And>' + filter + '</And>' + end) + } return ('FILTER=' + head + filter + end) } return null -- Gitblit v1.8.0