@mapgis/webclient-common
Version:
mapgis ES6 format for igserver
7,144 lines • 108 kB
HTML
<header id="page-title" class="page-title">
<span class="page-title-main">类名</span>
<span class="page-title-sub">FeatureServer</span>
</header>
<section>
<article>
<div class="container-overview">
<div class='vertical-section'>
<div class="members">
<div class="member">
<h4 class="name" id="FeatureServer">
<a class="href-link" href="#FeatureServer">#</a>
<span class="code-name" id="FeatureServer" style="font-size:30px">
new FeatureServer<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>要素服务</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">
Object
</span>
</td>
<td class="description last"><p>构造参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="description last"><p>服务基地址,支持igs2.0的要素服务、矢量图层的要素查询以及矢量文档的要素查询</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//igs2.0的要素服务
// ES5引入方式
const { FeatureServer } = zondy.service
// ES6引入方式
import { FeatureServer } from "@mapgis/webclient-common"
const featureServer = new FeatureServer({
//服务地址,folder为IGS的服务管理中的文件夹夹名称,serviceName为发布的服务名
url: 'http://192.168.88.12:8089/igs/rest/services/{folder}/{serviceName}/FeatureServer'
})
//基于矢量图层的要素查询
const featureServer = new FeatureServer({
//服务地址,IGS1.0地址
url: 'http://localhost:6163/igs/rest/mrfs/layer'
//服务地址,IGS2.0地址
//url: 'http://localhost:8089/igs/rest/mrfs/layer'
})
//基于矢量文档的要素查询
const featureServer = new FeatureServer({
//服务地址,IGS1.0地址,serviceName为发布的服务名
url: 'http://localhost:6163/igs/rest/mrfs/docs/{serviceName}'
//服务地址,IGS2.0地址,serviceName为发布的服务名
//url: 'http://localhost:8089/igs/rest/mrfs/docs/{serviceName}'
})</code></pre>
</div>
</div>
</div>
</div>
<h3 class="subsection-title">继承关系</h3>
<ul>
<li><a link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer" BaseServer.html>BaseServer</a></li>
</ul>
<div class='vertical-section'>
<h3 id='member'>成员变量</h3>
<h4 style="margin-top: 20px;margin-bottom: 20px;">成员变量概述</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code><a href="#clientId">clientId</a></code></td>
<td class="name">
<code>
<span class="param-type">
Boolean
</span>
</code>
</td>
<td class="name"><code><p>客户端id</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#enableGlobeFetch">enableGlobeFetch</a></code></td>
<td class="name">
<code>
<span class="param-type">
Boolean
</span>
</code>
</td>
<td class="name"><code><p>是否使用确据唯一的fetch对象,默认为true,当设为false时,会使用自己私有的fetch对象,所有的请求设置不会影响全局</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#headers">headers</a></code></td>
<td class="name">
<code>
<span class="param-type">
String
</span>
</code>
</td>
<td class="name"><code><p>请求头参数</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#requestInterceptor">requestInterceptor</a></code></td>
<td class="name">
<code>
<span class="param-type">
function
</span>
</code>
</td>
<td class="name"><code><p>请求发送拦截器</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#requestTimeout">requestTimeout</a></code></td>
<td class="name">
<code>
<span class="param-type">
String
</span>
</code>
</td>
<td class="name"><code><p>请求超时时间,默认45000ms,即45s</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#responseInterceptor">responseInterceptor</a></code></td>
<td class="name">
<code>
<span class="param-type">
function
</span>
</code>
</td>
<td class="name"><code><p>请求响应拦截器</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#tokenAttachType">tokenAttachType</a></code></td>
<td class="name">
<code>
<span class="param-type">
<a link="TokenAttachType.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="TokenAttachType" global.html#TokenAttachType>TokenAttachType</a>
</span>
</code>
</td>
<td class="name"><code><p>指定token附加到何处</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#tokenKey">tokenKey</a></code></td>
<td class="name">
<code>
<span class="param-type">
String
</span>
</code>
</td>
<td class="name"><code><p>token名</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#tokenValue">tokenValue</a></code></td>
<td class="name">
<code>
<span class="param-type">
String
</span>
</code>
</td>
<td class="name"><code><p>token值</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#url">url</a></code></td>
<td class="name">
<code>
<span class="param-type">
String
</span>
</code>
</td>
<td class="name"><code><p>服务基地址</p></code></td>
</tr>
</tbody>
</table>
</div>
<h4 style="margin-top: 20px;margin-bottom: 20px;">成员变量详情</h4>
<div class="members">
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
Boolean
</span>
</span>
<h4 class="name" id="clientId">
<a class="href-link" href="#clientId">#</a>
<span class="code-name">
clientId
</span>
</h4>
<div class="description">
<p>客户端id</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="clientId" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#clientId" BaseServer.html#clientId>BaseServer#clientId</a>
</li></ul></dd>
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
Boolean
</span>
</span>
<h4 class="name" id="enableGlobeFetch">
<a class="href-link" href="#enableGlobeFetch">#</a>
<span class="code-name">
enableGlobeFetch
</span>
</h4>
<div class="description">
<p>是否使用确据唯一的fetch对象,默认为true,当设为false时,会使用自己私有的fetch对象,所有的请求设置不会影响全局</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="enableGlobeFetch" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#enableGlobeFetch" BaseServer.html#enableGlobeFetch>BaseServer#enableGlobeFetch</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置请求基地址
// ES5引入方式
const { BaseServer } = zondy.service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//请求基地址
url: '你的URL',
//使用私有的fetch对象
enableGlobeFetch: false,
//此时设置token等属性,不会影响全局的fetch对象
tokenValue: '你的token'
});
//继续使用全局fetch
BaseServer.enableGlobeFetch = true;</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
String
</span>
</span>
<h4 class="name" id="headers">
<a class="href-link" href="#headers">#</a>
<span class="code-name">
headers
</span>
</h4>
<div class="description">
<p>请求头参数</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="headers" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#headers" BaseServer.html#headers>BaseServer#headers</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置请求头参数
// ES5引入方式
const { BaseServer } = zondy.service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//请求头
headers: {
//设置Content-Type为multipart/form-data
'Content-Type': 'multipart/form-data',
//设置token
'token': '你的token'
}
});
//动态修改
BaseServer.headers.token = '新token';</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
function
</span>
</span>
<h4 class="name" id="requestInterceptor">
<a class="href-link" href="#requestInterceptor">#</a>
<span class="code-name">
requestInterceptor
</span>
</h4>
<div class="description">
<p>请求发送拦截器</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="requestInterceptor" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#requestInterceptor" BaseServer.html#requestInterceptor>BaseServer#requestInterceptor</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置拦截器,任何一个继承自BaseServer的对象都可以设置,全局唯一
// ES5引入方式
const { BaseServer,RequestInterceptor } = zondy.service
// ES6引入方式
import { BaseServer,RequestInterceptor } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//设置请求发送拦截器
requestInterceptor: new RequestInterceptor({
//请求发送前进行统一处理
before: function(config) {
//执行你的业务逻辑
//注意必须显示返回config对象,如果返回为空,则不发送请求
return config;
},
//请求发送失败时进行统一处理
failure: function(error) {
//执行你的业务逻辑
}
})
});
//动态修改
BaseServer.requestInterceptor.before = function() {};</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
String
</span>
</span>
<h4 class="name" id="requestTimeout">
<a class="href-link" href="#requestTimeout">#</a>
<span class="code-name">
requestTimeout
</span>
</h4>
<div class="description">
<p>请求超时时间,默认45000ms,即45s</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="requestTimeout" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#requestTimeout" BaseServer.html#requestTimeout>BaseServer#requestTimeout</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置超时时间
//初始化AddressServer服务对象
// ES5引入方式
const { BaseServer } = zondy.service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//超时时间
requestTimeout: 2000
});
//动态修改
BaseServer.requestTimeout = 3000;</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
function
</span>
</span>
<h4 class="name" id="responseInterceptor">
<a class="href-link" href="#responseInterceptor">#</a>
<span class="code-name">
responseInterceptor
</span>
</h4>
<div class="description">
<p>请求响应拦截器</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="responseInterceptor" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#responseInterceptor" BaseServer.html#responseInterceptor>BaseServer#responseInterceptor</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置拦截器,任何一个继承自BaseServer的对象都可以设置,全局唯一
// ES5引入方式
const { BaseServer,ResponseInterceptor } = zondy.service
// ES6引入方式
import { BaseServer,ResponseInterceptor } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//设置请求响应拦截器
responseInterceptor: new ResponseInterceptor({
//执行请求响应,接口调用成功时会执行的回调
success: function(result) {
//执行你的业务逻辑
//注意必须显示返回result对象,如果返回为空,则不执行请求响应成功回调
return result;
},
//请求响应成功,接口调用失败时会执行的函数
failure: function(result) {
//执行你的业务逻辑
//注意必须显示返回result对象,如果返回为空,则不执行回调韩式
return result;
}
})
});
//动态修改
BaseServer.responseInterceptor.success = function() {};</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
<a link="TokenAttachType.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="TokenAttachType" global.html#TokenAttachType>TokenAttachType</a>
</span>
</span>
<h4 class="name" id="tokenAttachType">
<a class="href-link" href="#tokenAttachType">#</a>
<span class="code-name">
tokenAttachType
</span>
</h4>
<div class="description">
<p>指定token附加到何处</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="tokenAttachType" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#tokenAttachType" BaseServer.html#tokenAttachType>BaseServer#tokenAttachType</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置token值
// ES5引入方式
const { BaseServer } = zondy.service
const { TokenAttachType } = zondy.enum
// ES6引入方式
import { BaseServer,TokenAttachType } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//token名
tokenValue: '你的token值',
//token值
tokenValue: '你的token值',
//指定token附加到url后面
tokenAttachType: TokenAttachType.url
});
//动态修改
BaseServer.tokenAttachType = TokenAttachType.header;</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
String
</span>
</span>
<h4 class="name" id="tokenKey">
<a class="href-link" href="#tokenKey">#</a>
<span class="code-name">
tokenKey
</span>
</h4>
<div class="description">
<p>token名</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="tokenKey" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#tokenKey" BaseServer.html#tokenKey>BaseServer#tokenKey</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置token名
// ES5引入方式
const { BaseServer } = zondy.service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//token名
tokenKey: '你的tokenKey'
});
//动态修改
BaseServer.tokenKey = '新tokenKey';</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
String
</span>
</span>
<h4 class="name" id="tokenValue">
<a class="href-link" href="#tokenValue">#</a>
<span class="code-name">
tokenValue
</span>
</h4>
<div class="description">
<p>token值</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="tokenValue" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#tokenValue" BaseServer.html#tokenValue>BaseServer#tokenValue</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置token值
// ES5引入方式
const { BaseServer } = zondy.service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//token值
tokenValue: '你的token值'
});
//动态修改
BaseServer.tokenValue = '新token值';</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">
String
</span>
</span>
<h4 class="name" id="url">
<a class="href-link" href="#url">#</a>
<span class="code-name">
url
</span>
</h4>
<div class="description">
<p>服务基地址</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="url" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#url" BaseServer.html#url>BaseServer#url</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置请求基地址
// ES5引入方式
const { BaseServer } = zondy.service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//请求基地址
url: '你的URL'
});
//动态修改
BaseServer.url = '新URL';</code></pre>
</div>
</div>
</div>
<div class='vertical-section'>
<h3 id='function'>方法</h3>
<h4 style="margin-top: 20px;margin-bottom: 20px;">方法概述</h4>
<div class="members">
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>返回值类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code><a href="#addFeature">addFeature</a></code></td>
<td class="name">
<code>
<span class="param-type">
Promise.<Object>
</span>
</code>
</td>
<td class="name"><code><p>指定图层的要素添加,支持IGS2.0的要素添加服务、基于矢量图层的要素添加服务以及基于矢量文档的要素添加</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#deleteFeature">deleteFeature</a></code></td>
<td class="name">
<code>
<span class="param-type">
Promise.<Object>
</span>
</code>
</td>
<td class="name"><code><p>指定图层的要素删除,支持IGS2.0的要素删除服务、基于矢量图层的要素删除服务以及基于矢量文档的要素删除服务</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#queryFeatureById">queryFeatureById</a></code></td>
<td class="name">
<code>
<span class="param-type">
Promise.<Object>
</span>
</code>
</td>
<td class="name"><code><p>根据id获取指定图层指定要素,IGS2.0新增服务</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#queryFeatures">queryFeatures</a></code></td>
<td class="name">
<code>
<span class="param-type">
Promise.<Object>
</span>
</code>
</td>
<td class="name"><code><p>指定图层的要素查询,支持IGS2.0,IGS1.0服务</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#queryFeaturesInLayers">queryFeaturesInLayers</a></code></td>
<td class="name">
<code>
<span class="param-type">
Promise.<Object>
</span>
</code>
</td>
<td class="name"><code><p>全图层要素查询,支持igs2.0、igs1.0</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#queryLayerInfo">queryLayerInfo</a></code></td>
<td class="name">
<code>
<span class="param-type">
Promise.<Object>
</span>
</code>
</td>
<td class="name"><code><p>获取要素服务图层信息,支持IGS1.0,IGS2.0</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#queryServerInfo">queryServerInfo</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>获取服务信息,IGS2.0新增服务</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#updateFeature">updateFeature</a></code></td>
<td class="name">
<code>
<span class="param-type">
Promise.<Object>
</span>
</code>
</td>
<td class="name"><code><p>指定图层的要素更新,支持IGS2.0的要素更新服务、基于矢量图层的要素更新服务以及基于矢量文档的要素更新服务</p></code></td>
</tr>
</tbody>
</table>
</div>
<h4 style="margin-top: 20px;margin-bottom: 20px;">方法详情</h4>
<div class="member">
<h4 class="name" id="addFeature">
<a class="href-link" href="#addFeature">#</a>
<span class="code-name" id="addFeature" style="font-size:30px">
addFeature<span class="signature">(options, GDBPOptions, DocOptions)</span>
</span>
</h4>
<div class="description">
<p>指定图层的要素添加,支持IGS2.0的要素添加服务、基于矢量图层的要素添加服务以及基于矢量文档的要素添加</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>指定图层的要素添加参数,IGS2.0参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>layerId</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
0
</td>
<td class="description last"><p>图层id,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
FetchMethod.get
</td>
<td class="description last"><p>请求类型</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>failure</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>features</code></td>
<td class="type">
<span class="param-type">
Array
</span>
</td>
<td class="default">
[]
</td>
<td class="description last"><p>要添加的要素集合</p></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code>GDBPOptions</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>基于矢量图层的新增要素参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>gdbp</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>gdbp的url,仅支持单个数据库的要素新增,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>featureSet</code></td>
<td class="type">
<span class="param-type">
Object
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>要更新的要素集合,注意是igs1.0的格式,必传</p></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code>DocOptions</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>基于矢量文档的新增要素参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>mapIndex</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>地图在文档下的序号,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>featureSet</code></td>
<td class="type">
<span class="param-type">
Object
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>要更新的要素集合,注意是igs1.0的格式,必传</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>添加要素结果</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">
Promise.<Object>
</span>
</div>
</div>
</div>
</div>
<h5>示例</h5>
<p class="code-caption"><h5>IGS2.0的要素新增示例</h5></p>
<pre class="prettyprint"><code>// 创建一个线要素
// ES5引入方式
const { Feature } = zondy
// ES6引入方式
import { Feature } from "@mapgis/webclient-common"
const lineString = new Feature({
//可填空或者和数据库中的表结构一一对应
attributes: {},
//可填空或者和系统库中的样式一一对应
symbol: {},
//设置几何
geometry: new zondy.geometry.LineString({
coordinates: [
[110.74, 32.41],
[112.89, 31.06],
[110.15, 30.16]
]
})
})
// 添加要素
featureServer.addFeature({
// 指定图层id
layerId: '0',
// 要添加的要素,可以添加多个要素
features: [lineString]
})
.then((res) => {
//成功回调函数
console.log('添加要素: ', res)
})
.catch((res) => {
//失败回调函数
console.log('添加要素失败: ', res)
})</code></pre>
<p class="code-caption"><h5>基于矢量图层的要素新增示例</h5></p>
<pre class="prettyprint"><code>// 初始化资源服务
// ES5引入方式
const { ResourceServer} = zondy.service
const { Point} = zondy.geometry
const { Feature } = zondy
// ES6引入方式
import { ResourceServer,Point,Feature } from "@mapgis/webclient-common"
const resourceServer = new ResourceServer({
// 目录服务基地址,port可填6163(.net服务)或者8089(Java服务)
url: 'http://localhost:6163/igs/rest/mrcs'
})
// 查询数据库表结构
resourceServer.queryGDBPInfo({
// 要查询的gdbp的url
gdbpUrl: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地'
})
.then((result) => {
// 表结构为result.data.FieldAtt
// 创建一个要素
const feature = new Feature({
// 设置要素id,若id已在数据库中存在,则自增id
id: 0,
// 设置几何,支持点、多点、线、多线、区、多区
geometry: new Point({
coordinates: [110.66482, 31.747766]
}),
// 这里的属性一定要和数据库的表结构一一对应,顺序也不能出错
attributes: {
"CODE": "1",
"NAME": "神龙架林区",
"mpLayer": "0"
},
//设置样式
symbol: {
SymID": 43,
SymHeight": 3.200000047683716,
SymWidth": 3.200000047683716,
Angle": 0,
Color": 1467,
Color1": 4,
Color2": 3,
Space": 1,
OutPenW": [
0.1,
0.05,
0.05
]
}
})
// 创建新增要素的结构体
const featureSet = {
// 设置表结构,必填
AttStruct: result.data.FieldAtt,
// 设置要添加的要素,客串多个要素
SFEleArray: [feature.toOldIGSFeature()]
}
// 添加要素
featureServer.addFeature({
// 新增要素的结构体
featureSet: featureSet,
// gdbo地址,仅支持单表添加
gdbp: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地'
})
.then((result) => {
console.log('新增要素成功:', result);
})
.catch((result) => {
console.log('新增要素失败:', result);
})
})
.catch((result) => {
console.log('查询GDBO失败:', result);
})</code></pre>
<p class="code-caption"><h5>基于矢量文档的要素新增示例</h5></p>
<pre class="prettyprint"><code>// 初始化资源服务
// ES5引入方式
const { MultiPoint} = zondy.geometry
const { Feature } = zondy
// ES6引入方式
import { MultiPoint,Feature } from "@mapgis/webclient-common"
const resourceServer = new ResourceServer({
// 目录服务基地址,port可填6163(.net服务)或者8089(Java服务)
url: 'http://localhost:6163/igs/rest/mrcs'
})
// 查询数据库表结构
resourceServer.queryGDBPInfo({
// 要查询的gdbp的url
gdbpUrl: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地'
})
.then((result) => {
// 创建一个要素
const feature = new Feature({
// 设置要素id,若id已在数据库中存在,则自增id
id: 0,
// 设置几何,支持点、多点、线、多线、区、多区
geometry: new MultiPoint({
coordinates: [
[109.47509, 30.270342],
[111.27724, 30.706085]
]
}),
// 这里的属性一定要和数据库的表结构一一对应
attributes: {
"CODE": "0",
"Name": "测试点多点2",
"mpLayer": "0"
},
// 设置样式
symbol: {
"SymID": 43,
"SymHeight": 3.200000047683716,
"SymWidth": 3.200000047683716,
"Angle": 0,
"Color": 1467,
"Color1": 4,
"Color2": 3,
"Space": 1,
"OutPenW": [
0.1,
0.05,
0.05
]
}
})
// 创建新增要素的结构体
const featureSet = {
// 设置表结构,必填
AttStruct: result.data.FieldAtt,
// 设置要添加的要素,客串多个要素
SFEleArray: [feature.toOldIGSFeature()]
}
// 添加要素
featureServer.addFeature({
// 新增要素的结构体
featureSet: featureSet,
// 地图在文档下的序号,从0开始编号
mapIndex: 0,
// 图层序号,从0开始编号
layerIndex: 2
})
.then((result) => {
console.log('新增要素成功:', result);
})
.catch((result) => {
console.log('新增要素失败:', result);
})
})
.catch((result) => {
console.log('查询GDBO失败:', result);
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="deleteFeature">
<a class="href-link" href="#deleteFeature">#</a>
<span class="code-name" id="deleteFeature" style="font-size:30px">
deleteFeature<span class="signature">(options, GDBPOptions, DocOptions)</span>
</span>
</h4>
<div class="description">
<p>指定图层的要素删除,支持IGS2.0的要素删除服务、基于矢量图层的要素删除服务以及基于矢量文档的要素删除服务</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>指定图层的要素删除参数,IGS2.0参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>layerId</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>图层id,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
FetchMethod.get
</td>
<td class="description last"><p>请求类型</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>failure</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>objectIds</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>过滤id,多个用英文逗号分隔(使用大数据作为数据源发布的要素服务,该参数是唯一有效参数)</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>where</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>属性条件,类SQL语句</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type">
<a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>空间几何条件</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>distance</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>几何缓冲的距离,geometry为点、线时有效</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnDeleteResults</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否返回每个要素删除的结果,默认为true,如果要高效的批量删除,应设置为false</p></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code>GDBPOptions</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>基于矢量图层的要素删除</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>gdbp</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>图层的gdbp地址,允许多个图层,图层间用“;”号分隔,必填,例如:
gdbp=gdbp://MapGisLocal/示例数据/ds/世界地图/sfcls/海洋陆地;gdbp://sa@SqlServerGIS/MPDBMASTER/ds/兰伯特(全国)_400万/sfcls/中国地级县</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>objectIds</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>需要删除的要素的OID值,OID为要素的唯一标识码,一个图层可包含多个objectIds间以“,”分隔,可包含多个图层,各个图层的objectIds间以“;”分隔,必填,lieu:
objectIds=1,2,3;2,3,4;8</p></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code>DocOptions</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>基于矢量文档的要素删除</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>mapIndex</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>地图在文档下的序号,从0开始编号,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>layerIndex</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>图层序号,从0开始编号,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>objectIds</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>要删除的要素id,多个id以','分割,必填</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>返回要素删除结果</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">
Promise.<Object>
</span>
</div>
</div>
</div>
</div>
<h5>示例</h5>
<p class="code-caption"><h5>IGS2.0的要素删除示例</h5></p>
<pre class="prettyprint"><code>// 删除要素
featureServer.deleteFeature({
// 图层id
layerId: '0',
// 压迫删除的要素id,多个要素id以','分割
objectIds: '0,1,2,3,5,6'
})
.then((res)=>{
console.log('要素删除成功:', res);
})
.catch((res)=>{
console.log('要素删除失败:', res);
})</code></pre>
<p class="code-caption"><h5>基于矢量地图的要素删除示例</h5></p>
<pre class="prettyprint"><code>// 删除要素
featureServer.deleteFeature({
// gdbp的url
gdbp: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地',
// 要删除的要素id,多个id以','分割
objectIds: '18053'
})
.then((res)=>{
console.log('要素删除成功:', res);
})
.catch((res)=>{
console.log('要素删除失败:', res);
})</code></pre>
<p class="code-caption"><h5>基于基于矢量文档的要素删除示例</h5></p>
<pre class="prettyprint"><code>// 删除要素
featureServer.deleteFeature({
// 地图在文档下的序号,从0开始编号
mapIndex: 0,
// 图层序号,从0开始编号
layerIndex: 2,
// 要删除的要素id,多个id以','分割
objectIds: '18057'
})
.then((res)=>{
console.log('要素删除成功:', res);
})
.catch((res)=>{
console.log('要素删除失败:', res);
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="queryFeatureById">
<a class="href-link" href="#queryFeatureById">#</a>
<span class="code-name" id="queryFeatureById" style="font-size:30px">
queryFeatureById<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>根据id获取指定图层指定要素,IGS2.0新增服务</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>获取指定图层指定要素参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>layerId</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>图层id,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>featureId</code></td>
<td class="type">
<span class="param-type">
Array
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>要素id,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
FetchMethod.get
</td>
<td class="description last"><p>请求类型</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>failure</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>返回指定图层指定要素</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">
Promise.<Object>
</span>
</div>
</div>
</div>
</div>
<h5>示例</h5>
<p class="code-caption"><h5>根据id获取指定图层指定要素</h5></p>
<pre class="prettyprint"><code>featureServer.queryFeatureById({
// 图层id
layerId: '0',
// 要素id
featureId: '437'
})
.then((res) => {
console.log('要素查询成功:', res)
})
.catch((res) => {
console.log('要素查询失败:', res)
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="queryFeatures">
<a class="href-link" href="#queryFeatures">#</a>
<span class="code-name" id="queryFeatures" style="font-size:30px">
queryFeatures<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>指定图层的要素查询,支持IGS2.0,IGS1.0服务</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>要素查询参数,IGS2.0服务</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>layerId</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>图层id, 必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
FetchMethod.get
</td>
<td class="description last"><p>请求类型</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">
<a link="queryLayerInfoSuccess.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="queryLayerInfoSuccess" global.html#queryLayerInfoSuccess>queryLayerInfoSuccess</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>failure</code></td>
<td class="type">
<span class="param-type">
<a link="queryFailure.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="queryFailure" global.html#queryFailure>queryFailure</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type">
<a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>要素查询几何条件</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>geometryType</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>要素查询类型</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>where</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>要素查询where条件</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>outFields</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>输出属性字段,可为*表示所有,多个用英文逗号分隔</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>objectIds</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>过滤id,多个用英文逗号分隔(参数优先级很高,可能导致其它筛选条件失效)</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>distance</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
0
</td>
<td class="description last"><p>仅igs2.0支持,几何缓冲的距离,geometry为point、line时有效(若数据源为大数据PG数据,且geometryType为line或者point时为必填数据)</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>geometryPrecision</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>返回要素几何信息中坐标xy的精度</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>rule</code></td>
<td class="type">
<span class="param-type">
Object
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>仅1.0支持,rule={"CompareRectOnly":false,"MustInside":false,"Intersect":true},查询规则参数,JSON格式,CompareRectOnly为是否仅仅比较查询对象的外包络矩形框,MustInside为查询对象是否必须完全包含在输入的空间范围内,Intersect为是否与查询对象相交</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>isAsc</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>仅1.0支持,是否升序排列,格式:true/false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>spatialRel</code></td>
<td class="type">
<span class="param-type">
<a link="SpatialRelation.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="SpatialRelation" global.html#SpatialRelation>SpatialRelation</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>仅igs2.0支持,几何条件的空间判定规则,Intersects(相交)、EnvelopeIntersects(外包矩形相交)、Contains(包含)、Disjoint(相离)</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>orderByFields</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>排序字段,格式: fieldName [ASC|DESC]</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>groupByFieldsForStatistics</code></td>
<td class="type">
<span class="param-type">
String
</span>
|
<span class="param-type">
Array.<Object>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>igs2.0 分组统计的字段信息,格式为field1,field2;igs1.0 进行分组的字段以计算统计信息,示例:[{"LayerIndex": 0,"GroupFieldName": "NAME"}]</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>resultRecordCount</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
20
</td>
<td class="description last"><p>分页参数:结果返回条数,默认20</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>resultOffset</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>分页参数:跳过条数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>outStatistics</code></td>
<td class="type">
<span class="param-type">
Array
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>计算一个或多个基于字段的统计信息结构,统计类型包括:FUNCTION_MAX/FUNCTION_MIN/FUNCTION_SUM/FUNCTION_AVG/FUNCTION_COUNT/FUNCTION_MAX_OID,示例:"[{"statisticType": "FUNCTION_SUM","onStatisticField": "field1","outStatisticFieldName":"fieldName1"}]"</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnGeometry</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否返回几何,默认为true</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnAttribute</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否返回属性,默认为true</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnStyle</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>是否返回图形参数信息,默认为false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnIdsOnly</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>仅igs2.0支持,是否只返回id,默认为false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnCountOnly</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>仅igs2.0支持,是否只返回条数,默认为false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnExtentOnly</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>仅igs2.0支持,是否只返回范围,默认为false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnZ</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>是否返回Z轴,默认为false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>inSrs</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>输入几何空间参照系,支持MapGIS参照系名称、EPSG格式参考系、WKT格式参考系,具体请参考IGS的API文档</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>outSrs</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>输出几何空间参照系,支持MapGIS参照系名称、EPSG格式参考系,WKT格式参考系,具体请参考IGS的API文档</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>返回指定图层要素查询结果</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">
Promise.<Object>
</span>
</div>
</div>
</div>
</div>
<h5>示例</h5>
<p class="code-caption"><h5>IGS2.0的where查询</h5></p>
<pre class="prettyprint"><code>featureServer.queryFeatures({
// 图层id
layerId: '1',
// where语句
where: "NAME='天门市'"
})
.then((res)=>{
console.log('查询成功:', res)
})
.catch((res)=>{
console.log('查询失败:', res)
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="queryFeaturesInLayers">
<a class="href-link" href="#queryFeaturesInLayers">#</a>
<span class="code-name" id="queryFeaturesInLayers" style="font-size:30px">
queryFeaturesInLayers<span class="signature">(options, GDBPOptions, DocsOptions)</span>
</span>
</h4>
<div class="description">
<p>全图层要素查询,支持igs2.0、igs1.0</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>全图层要素查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
FetchMethod.get
</td>
<td class="description last"><p>请求类型</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">
<a link="queryLayerInfoSuccess.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="queryLayerInfoSuccess" global.html#queryLayerInfoSuccess>queryLayerInfoSuccess</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>failure</code></td>
<td class="type">
<span class="param-type">
<a link="queryFailure.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="queryFailure" global.html#queryFailure>queryFailure</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>layerDefs</code></td>
<td class="type">
<span class="param-type">
Array
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>多图层的属性条件,包括layerId、where、outFields;当值为空时,查询所有图层,并当为拉框查询时,自动过滤不需要不需要查询的图层,示例:"[{ "layerId":"0-0","where": "name='中国'", "outfields": "field1,field2"}]"</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type">
<a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>要素查询几何条件</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>distance</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
0
</td>
<td class="description last"><p>几何缓冲的距离,geometry为point、line时有效(若数据源为大数据PG数据,且geometryType为line或者point时为必填数据)</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>geometryPrecision</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>返回要素几何信息中坐标xy的精度</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>spatialRel</code></td>
<td class="type">
<span class="param-type">
<a link="SpatialRelation.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="SpatialRelation" global.html#SpatialRelation>SpatialRelation</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>几何条件的空间判定规则,Intersects(相交)、EnvelopeIntersects(外包矩形相交)、Contains(包含)、Disjoint(相离)</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>resultRecordCount</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
20
</td>
<td class="description last"><p>分页参数:结果返回条数,默认20</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnGeometry</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否返回几何,默认为true</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnAttribute</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
true
</td>
<td class="description last"><p>是否返回属性,默认为true</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnStyle</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>是否返回图形参数信息,默认为false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnIdsOnly</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>是否只返回id,默认为false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnCountOnly</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>是否只返回条数,默认为false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>returnZ</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
false
</td>
<td class="description last"><p>是否返回Z轴,默认为false</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>inSrs</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>输入几何空间参照系,支持MapGIS参照系名称、EPSG格式参考系、WKT格式参考系,具体请参考IGS的API文档</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>outSrs</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>输出几何空间参照系,支持MapGIS参照系名称、EPSG格式参考系,WKT格式参考系,具体请参考IGS的API文档</p></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code>GDBPOptions</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>基于矢量图层的要素查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>gdbp</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>图层的gdbp地址,允许多个图层,图层间用“,”号分隔,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type">
<a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>几何查询条件</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>where</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>where查询条件,类似sql语句</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>objectIds</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>需要查询的要素的OID值,OID为要素的唯一标识码,多个objectIds间以“,”分隔</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>page</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
0
</td>
<td class="description last"><p>返回的要素分页的页数,默认返回第0页</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>pageCount</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
20
</td>
<td class="description last"><p>要素结果集每页的记录数量,默认为20条/页</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>rule</code></td>
<td class="type">
<span class="param-type">
Object
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>指定查询规则,参数不区分大小写,各参数的代表含义如下:
CompareRectOnly表示是否仅比较要素的外包矩形,来判定是否与几何约束图形有交集;EnableDisplayCondition表示是否将隐藏图层计算在内;MustInside表示是否完全包含;Intersect表示是否相交</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>structs</code></td>
<td class="type">
<span class="param-type">
Object
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>指定查询结果的结构,参数不区分大小写,可以省略,默认为IncludeAttribute:true,其他参数均为false;IncludeAttribute:是否包含属性信息;IncludeGeometry:是否包含空间信息;IncludeWebGraphic:是否包含图形信息(显示参数信息)</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>orderField</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>排序字段名称,用于对输出结果进行排序,当ObjectIds有值时,orderField失效</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>isAsc</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>按照字段进行排序时,是否升序排列</p></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code>DocsOptions</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>基于矢量文档的要素查询</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>mapIndex</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>地图在文档下的序号,从0开始编号,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>layerIndexes</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>图层序号,多图层间以“,”号分隔,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type">
<a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>几何查询条件</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>where</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>where查询条件,类似sql语句</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>objectIds</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>需要查询的要素的OID值,OID为要素的唯一标识码,多个objectIds间以“,”分隔</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>page</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
0
</td>
<td class="description last"><p>返回的要素分页的页数,默认返回第0页</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>pageCount</code></td>
<td class="type">
<span class="param-type">
Number
</span>
</td>
<td class="default">
20
</td>
<td class="description last"><p>要素结果集每页的记录数量,默认为20条/页</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>rule</code></td>
<td class="type">
<span class="param-type">
Object
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>指定查询规则,参数不区分大小写,各参数的代表含义如下:
CompareRectOnly表示是否仅比较要素的外包矩形,来判定是否与几何约束图形有交集;EnableDisplayCondition表示是否将隐藏图层计算在内;MustInside表示是否完全包含;Intersect表示是否相交</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>structs</code></td>
<td class="type">
<span class="param-type">
Object
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>指定查询结果的结构,参数不区分大小写,可以省略,默认为IncludeAttribute:true,其他参数均为false;IncludeAttribute:是否包含属性信息;IncludeGeometry:是否包含空间信息;IncludeWebGraphic:是否包含图形信息(显示参数信息)</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>orderField</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>排序字段名称,用于对输出结果进行排序,当ObjectIds有值时,orderField失效</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>isAsc</code></td>
<td class="type">
<span class="param-type">
Boolean
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>按照字段进行排序时,是否升序排列</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>返回要素查询结果</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">
Promise.<Object>
</span>
</div>
</div>
</div>
</div>
<h5>示例</h5>
<p class="code-caption"><h5>IGS2.0的几何查询</h5></p>
<pre class="prettyprint"><code>featureServer.queryFeaturesInLayers({
// ES5引入方式
const { Polygon } = zondy.geometry
// ES6引入方式
import { Polygon } from "@mapgis/webclient-common"
// 几何查询条件
geometry: new Polygon({
coordinates: [
[
[110.74, 32.41],
[112.89, 31.06],
[110.15, 30.16],
[110.74, 32.41]
]
]
})
})
.then((res)=>{
console.log('查询成功:', res);
})
.catch((res)=>{
console.log('查询失败:', res);
})</code></pre>
<p class="code-caption"><h5>基于矢量文档的where查询</h5></p>
<pre class="prettyprint"><code>featureServer.queryFeaturesInLayers({
// 地图在文档下的序号,从0开始编号
mapIndex: 0,
// 图层序号,多图层间以“,”号分隔
layerIndexes: '1',
// where查询条件
where: "NAME='黄石市'"
})
.then((res)=>{
console.log('查询成功:', res);
})
.catch((res)=>{
console.log('查询失败:', res);
})</code></pre>
<p class="code-caption"><h5>基于矢量图层的where查询</h5></p>
<pre class="prettyprint"><code>featureServer.queryFeaturesInLayers({
// 图层的gdbp地址,允许多个图层,图层间用“,”号分隔
gdbp: 'gdbp://MapGisLocalPlus/ClientTheme/ds/epsg4326/sfcls/湖北省市级区划2',
// where查询条件
where: "NAME='天门市'",
})
.then((res)=>{
console.log('查询成功:', res);
})
.catch((res)=>{
console.log('查询失败:', res);
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="queryLayerInfo">
<a class="href-link" href="#queryLayerInfo">#</a>
<span class="code-name" id="queryLayerInfo" style="font-size:30px">
queryLayerInfo<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>获取要素服务图层信息,支持IGS1.0,IGS2.0</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
</td>
<td class="description last"><p>查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>layerId</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="description last"><p>图层id,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>failure</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>返回要素服务图层信息</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">
Promise.<Object>
</span>
</div>
</div>
</div>
</div>
<h5>示例</h5>
<p class="code-caption"><h5>获取要素服务图层信息</h5></p>
<pre class="prettyprint"><code>featureServer.queryLayerInfo({
// 图层id
layerId: '0'
})
.then((res)=>{
console.log('查询图层信息成功:', res)
})
.catch((res)=>{
console.log('查询图层信息失败:', res)
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="queryServerInfo">
<a class="href-link" href="#queryServerInfo">#</a>
<span class="code-name" id="queryServerInfo" style="font-size:30px">
queryServerInfo<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>获取服务信息,IGS2.0新增服务</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
无
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>failure</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
无
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="queryServerInfo" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#queryServerInfo" BaseServer.html#queryServerInfo>BaseServer#queryServerInfo</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<p class="code-caption"><h5>获取服务信息-回调方式</h5></p>
<pre class="prettyprint"><code>server.queryServerInfo({
success: function (result) {
console.log('请求成功:', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});</code></pre>
<p class="code-caption"><h5>获取服务信息-promise方式</h5></p>
<pre class="prettyprint"><code>server.queryServerInfo({
})
.then(function (result) {
console.log('请求成功:', result);
}).catch(function (result) {
console.log('请求失败:', result);
});</code></pre>
</div>
<div class="member">
<h4 class="name" id="updateFeature">
<a class="href-link" href="#updateFeature">#</a>
<span class="code-name" id="updateFeature" style="font-size:30px">
updateFeature<span class="signature">(options, GDBPOptions)</span>
</span>
</h4>
<div class="description">
<p>指定图层的要素更新,支持IGS2.0的要素更新服务、基于矢量图层的要素更新服务以及基于矢量文档的要素更新服务</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code>options</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>指定图层的要素更新参数,IGS2.0服务参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>layerId</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>图层id,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
FetchMethod.get
</td>
<td class="description last"><p>请求类型</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>failure</code></td>
<td class="type">
<span class="param-type">
function
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>features</code></td>
<td class="type">
<span class="param-type">
Array
</span>
</td>
<td class="default">
[]
</td>
<td class="description last"><p>要更新的要素集合,需要注意要素属性必须携带FID字段才能更新</p></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code>GDBPOptions</code></td>
<td class="type">
</td>
<td class="default">
</td>
<td class="description last"><p>基于矢量图层的要素更新参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>gdbp</code></td>
<td class="type">
<span class="param-type">
String
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>gdbp的url,仅支持单个数据库的要素更新,必传</p></td>
</tr>
<tr class="deep-level-1">
<td class="name"><code>featureSet</code></td>
<td class="type">
<span class="param-type">
Object
</span>
</td>
<td class="default">
</td>
<td class="description last"><p>要更新的要素集合,注意是igs1.0的格式,必传</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<div class='columns method-parameter'>
<div class="column is-2"><label>返回值</label></div>
<div class="column is-10">
<div class="columns">
<div class='param-desc column is-7'><p>返回图层更新结果</p></div>
<div class='column is-5 has-text-left'>
<label>类型: </label>
<span class="param-type">
Promise.<Object>
</span>
</div>
</div>
</div>
</div>
<h5>示例</h5>
<p class="code-caption"><h5>IGS2.0的要素更新示例</h5></p>
<pre class="prettyprint"><code>// 创建线要素
// ES5引入方式
const { Feature } = zondy
const { LineString } = zondy.geometry
// ES6引入方式
import { Feature } from "@mapgis/webclient-common"
const lineString = new Feature({
// 更新要素时需要传一个FID来指定要素,其他的属性值可以根据需求来盖面
attributes: { FID:'0' },
// 更新样式
symbol: {},
// 更新几何,注意几何一定要是GDBP表对应的几何类型
geometry: new LineString({
coordinates: [
[110.74, 32.41],
[112.89, 31.06],
[110.15, 30.16]
]
})
})
// 更新线要素
featureServer.updateFeature({
// 图层id
layerId: '1',
// 要更新的要素,支持一次更新多个要素
features: [lineString]
})
.then((res) => {
console.log('要素更新成功: ', res)
})
.catch((res) => {
console.log('要素更新失败: ', res)
})</code></pre>
<p class="code-caption"><h5>基于矢量图层的要素更新示例</h5></p>
<pre class="prettyprint"><code>// 初始化资源服务
// ES5引入方式
const { ResourceServer } = zondy.service
const { Feature } = zondy
const { Point } = zondy.geometry
// ES6引入方式
import { ResourceServer,Feature, Point} from "@mapgis/webclient-common"
const resourceServer = new ResourceServer({
// 目录服务基地址,port可填6163(.net服务)或者8089(Java服务)
url: 'http://localhost:6163/igs/rest/mrcs'
})
// 查询数据库表结构
resourceServer.queryGDBPInfo({
// 要查询的gdbp的url
gdbpUrl: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地'
})
.then((result) => {
// 表结构为result.data.FieldAtt
// 创建一个要素
const feature = new Feature({
// 设置更新要素的id
id: 1220,
// 设置几何,支持点、多点、线、多线、区、多区
geometry: new Point({
coordinates: [110.66482, 31.747766]
}),
// 更新属性
attributes: {
"CODE": "1",
"NAME": "新的神龙架林区",
"mpLayer": "0"
},
//更新样式
symbol: {
SymID": 43,
SymHeight": 3.200000047683716,
SymWidth": 3.200000047683716,
Angle": 0,
Color": 1467,
Color1": 4,
Color2": 3,
Space": 1,
OutPenW": [
0.1,
0.05,
0.05
]
}
})
// 创建更新要素的结构体
const featureSet = {
// 设置表结构,必填
AttStruct: result.data.FieldAtt,
// 设置要添加的要素,客串多个要素
SFEleArray: [feature.toOldIGSFeature()]
}
// 更新要素
featureServer.updateFeature({
// 更新要素的结构体
featureSet: featureSet,
// gdbo地址,仅支持单表添加
gdbp: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地'
})
.then((result) => {
console.log('更新要素成功:', result);
})
.catch((result) => {
console.log('更新要素失败:', result);
})
})
.catch((result) => {
console.log('查询GDBO失败:', result);
})</code></pre>
<p class="code-caption"><h5>基于矢量文档的要素更新示例</h5></p>
<pre class="prettyprint"><code>// 初始化资源服务
// ES5引入方式
const { ResourceServer } = zondy.service
const { Feature } = zondy
const { MultiPoint } = zondy.geometry
// ES6引入方式
import { ResourceServer,Feature,MultiPoint } from "@mapgis/webclient-common"
const resourceServer = new ResourceServer({
// 目录服务基地址,port可填6163(.net服务)或者8089(Java服务)
url: 'http://localhost:6163/igs/rest/mrcs'
})
// 查询数据库表结构
resourceServer.queryGDBPInfo({
// 要查询的gdbp的url
gdbpUrl: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地'
})
.then((result) => {
// 创建一个要素
const feature = new Feature({
// 设置要更新的要素id
id: 0,
// 设置几何,支持点、多点、线、多线、区、多区
geometry: new MultiPoint({
coordinates: [
[109.47509, 30.270342],
[111.27724, 30.706085]
]
}),
// 更新属性
attributes: {
"CODE": "0",
"Name": "多点",
"mpLayer": "0"
},
// 更新样式
symbol: {
"SymID": 43,
"SymHeight": 3.200000047683716,
"SymWidth": 3.200000047683716,
"Angle": 0,
"Color": 1467,
"Color1": 4,
"Color2": 3,
"Space": 1,
"OutPenW": [
0.1,
0.05,
0.05
]
}
})
// 创建更新要素的结构体
const featureSet = {
// 设置表结构,必填
AttStruct: result.data.FieldAtt,
// 设置要更新的要素,客串多个要素
SFEleArray: [feature.toOldIGSFeature()]
}
// 更新要素
featureServer.updateFeature({
// 更新要素的结构体
featureSet: featureSet,
// 地图在文档下的序号,从0开始编号
mapIndex: 0,
// 图层序号,从0开始编号
layerIndex: 2
})
.then((result) => {
console.log('更新要素成功:', result);
})
.catch((result) => {
console.log('更新要素失败:', result);
})
})
.catch((result) => {
console.log('查询GDBO失败:', result);
})</code></pre>
</div>
</div>
</div>
</article>
</section>