@mapgis/webclient-common
Version:
An important part of the MapGIS Client for JavaScript product, which provides interfaces and functions unrelated to the map engine.
9,107 lines • 189 kB
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<title> MapGIS Client for JavaScript API </title>
<script type="text/javascript">
</script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="scripts/jquery.min.js"></script>
<script src="scripts/adminlte/app.min.js"></script>
<link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="styles/adminlte/AdminLTE.min.css">
<link type="text/css" rel="stylesheet" href="styles/adminlte/skin-blue.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/common.css">
<link type="text/css" rel="stylesheet" href="styles/header.css">
<link type="text/css" rel="stylesheet" href="styles/examples.css">
<link type="text/css" rel="stylesheet" href="styles/style.customize.css">
<link type="text/css" rel="stylesheet" href="styles/font-awesome.css">
<link type="text/css" rel="stylesheet" href="styles/jaguar.css">
<script src="scripts/bootstrap.min.js"></script>
</head>
<body class='sidebar-mini'>
<div id="wrap" class="clearfix">
<header class="header-wrapper main-header mapgis-header">
<nav class="navbar navbar-static-top lite">
<div class="nav-header">
<div class="navbar-header">
<div class="navbar-title" style="display: flex;align-items: center; ">
<a href="index.html">
<img class="mapgis-webclient-logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAYAAACLz2ctAAAACXBIWXMAAAsSAAALEgHS3X78AAAgAElEQVR42u2de3gb5Z3vv+/Yjp2rFF8Sx5atsRMgpbRWC7Q9tF2rfbYtpZQYKBRoS4aWpeFWD3DKluW0Hvd2oGnppKHAlpsMIaSwgF3ucHaR95xuT7cPi10O5ZLYluI4duxcJ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KA+1gTD31wFd85l01AUxaiq97PlRfjpwiqhFI02LVbbvAmDz94EUe8y6aAKYtRd/pmlVfBvj33GkUaW69YEwKPNJi+nkmgAZDeM1zs+vLwW8cD/l5itZxiWreKRPAjIpw9TOivsaMtknnT599pj1+qennmQBm8eZ94+krQPQe7by8x7wbJoCmFKI1MW+BKSaAppgAmmKKCaApJoCmmJJN+f8yRATGNXIUUAAAAABJRU5ErkJggg==">
</a>
<a class="navbar-brand">
<span class="mapgis-webclient-text"> MapGIS Client for JavaScript(Common) </span>
</a>
<div id="suffix-title">for MapboxGL</div>
</div>
<button
type="button"
class="navbar-toggle collapsed"
data-toggle="collapse"
data-target="#navbar-collapse"
aria-expanded="false"
>
<i class="fa fa-bars"></i>
</button>
</div>
</div>
</nav>
</header>
<div class="navigationDiv">
</div>
<div class="main content-wrapper examples-container">
<h1 class="page-title" data-filename="GeometryEngine.html">Class: GeometryEngine</h1>
<section>
<header>
<h2></span>GeometryEngine
</h2>
</header>
<article>
<div class="container-overview">
<dt>
<div class="nameContainer">
<h4 class="name" id="GeometryEngine">
new GeometryEngine<span class="signature">()</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 18
</div>
</div>
<p class="summary"><h5>支持如下方法:</h5>
<a href='#contains'>[1、是否包含(contains)]</a><br/>
<a href='#crosses'>[2、是否穿过]</a><br/>
<a href='#cut'>[3、几何切割]</a><br/>
<a href='#difference'>[4、几何求差]</a><br/>
<a href='#disjoint'>[5、是否相离]</a><br/>
<a href='#equals'>[6、是否相等]</a><br/>
<a href='#intersects'>[7、是否相交]</a><br/>
<a href='#intersect'>[8、返回两个几何对象的相交部分]</a><br/>
<a href='#nearestCoordinate'>[9、距离最近的点]</a><br/>
<a href='#overlaps'>[10、是否重叠]</a><br/>
<a href='#planarArea'>[11、计算图面面积]</a><br/>
<a href='#geodesicArea'>[12、计算实地面积]</a><br/>
<a href='#planarLength'>[13、计算图面长度]</a><br/>
<a href='#geodesicLength'>[14、计算实地长度]</a><br/>
<a href='#rotate'>[15、旋转]</a><br/>
<a href='#distance'>[16、计算距离]</a><br/>
<a href='#touches'>[17、是否相邻]</a><br/>
<a href='#union'>[18、求并]</a><br/>
<a href='#within'>[19、是否被包含(within)]</a><br/>
<a href='#buffer'>[20、缓冲区分析]</a><br/>
<a href='#isSimple'>[21、拓扑检查]</a><br/>
<a href='#getPositionsFromArc'>[22、通过三点弧段构造一组离散的点坐标]</a><br/>
<a href='#getArcFromGeometry'>[23、通过几何中的三点弧段数据,构造离散后的几何对象]</a><br/>
<a href='#getCenter'>[24、通过三个点求圆心]</a><br/>
<a href='#getAngleFromPoints'>[25、计算三点之间的夹角]</a><br/>
<a href='#simplify'>[26、拓扑矫正]</a><br/>
<a href='#getCentroid'>[27、获取几何中心点]</a><br/>
<a href='#getLabelPoint'>[27、获取几何label点]</a><br/></p>
</dt>
<dd>
<div class="description">
<p>几何分析工具</p>
</div>
<dl class="details">
</dl>
</dd>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<div class="nameContainer">
<h4 class="name" id=".buffer">
GeometryEngine.buffer<span class="signature">(<span class="optional">geometry</span>, <span class="optional">distance</span>, <span class="optional">unit</span>, <span class="optional">unionResults</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Geometry.html">Geometry</a>|Array.<<a href="Geometry.html">Geometry</a>>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 555
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='buffer'></a>
缓冲区分析;<br/>
支持点几何、多点几何、线几何、多线几何、区几何、多区几何、矩形几何、圆形几何或任意几何组成的几何数组;<br/>
忽略三维高度,当geometry为几何数组时,其子元素的坐标系必须相同;<br/>
如果distance是数字,则可以为正值或负值,是正值则向外扩张,是负值,则表示向内收缩;<br/>
如果distance是数字,且geometry为几何数组,则该数字会应用到所有geometry数组的子元素;<br/>
如果distance是数组且geometry是数组,当distance的长度小于geometry数组的长度时,会以distance的最后一个子元素扩充distance数组,使其长度和geometry数组的长度相同,之后将distance数组和geometry数组根据下标一一对应,执行缓冲区分析;<br/>
如果distance是数组,但geometry不是数组,则使distance数组的第一个子元素做为缓冲距离来执行缓冲区分析;<br/>
注意一个或多个几何执行缓冲区分析后,由于缓冲后几何扩大,可能导致一个或多个几何出现重合的情况;;<br/>
示例如下:<br/>
<a href='#buffer1'>[1、区缓冲分析]</a><br/>
<a href='#buffer2'>[2、多区缓冲分析]</a><br/>
<a href='#buffer3'>[3、几何数组缓冲区分析]</a><br/>
<a href='#buffer4'>[4、几何数组缓冲区分析 - 结果几何合并]</a><br/>
<a href='#buffer5'>[5、区缓冲分析 - 自定义坐标系]</a><br/>
<a href='#buffer6'>[6、点缓冲分析]</a><br/>
<a href='#buffer7'>[7、线缓冲分析]</a><br/>
<a href='#buffer8'>[8、矩形缓冲分析]</a><br/>
<a href='#buffer9'>[9、圆形缓冲分析]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
|
<span class="param-type">Array.<<a href="Geometry.html">Geometry</a>></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>要进行缓冲区分析的几何对象</p></td>
</tr>
<tr>
<td class="name"><code>distance</code></td>
<td class="type">
<span class="param-type">Number</span>
|
<span class="param-type">Array.<Number></span>
</td>
<td class="default">
1000
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>缓冲距离</p></td>
</tr>
<tr>
<td class="name"><code>unit</code></td>
<td class="type">
<span class="param-type"><a href="LengthUnit.html">LengthUnit</a></span>
</td>
<td class="default">
<a href="LengthUnit.html#.meters">LengthUnit.meters</a>
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>单位,默认米</p></td>
</tr>
<tr>
<td class="name"><code>unionResults</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="default">
false
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>是否将返回的多个几何对象合并为单几何对象,默认为false,即不合并几何</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Geometry.html">Geometry</a>
|
Array.<<a href="Geometry.html">Geometry</a>>
</td>
<td class="description last">缓冲区分析后的几何对象</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='buffer1'>区缓冲分析</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造多边形
const polygon = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578],
]
]
})
// 执行缓冲区分析
const bufferedPolygon = GeometryEngine.buffer(polygon, 100000)</code></pre>
<p class="code-caption"><h5 id='rotate2'>多区缓冲分析</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiPolygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiPolygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造多边形
const polygon = new MultiPolygon({
coordinates: [
[
[
[108.36341, 29.032578],
[112.13094, 29.032578],
[112.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578],
]
],
[
[
[113.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[113.36341, 33.273224],
[113.36341, 29.032578],
]
]
]
})
// 执行缓冲区分析
const bufferedPolygon = GeometryEngine.buffer(polygon, 30000)</code></pre>
<p class="code-caption"><h5 id='buffer3'>几何对象数组的缓冲区分析</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, MultiPolygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, MultiPolygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造多边形
const polygon1 = new MultiPolygon({
coordinates: [
[
[
[110.36341, 29.032578],
[112.13094, 29.032578],
[112.13094, 33.273224],
[110.36341, 33.273224],
[110.36341, 29.032578],
]
],
[
[
[113.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[113.36341, 33.273224],
[113.36341, 29.032578],
]
]
]
})
// 构造多边形2
const polygon2 = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[109.13094, 29.032578],
[109.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578],
]
]
})
// 执行缓冲区分析,distance可谓数字或数组
const bufferedPolygon = GeometryEngine.buffer([polygon1, polygon2], [30000, 30000])</code></pre>
<p class="code-caption"><h5 id='buffer4'>几何数组缓冲区分析 - 分析结果几何求并</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, MultiPolygon, LengthUnit, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, MultiPolygon, LengthUnit, GeometryEngine } from "@mapgis/webclient-common"
// 构造多边形
const polygon1 = new MultiPolygon({
coordinates: [
[
[
[110.36341, 29.032578],
[112.13094, 29.032578],
[112.13094, 33.273224],
[110.36341, 33.273224],
[110.36341, 29.032578],
]
],
[
[
[113.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[113.36341, 33.273224],
[113.36341, 29.032578],
]
]
]
})
// 构造多边形2
const polygon2 = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[109.13094, 29.032578],
[109.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578],
]
]
})
// 执行缓冲区分析,设置unionResults参数为true
const bufferedPolygon = GeometryEngine.buffer([polygon1, polygon2], [30000], LengthUnit.meters, true)</code></pre>
<p class="code-caption"><h5 id='buffer5'>区缓冲分析 - 自定义坐标系</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, SpatialReference, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, SpatialReference, GeometryEngine } from "@mapgis/webclient-common"
// 构造多边形
const polygon = new Polygon({
coordinates: [
[
[-45257.10778559791, 3212885.1836444484],
[705989.8953363781, 3212885.1836444484],
[705989.8953363781, 3691623.86404564],
[-45257.10778559791, 3691623.86404564],
[-45257.10778559791, 3212885.1836444484],
]
],
// 注意要指定坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 执行缓冲区分析
const bufferedPolygon = GeometryEngine.buffer(polygon, 100000)</code></pre>
<p class="code-caption"><h5 id='buffer6'>点缓冲分析</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Point, GeometryEngine } from "@mapgis/webclient-common"
// 构造点几何
const point = new Point({
coordinates: [108.36341, 29.032578]
})
// 执行缓冲区分析
const bufferedPolygon = GeometryEngine.buffer(point, 100000)</code></pre>
<p class="code-caption"><h5 id='buffer7'>线缓冲分析</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造线
const lineString = new LineString({
coordinates: [
[108.36341, 29.032578],
[109.36341, 29.032578]
]
})
// 执行缓冲区分析
const bufferedPolygon = GeometryEngine.buffer(lineString, 10000)</code></pre>
<p class="code-caption"><h5 id='buffer8'>矩形缓冲分析</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造矩形
const extent = new Extent({
xmin: 112,
xmax: 114,
ymin: 30,
ymax: 32
})
// 执行缓冲区分析
const bufferedPolygon = GeometryEngine.buffer(extent, 10000)</code></pre>
<p class="code-caption"><h5 id='buffer9'>圆形缓冲分析</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Circle, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Circle, GeometryEngine } from "@mapgis/webclient-common"
// 构造圆形
const circle = new Circle({
center: [112, 30],
radius: 3
})
// 执行缓冲区分析
const bufferedPolygon = GeometryEngine.buffer(circle, 10000)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".contains">
GeometryEngine.contains<span class="signature">(<span class="optional">containerGeometry</span>, <span class="optional">insideGeometry</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 4144
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='contains'></a>
判断containerGeometry对象是否完全包含insideGeometry对象;<br/>
忽略三维高度;<br/>
支持自定义坐标系的几何对象,几何的坐标系必须相同;<br/>
包含标准如下:
点包含点的标准为:两个点几何坐标是否相等;<br/>
线包含线的标准为:一条线上的点都在另一条线上,或两条线的点坐标相同;<br/>
区包含线的标准为:线在区几何内,但线不全部在区几何边线上(包括内圈和外圈的边线);<br/>
区包含线的标准为:点在区几何内,不在边线上(包括内圈和外圈的边线);<br/>
区包含区的标准为:一个区在另一个区内(如果有带洞区域,则不能在带洞区域内,可以挨着边线),边线可以重合;<br/>
其他情况为上述标准的组合;<br/>
由于包含的情况太多,这里仅列举部分示例,示例如下:<br/>
<a href='#intersects1'>[1、区包含点]</a><br/>
<a href='#intersects2'>[2、多点包含点]</a><br/>
<a href='#intersects3'>[3、区包含线]</a><br/>
<a href='#intersects4'>[4、圆包含矩形]</a><br/>
<a href='#intersects5'>[5、几何包含 - 自定义坐标系]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>containerGeometry</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>包含几何对象</p></td>
</tr>
<tr>
<td class="name"><code>insideGeometry</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>被包含的几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Boolean
</td>
<td class="description last">是否包含</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='contains1'>区包含点</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, Point, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Polygon, Point } from "@mapgis/webclient-common"
// 初始点几何,可以是任意几何
const point = new Point({
coordinates: [1, 1]
})
// 初始化区几何,可以是任意几何
const polygon = new Polygon({
coordinates: [
[
[1, 0],
[10, 0],
[10, 20],
[1, 20],
[1, 0]
]
]
})
// 判断区几何是否包含点几何对象
const isContains = GeometryEngine.contains(polygon, point)
console.log("区是否包含点:", isContains)</code></pre>
<p class="code-caption"><h5 id='contains2'>多点包含点</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiPoint, Point, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiPoint, Point, GeometryEngine } from "@mapgis/webclient-common"
// 初始点几何
const point = new Point({
coordinates: [1, 1]
})
// 初始化多点几何
const multiPoint = new MultiPoint({
coordinates: [
[1, 1],
[1, 2]
]
})
// 判断多点几何是否包含点几何对象
const isContains = GeometryEngine.contains(multiPoint, point)
console.log("多点是否包含点:", isContains)</code></pre>
<p class="code-caption"><h5 id='contains3'>区包含线</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, LineString, GeometryEngine } from "@mapgis/webclient-common"
// 初始化区几何
const polygon = new Polygon({
coordinates: [
[
[1, 0],
[10, 0],
[10, 20],
[1, 20],
[1, 0]
]
]
})
// 初始化线几何
const lineString = new LineString({
coordinates: [
[1, 0],
[1, 6]
]
})
// 判断多点几何是否包含点几何对象
const isContains = GeometryEngine.contains(polygon, lineString)
console.log("区是否包含线:", isContains)</code></pre>
<p class="code-caption"><h5 id='contains4'>圆包含矩形</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Circle, LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Circle, LineString, GeometryEngine } from "@mapgis/webclient-common"
// 初始化圆几何
const circle = new Circle({
center: [5, 5],
radius: 2
})
// 初始化矩几何
const extent = new Extent({
xmin: 2,
ymin: 2,
xmax: 4,
ymax: 4
})
// 判断多点几何是否包含点几何对象
const isContains = GeometryEngine.contains(circle, extent)
console.log("圆是否包含矩形:", isContains)</code></pre>
<p class="code-caption"><h5 id='contains5'>几何包含 - 自定义坐标系</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, LineString, SpatialReference, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, LineString, SpatialReference, GeometryEngine } from "@mapgis/webclient-common"
// 初始化线几何对象
const line = new LineString({
coordinates: [
[60000, 3426025],
[598545, 3426025]
],
// 要设置坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 初始化区几何对象
const polygon = new Polygon({
coordinates: [
[
[0, 3226025],
[698545, 3226025],
[698545, 3685076],
[0, 3685076],
[0, 3226025]
],
[
[100000, 3326025],
[598545, 3326025],
[598545, 3485076],
[100000, 3485076],
[100000, 3326025]
]
],
// 要设置坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 判断多点几何是否包含点几何对象
const isContains = GeometryEngine.contains(circle, extent)
console.log("圆是否包含矩形:", isContains)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".crosses">
GeometryEngine.crosses<span class="signature">(geometry1, geometry2)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 5565
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='crosses'></a>
判断一个几何对象是否穿过另一个几何对象;<br/>
要穿过的几何类型为:线、多线,忽略三维高度;<br/>
被穿过的几何类型为:线、多线、矩形、圆、区以及多区,忽略三维高度,穿线和被穿过几何的坐标系必须相同;<br/>
要穿过的几何与被穿过的几何(geometry1和geometry2)可以调换输入,但其中一个geometry必须是LineString、MultiLineString中的一类;<br/>
当被穿过的几何类型为MultiLineString、MultiPolygon时,只要MultiLineString和MultiPolygon中有一个要素被穿过,就算穿过,返回true;<br/>
当要穿过的几何类型为MultiLineString时,只要MultiLineString中有一条线穿过geometry2(被穿过的几何体),就算穿过,返回true;<br/>
如果两条线出现重叠,此种情况不算穿过,返回false;<br/
如果两条线出现“入”型、“L”型,此种情况不算穿过,返回false;<br/>
线与圆相切的情况不算穿过,返回false;<br/>
线和多边形的一条边重叠,算穿过,返回true;<br/>
当polygon有内圈时,只要穿过外圈就算穿过,返回true;<br/>
示例如下:<br/>
<a href='#cross1'>[1、线穿过线]</a><br/>
<a href='#cross2'>[2、线穿过多线]</a><br/>
<a href='#cross3'>[3、线穿过区]</a><br/>
<a href='#cross4'>[4、多线穿过区]</a><br/>
<a href='#cross5'>[5、多线穿过多区]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
</td>
<td class="description last">
<p>第一个几何体,支持线、多线;</p></td>
</tr>
<tr>
<td class="name"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
</td>
<td class="description last">
<p>第二个几何体,支持线、多线、面、多面、圆、矩形,两个参数可以调换输入,但其中一个geometry必须是LineString、MultiLineString中的一类;</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Boolean
</td>
<td class="description last">是否穿过</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='cross1'>线穿过线</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造要穿过的线对象
const line1 = new LineString({
coordinates: [
[108.36341, 29.032578],
[116.13094, 29.032578]
]
})
// 构造被穿过的线对象
const line2 = new LineString({
coordinates: [
[110, 28],
[110, 30],
[111, 30],
[111, 28]
]
})
// 开始判断穿过
const cross = GeometryEngine.crosses(line1, line2)
console.log("线是否穿过线:", cross)</code></pre>
<p class="code-caption"><h5 id='cross2'>线穿过多线</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, MultiLineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, MultiLineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造要穿过的线对象
const line1 = new LineString({
coordinates: [
[108.36341, 29.032578],
[116.13094, 29.032578]
]
})
// 构造被穿过的多线对象
const multiLineString = new MultiLineString({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578]
],
[
[108.36341, 29.332578],
[116.13094, 29.332578]
]
]
})
// 开始判断穿过
const cross = GeometryEngine.crosses(line1, multiLineString)
console.log("线是否穿过多线:", cross)</code></pre>
<p class="code-caption"><h5 id='cross3'>线穿过区</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造要穿过的线对象
const line = new LineString({
coordinates: [
[110, 28],
[110, 34],
[111, 34],
[112, 28]
]
})
// 构造被穿过的区对象
const polygon = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578],
],
[
[109, 29.5],
[112, 29.5],
[112, 32],
[109, 32],
[109, 29.5],
]
]
})
// 开始判断穿过
const cross = GeometryEngine.crosses(line,polygon)
console.log("线是否穿过区:", cross)</code></pre>
<p class="code-caption"><h5 id='cross4'>多线穿过区</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiLineString, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiLineString, Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造要穿过的多线对象
const multiLineString = new MultiLineString({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578]
],
[
[108.36341, 29.332578],
[116.13094, 29.332578]
]
]
})
// 构造被穿过的区对象
const polygon = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578],
],
[
[109, 29.5],
[112, 29.5],
[112, 32],
[109, 32],
[109, 29.5],
]
]
})
// 开始判断穿过
const cross = GeometryEngine.crosses( multiLineString,polygon)
console.log("多线是否穿过区:", cross)</code></pre>
<p class="code-caption"><h5 id='cross5'>多线穿过多区</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiLineString, MultiPolygon, SpatialReference, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiLineString, MultiPolygon, SpatialReference, GeometryEngine } from "@mapgis/webclient-common"
// 构造要穿过的多线对象
const multiLineString = new MultiLineString({
coordinates: [
[
[-49522.6942635386, 3226025.20474049],
[707596.826929215, 3214754.20105]
],
[
[-47918.3624481045, 3259361.82328017],
[707596.826929215, 3259361.82328017]
]
],
// 必须指定坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 构造被穿过的多区
const multiPolygon = new MultiPolygon({
coordinates: [
[
[
[-47918.3624481045, 3214754.20105],
[707596.826929215, 3214754.20105],
[707596.826929215, 3685076.66188228],
[-47918.3624481045, 3685076.66188228],
[-47918.3624481045, 3214754.20105]
],
[
[14849.3479447439, 3275130.08942507],
[310996.760637403, 3275130.08942507],
[310996.760637403, 3543600.9315051],
[14849.3479447439, 3543600.9315051],
[14849.3479447439, 3275130.08942507],
]
],
[
[
[813421.283605543, 3214754.20105],
[1071620.19329204, 3214754.20105],
[1071620.19329204, 3685076.66188228],
[813421.283605543, 3685076.66188228],
[813421.283605543, 3214754.20105]
]
]
],
// 必须指定坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 开始判断穿过
const cross = GeometryEngine.crosses(multiLineString, multiPolygon)
console.log("多线是否穿过多区:", cross)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".cut">
GeometryEngine.cut<span class="signature">(geometry, cutter)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Array.<<a href="Geometry.html">Geometry</a>>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 6727
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='cut'></a>
使用一条线来切割几何,将其分割为多个几何对象;<br/>
被切割的几何类型为:线、多线、区以及多区,忽略三维高度,切线和被切割几何的坐标系必须相同;<br/>
此接口不会像arcgis的geometryEngine.cut方法那样,返回切割线左右两边的几何对象数组,而是把所有的被切割好的几何组成一个数组并返回;<br/>
如果切割线和被切割几何没有相交,则会返回一个空数组;<br/>
线切割线会返回被切割后的线几何数组;<br/>
线切割多线仅会返回被切割后的线几何数组,如果多线中的某一个线段不与切割线相交,则不会返回该线段几何;<br/>
线切割区会返回被切割后的区几何数组,如果切线仅仅是部分和区相交,但是没有穿过几何,会返回一个仅包含该区几何对像的数组;<br/>
线切割多区仅会返回被切割后的区几何数组,如果多区中的某一个区不与切割线相交,则不会返回该区几何;<br/>
示例如下:<br/>
<a href='#cut1'>[1、线切割线]</a><br/>
<a href='#cut2'>[2、线切割多线]</a><br/>
<a href='#cut3'>[3、线切割区]</a><br/>
<a href='#cut4'>[4、线切割多区]</a><br/>
<a href='#cut5'>[5、几何切割 - 自定义坐标系]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
</td>
<td class="description last">
<p>被切割的区对象</p></td>
</tr>
<tr>
<td class="name"><code>cutter</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
</td>
<td class="description last">
<p>切割线几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Array.<<a href="Geometry.html">Geometry</a>>
</td>
<td class="description last">切割后的几何数组</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='cut1'>线切割线</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造被切割的线对象
const line = new LineString({
coordinates: [
[108.36341, 29.032578],
[116.13094, 29.032578]
]
})
// 构造切割线对象
const cutter = new LineString({
coordinates: [
[110, 28],
[110, 30],
[111, 30],
[111, 28]
]
})
// 开始切割线
const cut = GeometryEngine.cut(line, cutter)
console.log("切割后的几何数组:", cut)</code></pre>
<p class="code-caption"><h5 id='cut2'>线切割多线</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, MultiLineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, MultiLineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造被切割的多线对象
const line = new MultiLineString({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578]
],
[
[108.36341, 29.332578],
[116.13094, 29.332578]
]
]
})
// 构造切割线对象
const cutter = new LineString({
coordinates: [
[110, 28],
[110, 30],
[111, 30],
[112, 28]
]
})
// 开始切割线
const cut = GeometryEngine.cut(line, cutter)
console.log("切割后的几何数组:", cut)</code></pre>
<p class="code-caption"><h5 id='cut3'>线切割区</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造被切割的区对象
const polygon = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578],
],
[
[109, 29.5],
[112, 29.5],
[112, 32],
[109, 32],
[109, 29.5],
]
]
})
// 构造切割线对象
const cutter = new LineString({
coordinates: [
[110, 28],
[110, 34],
[111, 34],
[112, 28]
]
})
// 开始切割区
const cut = GeometryEngine.cut(polygon, cutter)
console.log("切割后的几何数组:", cut)</code></pre>
<p class="code-caption"><h5 id='cut4'>线切割多区</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, MultiPolygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, MultiPolygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造被切割的多区
const polygon = new MultiPolygon({
coordinates: [
[
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578]
],
[
[109, 29.5],
[112, 29.5],
[112, 32],
[109, 32],
[109, 29.5],
]
],
[
[
[117.36341, 29.032578],
[120.13094, 29.032578],
[120.13094, 33.273224],
[117.36341, 33.273224],
[117.36341, 29.032578]
]
]
]
})
// 构造切割线对象
const cutter = new LineString({
coordinates: [
[110, 28],
[110, 34],
[111, 34],
[112, 28],
[118, 28],
[119, 34]
]
})
// 开始切割多区
const cut = GeometryEngine.cut(polygon, cutter)
console.log("切割后的几何数组:", cut)</code></pre>
<p class="code-caption"><h5 id='cut5'>几何切割 - 自定义坐标系</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, Polygon, SpatialReference, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, Polygon, SpatialReference, GeometryEngine } from "@mapgis/webclient-common"
// 构造被切割的区对象
const polygon = new Polygon({
coordinates: [
[
[0, 3226025],
[698545, 3226025],
[698545, 3685076],
[0, 3685076],
[0, 3226025]
],
[
[100000, 3326025],
[598545, 3326025],
[598545, 3485076],
[100000, 3485076],
[100000, 3326025]
]
],
// 必须指定坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 构造切割线对象
const cutter = new LineString({
coordinates: [
[106372, 3104899],
[130347, 3770883],
[222797, 3767721],
[303253, 3100054]
],
// 必须指定坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 开始切割区
const cut = GeometryEngine.cut(polygon, cutter)
console.log("切割后的几何数组:", cut)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".difference">
GeometryEngine.difference<span class="signature">(inputGeometry, subtractGeometry)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Polygon.html">Polygon</a>|<a href="MultiPolygon.html">MultiPolygon</a>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 211
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='difference'></a>
几何求差,即返回inputGeometry几何对象减去subtractGeometry几何对象之后的部分;<br/>
支持区、多区、矩形和圆形之间进行相互求差;<br/>
支持自定义坐标系几何,忽略三维高度;<br/>
求差后可能返回一个区几何或一个多区几何或者一个空对象;<br/>
由于示例太多,仅列举部分示例,示例如下:<br/>
<a href='#difference1'>[1、区和区求差]</a><br/>
<a href='#difference2'>[2、区和多区求差]</a><br/>
<a href='#difference3'>[3、多区和圆形求差]</a><br/>
<a href='#difference4'>[4、矩形和圆求差]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>inputGeometry</code></td>
<td class="type">
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
</td>
<td class="description last">
<p>被求差几何对象</p></td>
</tr>
<tr>
<td class="name"><code>subtractGeometry</code></td>
<td class="type">
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
</td>
<td class="description last">
<p>求差几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Polygon.html">Polygon</a>
|
<a href="MultiPolygon.html">MultiPolygon</a>
</td>
<td class="description last">求差后的几何对象</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='difference1'>区和区求差</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造第一个区
const polygon1 = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578]
]
]
})
// 构造第二个区
onst polygon2 = new Polygon({
coordinates: [
[
[109.36341, 30.032578],
[115.13094, 30.032578],
[115.13094, 32.273224],
[109.36341, 32.273224],
[109.36341, 30.032578]
],
[
[110.36341, 31.032578],
[114.13094, 31.032578],
[114.13094, 31.5],
[110.36341, 31.5],
[110.36341, 31.032578]
]
]
})
// 开始求差
const geometry = GeometryEngine.difference(polygon1, polygon2)
console.log("区和区求差:", geometry)</code></pre>
<p class="code-caption"><h5 id='difference2'>区和多区求差</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, MultiPolygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, MultiPolygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造第一个区
const polygon1 = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578]
]
]
})
// 构造第二个区
const polygon2 = new MultiPolygon({
coordinates: [
[
[
[109.36341, 30.032578],
[110.13094, 30.032578],
[110.13094, 32.273224],
[109.36341, 32.273224],
[109.36341, 30.032578]
]
],
[
[
[111.36341, 30.032578],
[112.13094, 30.032578],
[112.13094, 32.273224],
[111.36341, 32.273224],
[111.36341, 30.032578]
]
]
]
})
// 开始求差
const geometry = GeometryEngine.difference(polygon1, polygon2)
console.log("区和多区求差:", geometry)</code></pre>
<p class="code-caption"><h5 id='difference3'>多区和圆形求差</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiPolygon, Circle, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiPolygon, Circle,GeometryEngine } from "@mapgis/webclient-common"
// 构造多区几何
const polygon = new MultiPolygon({
coordinates: [
[
[
[108.36341, 29.032578],
[110.13094, 29.032578],
[110.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578]
]
],
[
[
[111.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[111.36341, 33.273224],
[111.36341, 29.032578]
]
]
]
})
// 构造圆几何
const circle = new Circle({
center: [112.247175, 31.152901],
radius: 2
})
// 开始求差
const geometry = GeometryEngine.difference(polygon, circle)
console.log("多区和圆求差:", geometry)</code></pre>
<p class="code-caption"><h5 id='difference4'>矩形和圆求差</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Extent, Circle, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Extent, Circle,GeometryEngine } from "@mapgis/webclient-common"
// 构造矩形对象
const extent = new Extent({
xmin: 108.36341,
ymin: 29.032578,
xmax: 116.13094,
ymax: 33.273224
})
// 构造圆形对象
const circle = new Circle({
center: [112.247175, 31.152901],
radius: 2
})
// 开始求差
const geometry = GeometryEngine.difference(extent, circle)
console.log("矩形和圆求差:", geometry)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".discretizeThreePointArc">
GeometryEngine.discretizeThreePointArc<span class="signature">(options)</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 7631
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='discretizeThreePointArc'></a>
将三点弧段离散为点坐标</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<p>离散参数</p>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>startPoint</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
</td>
<td class="description last">
<p>弧段起点</p></td>
</tr>
<tr>
<td class="name"><code>middlePoint</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
</td>
<td class="description last">
<p>弧段中点</p></td>
</tr>
<tr>
<td class="name"><code>endPoint</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
</td>
<td class="description last">
<p>弧段终点</p></td>
</tr>
<tr>
<td class="name"><code>discretizationOptions</code></td>
<td class="type">
<span class="param-type"><a href="DiscretizationOptions.html">DiscretizationOptions</a></span>
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>额外离散参数</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".disjoint">
GeometryEngine.disjoint<span class="signature">(<span class="optional">geometry1</span>, <span class="optional">geometry2</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 5312
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='disjoint'></a>
判断两个几何是否相离,即完全不相交;<br/>
支持自定义坐标系几何对象,两个几何对象的坐标系要一致,忽略三维高度;<br/>
示例如下:<br/>
<a href='#disjoint1'>[是否相离]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>第一个几何对象</p></td>
</tr>
<tr>
<td class="name"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>第二个几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Boolean
</td>
<td class="description last">是否相离</td>
</tr>
</tbody>
</table>
<h5>Example</h5>
<p class="code-caption"><h5 id='disjoint1'>是否相离</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造线几何对象
const line = new LineString({
coordinates: [
[113, 28],
[113, 34]
]
})
// 构造区几何对象
const polygon = new Polygon({
coordinates: [
[
[108, 30],
[115, 30],
[115, 33],
[108, 33],
[108, 30]
],
[
[110, 31],
[113, 31],
[113, 32],
[110, 32],
[110, 31]
]
]
})
// 开始求交
const isIntersect = GeometryEngine.disjoint(line, polygon)
console.log("是否相离:", isIntersect)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".distance">
GeometryEngine.distance<span class="signature">(geometry1, geometry2, unit)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Number}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 4903
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='distance'></a>
计算两点之间的距离,坐标系取第一个图层的坐标系</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
</td>
<td class="description last">
<p>第一个几何体,需为point</p></td>
</tr>
<tr>
<td class="name"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
|
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPoint.html">MultiPoint</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
</td>
<td class="description last">
<p>第二个几何体,可以为点、多点、线、多线、面、多面、圆、矩形</p></td>
</tr>
<tr>
<td class="name"><code>unit</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">
<p>单位,默认为"kilometers"</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Number
</td>
<td class="description last">距离</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5>点和点求距离</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Point } from "@mapgis/webclient-common"
// 点和点求距离
const point1 = new Point({
coordinates: [1, 1]
})
const point2 = new Point({
coordinates: [2, 1]
})
// 可以不传递单位,不传递时默认单位为 "kilometers"
const pointDistance = GeometryEngine.distance(point1, point2);
console.log("点和点求距离:", pointDistance)
// 可以传单位,如传入单位 'miles'
const pointDistance2 = GeometryEngine.distance(point1, point2, "miles")
console.log("点和点求距离(设置单位为"miles"):", pointDistance)</code></pre>
<p class="code-caption"><h5>点和线求距离</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Point, LineString } from "@mapgis/webclient-common"
// 点和线求距离
const point1 = new Point({
coordinates: [100.0, 100.0]
})
const lineString = new LineString({
coordinates: [
[100.0, 200.0],
[101.0, 201.0],
[103.0, 203.0],
],
})
const pointToLineDistance = GeometryEngine.distance(point1, lineString);
console.log("点和线求距离:", pointToLineDistance)</code></pre>
<p class="code-caption"><h5>点和面求距离</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Point, Polygon } from "@mapgis/webclient-common"
// 点和面求距离
const point1 = new Point({
coordinates: [100.0, 100.0]
})
const polygon = new Polygon({
coordinates: [
[
[100.0, 0.0],
[101.0, 0.0],
[101.0, 1.0],
[100.0, 1.0],
[100.0, 0.0],
],
],
});
const pointToPolygonDistance = GeometryEngine.distance(point1, polygon);
console.log("点和面求距离:", pointToPolygonDistance)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".equals">
GeometryEngine.equals<span class="signature">(<span class="optional">geometry1</span>, <span class="optional">geometry2</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 5087
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='equals'></a>
判断两个几何是否相等;<br/>
使用如下判断标准:<br/>
1、类型是否相等;<br/>
2、坐标系是否相等;<br/>
3、两个几何的坐标点是否相等;<br/>
支持任意几何类型;<br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>第一个几何对象</p></td>
</tr>
<tr>
<td class="name"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>第二个几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Boolean
</td>
<td class="description last">是否相等</td>
</tr>
</tbody>
</table>
<h5>Example</h5>
<p class="code-caption"><h5>判断几何是否相等</h5></p>
<pre class="prettyprint"><code>const isEquals = GeometryEngine.equals(new Point({
coordinates: [1, 10]
}), new Point({
coordinates: [1, 10]
}))
console.log("点和点是否相同:", isEquals)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".geodesicArea">
GeometryEngine.geodesicArea<span class="signature">(geometry, <span class="optional">unit</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Number}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 1632
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='geodesicArea'></a>
计算几何的实地面积;<br/>
支持自定义坐标系,忽略三维高度;<br/>
支持区、多区、矩形和圆形几何对象;<br/>
当为区或多区几何对象时,若该区带洞或多区的子区带洞,则会减去这些洞的面积;<br/>
示例如下:<br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
</td>
<td class="default">
</td>
<td class="description last">
<p>计算面积的几何对象</p></td>
</tr>
<tr>
<td class="name"><code>unit</code></td>
<td class="type">
<span class="param-type"><a href="AreaUnits.html">AreaUnits</a></span>
</td>
<td class="default">
<a href="AreaUnits.html#.squareMeters">AreaUnits.squareMeters</a>
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>返回值的单位</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Number
</td>
<td class="description last">几何对象的实地面积</td>
</tr>
</tbody>
</table>
<h5>Example</h5>
<p class="code-caption"><h5>计算区面积</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Polygon, LengthUnit } from "@mapgis/webclient-common"
// 初始化区几何
const polygon = new Polygon({
coordinates: [
[
[100, 30],
[110, 30],
[110, 40],
[100, 40],
[100, 30]
]
]
})
// 计算区几何面积
const area = GeometryEngine.geodesicArea(polygon)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".geodesicLength">
GeometryEngine.geodesicLength<span class="signature">(<span class="optional">geometry</span>, <span class="optional">unit</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Number}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 1541
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='geodesicLength'></a>
计算几何的实地长度;<br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>几何对象</p></td>
</tr>
<tr>
<td class="name"><code>unit</code></td>
<td class="type">
<span class="param-type"><a href="LengthUnit.html">LengthUnit</a></span>
</td>
<td class="default">
<a href="LengthUnit.html#.meters">LengthUnit.meters</a>
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>单位,默认米</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Number
</td>
<td class="description last">几何对象的实地长度</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".getAngleFromPoints">
GeometryEngine.getAngleFromPoints<span class="signature">(pointA, pointB, pointC)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Number}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 8029
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='getAngleFromPoints'></a>
计算三点之间的夹角</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pointA</code></td>
<td class="type">
<span class="param-type">Array.<Number></span>
</td>
<td class="description last">
<p>第一个点</p></td>
</tr>
<tr>
<td class="name"><code>pointB</code></td>
<td class="type">
<span class="param-type">Array.<Number></span>
</td>
<td class="description last">
<p>第二个点</p></td>
</tr>
<tr>
<td class="name"><code>pointC</code></td>
<td class="type">
<span class="param-type">Array.<Number></span>
</td>
<td class="description last">
<p>第三个点</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Number
</td>
<td class="description last">角度</td>
</tr>
</tbody>
</table>
<h5>Example</h5>
<p class="code-caption"><h5>计算三点之间的夹角</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine } from "@mapgis/webclient-common"
// 计算三点之间的夹角
const angle = GeometryEngine.getAngleFromPoints([1, 2], [1, 1], [2, 1])</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".getArcFromGeometry">
GeometryEngine.getArcFromGeometry<span class="signature">(options)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="LineString.html">LineString</a>|<a href="MultiLineString.html">MultiLineString</a>|<a href="Polygon.html">Polygon</a>|<a href="MultiPolygon.html">MultiPolygon</a>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 8109
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='getArcFromGeometry'></a>
通过几何中的三点弧段数据,构造离散后的几何对象,类型与原始对象一致</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<p>构造参数</p>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>带三点弧段数据的几何对象</p></td>
</tr>
<tr>
<td class="name"><code>arcInfo</code></td>
<td class="type">
<span class="param-type">Array.<Object></span>
</td>
<td class="default">
[]
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>弧段信息参数</p></td>
</tr>
<tr>
<td class="name"><code>numberOfPoints</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
360
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>弧段中点的数量,注意这个是圆弧的数量,意思是将圆分成360份,如果这个弧段的度数为120度,则有
360 * (120/360) = 120段</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="LineString.html">LineString</a>
|
<a href="MultiLineString.html">MultiLineString</a>
|
<a href="Polygon.html">Polygon</a>
|
<a href="MultiPolygon.html">MultiPolygon</a>
</td>
<td class="description last">离散后的新几何对象</td>
</tr>
</tbody>
</table>
<h5>Example</h5>
<p class="code-caption"><h5>通过几何中的三点弧段数据,构造离散后的几何对象</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, SpatialReference, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, SpatialReference, GeometryEngine } from "@mapgis/webclient-common"
// 构造一个线几何,其他几何对象同线几何对象
const line = new LineString({
// 几何坐标点
coordinates: [
[
64.15012768690451,
89.23584703643573
],
[
85.69715379735212,
62.63186581843408
],
[
92.51304981188144,
62.851733431806025
],
[
92.51304981188144,
62.851733431806025
],
[
64.15012768690451,
89.23584703643573
]
],
// 几何的参考系,默认是4326,非4326坐标系请指定参考系
spatialReference: new SpatialReference('EPSG:4326')
})
// 通过几何中的三点弧段数据,构造离散后的几何对象
const arcLine = GeometryEngine.getArcFromGeometry({
// 几何对象
geometry: line,
// 弧段信息参数,必填项
arcInfo: [
{
"centerPointIndex": 1,
"ringIndex": 0
}
],
// 弧段中点的数量
numberOfPoints: 360
})</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".getCenter">
GeometryEngine.getCenter<span class="signature">(point1, point2, point3, hasZ)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Array.<Number>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 7805
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='getCenter'></a>
通过三个点求圆心,数学公式,不用进行投影</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>point1</code></td>
<td class="type">
<span class="param-type">Array.<Number></span>
</td>
<td class="description last">
<p>第一个点坐标</p></td>
</tr>
<tr>
<td class="name"><code>point2</code></td>
<td class="type">
<span class="param-type">Array.<Number></span>
</td>
<td class="description last">
<p>第二个点坐标</p></td>
</tr>
<tr>
<td class="name"><code>point3</code></td>
<td class="type">
<span class="param-type">Array.<Number></span>
</td>
<td class="description last">
<p>第三个点坐标</p></td>
</tr>
<tr>
<td class="name"><code>hasZ</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last">
<p>是否含有z值</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Array.<Number>
</td>
<td class="description last">圆心坐标</td>
</tr>
</tbody>
</table>
<h5>Example</h5>
<p class="code-caption"><h5>通过三个点求圆心</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine } from "@mapgis/webclient-common"
// 计算圆心
const center = GeometryEngine.getCenter([1, 2], [2, 1], [1, 0])</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".getCenterPoint">
GeometryEngine.getCenterPoint<span class="signature">(geometry)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Point.html">Point</a>|null}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 8906
</div>
</div>
</dt>
<dd>
<div class="description">
<p>获取几何中心点
<a id='getCenterPoint'></a></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
|
<span class="param-type"><a href="MultiPoint.html">MultiPoint</a></span>
|
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
</td>
<td class="description last">
<p>要计算中心点的几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Point.html">Point</a>
|
null
</td>
<td class="description last">中心点几何对象。如果未找到中心点,则返回空</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".getCentroid">
GeometryEngine.getCentroid<span class="signature">(geometry)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Point.html">Point</a>|null}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 8916
</div>
</div>
</dt>
<dd>
<div class="description">
<p>获取几何质心
<a id='getCentroid'></a></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
|
<span class="param-type"><a href="MultiPoint.html">MultiPoint</a></span>
|
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
</td>
<td class="description last">
<p>要计算质心点的几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Point.html">Point</a>
|
null
</td>
<td class="description last">质心点几何对象。如果未找到质心点,则返回空</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".getEllipseCoordinates">
GeometryEngine.getEllipseCoordinates<span class="signature">(center, semiMajorAxis, semiMinorAxis, number)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Array}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 8874
</div>
</div>
</dt>
<dd>
<div class="description">
<p>获取椭圆离散化点坐标
<a id='simplify'></a></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>center</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
</td>
<td class="description last">
<p>椭圆中心</p></td>
</tr>
<tr>
<td class="name"><code>semiMajorAxis</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
<p>主轴半径(水平方向)</p></td>
</tr>
<tr>
<td class="name"><code>semiMinorAxis</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
<p>副轴半径(竖直方向)</p></td>
</tr>
<tr>
<td class="name"><code>number</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
<p>离散点数量</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Array
</td>
<td class="description last">离散点坐标数组</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".getLabelPoint">
GeometryEngine.getLabelPoint<span class="signature">(geometry)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Point.html">Point</a>|null}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 9007
</div>
</div>
</dt>
<dd>
<div class="description">
<p>获取几何label点
<a id='getLabelPoint'></a></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
</td>
<td class="description last">
<p>要计算label点的几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Point.html">Point</a>
|
null
</td>
<td class="description last">label点对象。如果未找到label点,则返回空</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".getPositionsFromArc">
GeometryEngine.getPositionsFromArc<span class="signature">(options)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Array}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 7537
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='getPositionsFromArc'></a>
通过三点弧段构造一组离散的弧段点坐标,此组离散点是线几何的点坐标</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<p>构造参数</p>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>point1</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
|
<span class="param-type">Array.<Number></span>
</td>
<td class="default">
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>弧段上的第一个点,弧段的起点</p></td>
</tr>
<tr>
<td class="name"><code>point2</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
|
<span class="param-type">Array.<Number></span>
</td>
<td class="default">
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>弧段上的第二个点,弧段穿过的点</p></td>
</tr>
<tr>
<td class="name"><code>point3</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
|
<span class="param-type">Array.<Number></span>
</td>
<td class="default">
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>弧段上的第三个点,弧段的终点</p></td>
</tr>
<tr>
<td class="name"><code>numberOfPoints</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="default">
360
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>设置一个圆由多少弧段组成,若该值为360,意思是将圆分成360段,如果当前三点构成的弧段的度数为120度,则最终生成的离散弧段总段数为
360 * (120/360) = 120段</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Array
</td>
<td class="description last">一组离散的点坐标</td>
</tr>
</tbody>
</table>
<h5>Example</h5>
<p class="code-caption"><h5>通过三点弧段构造一组离散的点坐标</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { SpatialReference, GeometryEngine } = zondy.geometry
// ES6引入方式
import { SpatialReference, GeometryEngine } from "@mapgis/webclient-common"
// 将弧段打散为离散点
const arc3Path = GeometryEngine.getPositionsFromArc({
// 弧段上的第一个点,弧段的起点
point1: [1, 2],
// 弧段上的第二个点,弧段穿过的点
point2: [2, 1],
// 弧段上的第二个点,弧段的终点
point3: [1, 0],
// 弧段中点的数量
numberOfPoints: 360
})</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".intersect">
GeometryEngine.intersect<span class="signature">(geometry1, geometry2)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Geometry.html">Geometry</a>|Array.<<a href="Geometry.html">Geometry</a>>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 1919
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='intersect'></a>
计算并返回两个几何对象的相交部分;<br/>
支持任意几何或几何对象数组和另一个几何进行相交,忽略三维高度,坐标系必须相同;<br/>
点和任何几何相交返回点或空对象<br/>
多点和任何几何相交返回点或多点或空对象<br/>
线和任意几何对象相交返回相交点或重叠线或相交点和重叠线或空对象<br/>
区和区、区和多区相交返回区或多区或空对象<br/>
矩形、圆、区、多区之间相交返回区或多区或空对象<br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
|
<span class="param-type">Array.<<a href="Geometry.html">Geometry</a>></span>
</td>
<td class="description last">
<p>第一个几何对象或几何对象数组</p></td>
</tr>
<tr>
<td class="name"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="description last">
<p>第二个几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Geometry.html">Geometry</a>
|
Array.<<a href="Geometry.html">Geometry</a>>
</td>
<td class="description last">相交部分的几何对象或几何对象数组</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".intersects">
GeometryEngine.intersects<span class="signature">(<span class="optional">geometry1</span>, <span class="optional">geometry2</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 1522
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='intersects'></a>
判断两个几何对象是否相交;<br/>
支持任意几何类型求交;<br/>
支持自定义坐标系的几何对象,两个求交几何的坐标系必须相同,忽略三位高度;<br/>
由于示例太多,这里仅列举部分示例,示例如下:<br/>
<a href='#intersects1'>[1、线和区求交]</a><br/>
<a href='#intersects2'>[2、点和区求交]</a><br/>
<a href='#intersects3'>[3、区和多区求交]</a><br/>
<a href='#intersects4'>[4、矩形和圆形求交]</a><br/>
<a href='#intersects5'>[5、几何求交 - 自定义参考系]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>求交的几何对象</p></td>
</tr>
<tr>
<td class="name"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>求交的几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Boolean
</td>
<td class="description last">是否相交</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='intersects1'>线和区求交</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造线几何对象
const line = new LineString({
coordinates: [
[113, 28],
[113, 34]
]
})
// 构造区几何对象
const polygon = new Polygon({
coordinates: [
[
[108, 30],
[115, 30],
[115, 33],
[108, 33],
[108, 30]
],
[
[110, 31],
[113, 31],
[113, 32],
[110, 32],
[110, 31]
]
]
})
// 开始求交
const isIntersect = GeometryEngine.intersects(line, polygon)
console.log("是否相交:", isIntersect)</code></pre>
<p class="code-caption"><h5 id='intersects2'>点和区求交</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Point, Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造点几何对象
const point = new Point({
coordinates: [112, 32]
})
// 构造区几何对象
const polygon = new Polygon({
coordinates: [
[
[108, 30],
[115, 30],
[115, 33],
[108, 33],
[108, 30]
]
]
})
// 开始求交
const isIntersect = GeometryEngine.intersects(point, polygon)
console.log("是否相交:", isIntersect)</code></pre>
<p class="code-caption"><h5 id='intersects3'>区和多区求交</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, MultiPolygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, MultiPolygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造区几何对象
const polygon1 = new Polygon({
coordinates: [
[
[108, 32],
[112, 32],
[112, 34],
[108, 34],
[108, 32]
]
]
})
// 构造多区几何对象
const polygon2 = new MultiPolygon({
coordinates: [
[
[
[108, 33],
[112, 33],
[112, 35],
[108, 35],
[108, 33]
]
],
[
[
[114, 32],
[115, 32],
[115, 34],
[114, 34],
[114, 32]
]
]
]
})
// 开始求交
const isIntersect = GeometryEngine.intersects(polygon1, polygon2)
console.log("是否相交:", isIntersect)</code></pre>
<p class="code-caption"><h5 id='intersects4'>矩形和圆形求交</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Extent, Circle, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Extent, Circle, GeometryEngine } from "@mapgis/webclient-common"
// 构造矩形几何对象
const extent = new Extent({
xmin: 108,
ymin: 33,
xmax: 115,
ymax: 34
})
// 构造圆形几何对象
const circle = new Circle({
center: [113, 32],
radius: 4
})
// 开始求交
const isIntersect = GeometryEngine.intersects(extent, circle)
console.log("是否相交:", isIntersect)</code></pre>
<p class="code-caption"><h5 id='intersects5'>几何求交 - 自定义参考系</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, Circle, SpatialReference, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, Circle, SpatialReference, GeometryEngine } from "@mapgis/webclient-common"
// 构造区几何对象
const polygon = new Polygon({
coordinates: [
[
[0, 3226025],
[698545, 3226025],
[698545, 3685076],
[0, 3685076],
[0, 3226025]
],
[
[100000, 3326025],
[598545, 3326025],
[598545, 3485076],
[100000, 3485076],
[100000, 3326025]
]
],
// 此处要指定坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 构造圆几何对象
const circle = new Circle({
center: [245257.10778559791, 3212885.1836444484],
radius: 400000,
// 此处要指定坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 开始求交
const isIntersect = GeometryEngine.intersects(circle, polygon)
console.log("是否相交:", isIntersect)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".isSimple">
GeometryEngine.isSimple<span class="signature">(geometry)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 7208
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='isSimple'></a>
对几何对象进行拓扑检查;<br/>
支持的几何类型为线、多线、区和多区,支持任意坐标系几何,忽略三维高度;<br/>
线类型的标准为:1、自身的非相邻线段不会自相交(两个线段仅有一个端点重叠不算相交);2、线自身的线段不会重叠;<br/>
多线类型的标准为:1、自身的子线段必须是拓扑正确的;2、子线段不会相交;<br/>
区类型的标准为:1、外圈和内圈满足线类型的拓扑检查标准;2、外圈和内圈、内圈和内圈不会相交;3、内圈不会超过外圈;<br/>
多区类型的标准为:1、自身的子区必须是拓扑正确的;2、子区不会相交;<br/>
示例如下:<br/>
<a href='#isSimple1'>[1、对线几何进行拓扑检查]</a><br/>
<a href='#isSimple2'>[2、对多线几何进行拓扑检查]</a><br/>
<a href='#isSimple3'>[3、对区几何进行拓扑检查]</a><br/>
<a href='#isSimple4'>[4、对多区几何进行拓扑检查]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
</td>
<td class="description last">
<p>几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Boolean
</td>
<td class="description last">拓扑检查是否通过</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='isSimple1'>对线几何进行拓扑检查</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造线几何对象
const line = new LineString({
coordinates: [
[108.36341, 29.032578],
[116.13094, 29.032578],
[112.13094, 33.273224],
[112.13094, 28.273224]
]
})
// 对线几何进行拓扑检查
const isSimple = GeometryEngine.isSimple(line)
console.log("是否通过检查:", isSimple)</code></pre>
<p class="code-caption"><h5 id='isSimple2'>对多线几何进行拓扑检查</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiLineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiLineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造多线几何对象
const line = new MultiLineString({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578]
],
[
[112.13094, 33.273224],
[112.13094, 28.273224]
]
]
})
// 对多线几何进行拓扑检查
const isSimple = GeometryEngine.isSimple(line)
console.log("是否通过检查:", isSimple)</code></pre>
<p class="code-caption"><h5 id='isSimple3'>对区几何进行拓扑检查</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造区几何对象
const polygon = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[112.13094, 33.273224],
[112.13094, 28.273224],
[108.36341, 29.032578]
]
]
})
// 对区几何进行拓扑检查
const isSimple = GeometryEngine.isSimple(polygon)
console.log("是否通过检查:", isSimple)</code></pre>
<p class="code-caption"><h5 id='isSimple4'>对多区几何进行拓扑检查</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造多区几何对象
const multiPolygon = new MultiPolygon({
coordinates: [
[
[
[108.36341, 29.032578],
[112.13094, 29.032578],
[112.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578]
]
],
[
[
[112.13094, 29.032578],
[114.13094, 29.032578],
[114.13094, 33.273224],
[112.13094, 33.273224],
[112.13094, 29.032578]
]
]
]
})
// 对区几何进行拓扑检查
const isSimple = GeometryEngine.isSimple(multiPolygon)
console.log("是否通过检查:", isSimple)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".nearestCoordinate">
GeometryEngine.nearestCoordinate<span class="signature">(geometry, inputPoint)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Project.<<a href="Point.html">Point</a>>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 3412
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='nearestCoordinate'></a>
在几何对象的coordinates中寻找与指定点距离最近的点</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPoint.html">MultiPoint</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
</td>
<td class="description last">
<p>几何对象,支持多点、线、多线、面、多面、圆、矩形</p></td>
</tr>
<tr>
<td class="name"><code>inputPoint</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
</td>
<td class="description last">
<p>指定点,需为point</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Project.<<a href="Point.html">Point</a>>
</td>
<td class="description last">距离最近的点数组
<ul>
<li>@example <caption><h5>多点到目标点最近点</h5></caption>
// ES5引入方式
const { Point, MultiPoint, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, MultiPoint, Point } from "@mapgis/webclient-common"
// inputPoint
const inputPoint = new Point({
coordinates: [108, 28],
});
// geometry MultiPoint
const multiPoint = new MultiPoint({
coordinates: [
[110, 20],
[109, 19],
],
});
// 多点到目标点最近点
const pointToMultiPoint = GeometryEngine.nearestCoordinate(
multiPoint,
inputPoint
);
console.log("多点到目标点最近点:", pointToMultiPoint);</li>
</ul></td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5>线到目标点最近点</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Point, LineString } from "@mapgis/webclient-common"
// inputPoint
const inputPoint = new Point({
coordinates: [112, 30],
});
// geometry lineString
const lineString = new LineString({
coordinates: [
[108, 32],
[115, 32],
],
});
// 线到目标点最近点
const pointToLineString = GeometryEngine.nearestCoordinate(
lineString,
inputPoint
);
console.log("线到目标点最近点:", pointToLineString);</code></pre>
<p class="code-caption"><h5>区到目标点最近点</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Point, Polygon } from "@mapgis/webclient-common"
// inputPoint
const inputPoint = new Point({
coordinates: [100, 30],
});
// geometry Polygon
const polygon = new Polygon({
coordinates: [
[
[105.0, 35.0],
[110.0, 35.0],
[110.0, 36.0],
[105.0, 36.0],
[105.0, 35.0],
],
],
});
// 区到目标点最近点
const pointToPolygon = GeometryEngine.nearestCoordinate(
polygon,
inputPoint
);
console.log("区到目标点最近点:", pointToPolygon);</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".overlaps">
GeometryEngine.overlaps<span class="signature">(geometry1, geometry2)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 2970
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='overlaps'></a>
判断两个几何对象是否重叠,即两个几何相交但不互相包含</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="description last">
<p>第一个几何对象</p></td>
</tr>
<tr>
<td class="name"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="description last">
<p>第二个几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Boolean
</td>
<td class="description last">几何对象是否重叠</td>
</tr>
</tbody>
</table>
<h5>Example</h5>
<p class="code-caption"><h5>几何是否重叠</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造线几何对象
const line = new LineString({
coordinates: [
[113, 28],
[113, 34]
]
})
// 构造区几何对象
const polygon = new Polygon({
coordinates: [
[
[108, 30],
[115, 30],
[115, 33],
[108, 33],
[108, 30]
],
[
[110, 31],
[113, 31],
[113, 32],
[110, 32],
[110, 31]
]
]
})
// 开始计算是否重叠
const isIntersect = GeometryEngine.overlaps(line, polygon)
console.log("是否重叠:", isIntersect)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".planarArea">
GeometryEngine.planarArea<span class="signature">(geometry, <span class="optional">unit</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Number}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 3696
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='planarArea'></a>
计算几何对象的面积;<br/>
仅计算图面面积,忽略地球弧度,未设置单位或坐标系为地理坐标系时,仅返回计算结果<br/>
支持自定义坐标系,忽略三维高度;<br/>
支持区、多区、矩形和圆形几何对象;<br/>
当为区或多区几何对象时,若该区带洞或多区的子区带洞,则会减去这些洞的面积;<br/>
示例如下:<br/>
<a href='#planarArea1'>[1、计算区(不带洞)面积]</a><br/>
<a href='#planarArea2'>[2、计算区(带洞)面积]</a><br/>
<a href='#planarArea3'>[3、计算多区面积]</a><br/>
<a href='#planarArea4'>[4、计算圆面积]</a><br/>
<a href='#planarArea5'>[5、计算矩形面积]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
</td>
<td class="default">
</td>
<td class="description last">
<p>计算面积的几何对象</p></td>
</tr>
<tr>
<td class="name"><code>unit</code></td>
<td class="type">
<span class="param-type"><a href="AreaUnits.html">AreaUnits</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>返回值的单位</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Number
</td>
<td class="description last">几何对象的面积</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='planarArea1'>计算区(不带洞)面积</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Polygon, LengthUnit } from "@mapgis/webclient-common"
// 初始化区几何
const polygon = new Polygon({
coordinates: [
[
[100, 30],
[110, 30],
[110, 40],
[100, 40],
[100, 30]
]
]
})
// 计算区几何面积
const area = GeometryEngine.planarArea(polygon)</code></pre>
<p class="code-caption"><h5 id='planarArea2'>计算区(带洞)面积</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Polygon, LengthUnit } from "@mapgis/webclient-common"
// 初始化区几何 - 带洞
const polygon = new Polygon({
coordinates: [
[
[0, 30],
[140, 30],
[140, 40],
[0, 40],
[0, 30]
],
[
[10, 30],
[20, 30],
[20, 40],
[10, 40],
[10, 30]
],
[
[30, 30],
[40, 30],
[40, 40],
[30, 40],
[30, 30]
]
]
})
// 计算区几何面积
const area = GeometryEngine.planarArea(polygon)</code></pre>
<p class="code-caption"><h5 id='planarArea3'>计算多区面积</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiPolygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, MultiPolygon, LengthUnit } from "@mapgis/webclient-common"
//多区几何
const multiPolygon = new MultiPolygon({
coordinates: [
[
[
[10, 30],
[20, 30],
[20, 40],
[10, 40],
[10, 30]
]
],
[
[
[30, 30],
[40, 30],
[40, 40],
[30, 40],
[30, 30]
]
]
]
})
// 计算区几何面积
const Area = GeometryEngine.planarArea(multiPolygon)</code></pre>
<p class="code-caption"><h5 id='planarArea4'>计算圆面积</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Circle, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Circle, LengthUnit, GeometryEngine } from "@mapgis/webclient-common"
//圆几何
const circle = new Circle({
center: [0, 0],
radius: 10
})
// 计算圆几何面积
const area = GeometryEngine.planarArea(circle)</code></pre>
<p class="code-caption"><h5 id='planarArea5'>计算矩形面积</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Extent, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Extent, LengthUnit, GeometryEngine } from "@mapgis/webclient-common"
//矩形几何
const extent = new Extent({
xmin: 0,
ymin: 0,
xmax: 2,
ymax: 2
})
// 计算矩形几何面积
const area = GeometryEngine.planarArea(extent)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".planarLength">
GeometryEngine.planarLength<span class="signature">(<span class="optional">geometry</span>, <span class="optional">unit</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Number}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 3854
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='planarLength'></a>
计算几何长度或周长;<br/>
仅计算图面距离,忽略地球弧度,未设置单位或坐标系为地理坐标系时,仅返回计算结果<br/>
支持自定义坐标系,忽略三维高度;<br/>
支持的几何类型为线、多线、区、多区、圆形以及矩形;<br/>
当几何为线时,返回线的长度;<br/>
当几何为多线时,返回多线中子线的长度之和;<br/>
当几何为区、圆形以及矩形时,返回其周长;<br/>
当几何为多区时,返回多区中子区的周长之和;<br/>
示例如下:<br/>
<a href='#planarLength1'>[1、计算几何长度]</a><br/>
<a href='#planarLength2'>[2、计算几何周长]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>几何对象</p></td>
</tr>
<tr>
<td class="name"><code>unit</code></td>
<td class="type">
<span class="param-type"><a href="LinearUnits.html">LinearUnits</a></span>
</td>
<td class="default">
null
</td>
<td class="description last">
<span class="optional"> 可选</span>
<p>返回值的单位</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Number
</td>
<td class="description last">几何对象的长度或周长</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='planarLength1'>计算几何长度</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, GeometryEngine } from "@mapgis/webclient-common"
// 初始化一个线对象
const line = new LineString({
coordinates: [
[0, 1],
[0, 2]
]
})
// 计算几何长度
const length = GeometryEngine.planarLength(line)</code></pre>
<p class="code-caption"><h5 id='planarLength2'>计算几何周长</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 初始化一个区对象
const polygon = new Polygon({
coordinates: [
[
[0, 0],
[0, 1],
[1, 1],
[0, 1],
[0, 0]
]
]
})
// 计算几何周长
const length = GeometryEngine.planarLength(polygon)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".rotate">
GeometryEngine.rotate<span class="signature">(geometry, angle, rotationOrigin)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Geometry.html">Geometry</a>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 3212
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='rotate'></a>
顺时针旋转几何,支持所有基础几何对象;<br/>
可以指定旋转中心点,当不指定时使用几何质心;<br/>
忽略三维高度;<br/>
支持自定义坐标系几何,几何对象与旋转中心点的坐标系必须一致;<br/>
示例如下:<br/>
<a href='#rotate1'>[1、旋转多点]</a><br/>
<a href='#rotate2'>[2、旋转区]</a><br/>
<a href='#rotate3'>[3、旋转多区]</a><br/>
<a href='#rotate4'>[4、旋转线]</a><br/>
<a href='#rotate5'>[5、旋转多线]</a><br/>
<a href='#rotate6'>[6、旋转矩形]</a><br/>
<a href='#rotate7'>[7、旋转圆形]</a><br/>
<a href='#rotate8'>[8、旋转区 - 自定义坐标系]</a><br/>
<a href='#rotate9'>[9、绕点旋转 - 区]</a><br/>
<a href='#rotate10'>[10、绕点旋转 - 点]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="description last">
<p>被旋转的几何对象</p></td>
</tr>
<tr>
<td class="name"><code>angle</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
<p>旋转角度,单位度,顺时针旋转</p></td>
</tr>
<tr>
<td class="name"><code>rotationOrigin</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
</td>
<td class="description last">
<p>旋转中心点,默认为几何质心</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Geometry.html">Geometry</a>
</td>
<td class="description last">旋转后的新几何对象</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='rotate1'>旋转多点</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiPoint, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiPoint, GeometryEngine } from "@mapgis/webclient-common"
// 构造多点几何
const multiPoint = new MultiPoint({
coordinates: [
[108.36341, 29.032578],
[112.13094, 29.032578],
[112.13094, 33.273224]
]
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(multiPoint, 10)</code></pre>
<pre class="prettyprint"><code><caption id='rotate2'><h5>旋转区</h5></caption>
// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造区几何
const polygon = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578],
]
]
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(polygon, 10)</code></pre>
<p class="code-caption"><h5 id='rotate3'>旋转多区</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiPolygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiPolygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造多区几何
const polygon = new MultiPolygon({
coordinates: [
[
[
[108.36341, 29.032578],
[112.13094, 29.032578],
[112.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578],
]
],
[
[
[113.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[113.36341, 33.273224],
[113.36341, 29.032578],
]
]
]
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(polygon, 10)</code></pre>
<p class="code-caption"><h5 id='rotate4'>旋转线</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造线几何
const line = new LineString({
coordinates: [
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224]
]
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(line, 10)</code></pre>
<p class="code-caption"><h5 id='rotate5'>旋转多线</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiLineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiLineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造多线几何
const line = new MultiLineString({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578]
],
[
[116.13094, 33.273224],
[108.36341, 33.273224]
]
]
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(line, 10)</code></pre>
<p class="code-caption"><h5 id='rotate6'>旋转矩形</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Extent, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Extent, GeometryEngine } from "@mapgis/webclient-common"
// 构造矩形几何
const extent = new Extent({
xmin: 108.36341,
ymin: 29.032578,
xmax: 112.13094,
ymax: 33.273224
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(extent, 10)</code></pre>
<p class="code-caption"><h5 id='rotate7'>旋转圆形</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Circle, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Circle, GeometryEngine } from "@mapgis/webclient-common"
// 构造圆形几何
const circle = new Circle({
center: [108.36341, 29.032578],
radius: 3
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(circle, 10)</code></pre>
<p class="code-caption"><h5 id='rotate8'>旋转区 - 自定义坐标系</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, SpatialReference, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, SpatialReference, GeometryEngine } from "@mapgis/webclient-common"
// 构造区几何
const polygon = new Polygon({
coordinates: [
[
[0, 3226025],
[698545, 3226025],
[698545, 3685076],
[0, 3685076],
[0, 3226025]
]
],
// 一定要指定坐标系
spatialReference: new SpatialReference({
wkid: 4547
})
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(polygon, 10)</code></pre>
<p class="code-caption"><h5 id='rotate9'>绕点旋转 - 区</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, Point, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Polygon, Point, GeometryEngine } from "@mapgis/webclient-common"
// 构造区几何
const polygon = new Polygon({
coordinates: [
[
[108.36341, 29.032578],
[116.13094, 29.032578],
[116.13094, 33.273224],
[108.36341, 33.273224],
[108.36341, 29.032578]
]
]
})
// 设置旋转中心点
const rotatePoint = new Point({
coordinates: [108.36341, 29.032578]
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(polygon, 10, rotatePoint)</code></pre>
<p class="code-caption"><h5 id='rotate10'>绕点旋转 - 点</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Point, GeometryEngine } from "@mapgis/webclient-common"
// 构造点几何
const point = new Point({
coordinates: [
[108.36341, 29.032578]
]
})
// 设置旋转中心点
const rotatePoint = new Point({
coordinates: [112.13094, 33.273224]
})
// 执行旋转操作
const rotateGeometry = GeometryEngine.rotate(point, 10, rotatePoint)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".simplify">
GeometryEngine.simplify<span class="signature">(geometry)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Geometry.html">Geometry</a>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 8737
</div>
</div>
</dt>
<dd>
<div class="description">
<p>拓扑矫正
<a id='simplify'></a></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
</td>
<td class="description last">
<p>要进行矫正的几何</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Geometry.html">Geometry</a>
</td>
<td class="description last">矫正后的几何对象</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".touches">
GeometryEngine.touches<span class="signature">(geometry1, geometry2)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 5984
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='touches'></a>
判断一个几何对象是否和另一个几何对象相邻
被测试相邻关系的几何类型为:线、多线、矩形、圆、区以及多区,忽略三维高度;<br/>
用来测试相邻关系的几何类型为:点、多点、线、多线、矩形、圆、区以及多区,忽略三维高度,穿线和被穿过几何的坐标系必须相同;<br/>
线和点相邻的标准为:点在线的两端,且线不是头尾闭合的;<br/>
对于multi类型的几何(如多点、多线、多区),无论其和任何其他支持的几何类型判断touch,只要multi中的一个与另一个geometry有包含关系、相交关系,touch即为false;<br/>
对于区、线、圆、矩形和多点判断相邻关系时,只有有一个点在区内、线上、矩形内、圆内,touch即为false;<br/>
示例如下:<br/>
<a href='#touch1'>[1、线和点相邻]</a><br/>
<a href='#touch2'>[2、多线和多点相邻]</a><br/>
<a href='#touch3'>[3、区和线相邻]</a><br/>
<a href='#touch4'>[4、多区和区相邻]</a><br/>
<a href='#touch5'>[5、圆和圆相邻]</a><br/></p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
</td>
<td class="description last">
<p>用来测试相邻关系的几何,支持线、多线、区、多区、圆、矩形</p></td>
</tr>
<tr>
<td class="name"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a href="Point.html">Point</a></span>
|
<span class="param-type"><a href="LineString.html">LineString</a></span>
|
<span class="param-type"><a href="Polygon.html">Polygon</a></span>
|
<span class="param-type"><a href="MultiPoint.html">MultiPoint</a></span>
|
<span class="param-type"><a href="MultiLineString.html">MultiLineString</a></span>
|
<span class="param-type"><a href="MultiPolygon.html">MultiPolygon</a></span>
|
<span class="param-type"><a href="Circle.html">Circle</a></span>
|
<span class="param-type"><a href="Extent.html">Extent</a></span>
</td>
<td class="description last">
<p>被测试相邻关系的几何,支持点、多点、线、多线、区、多区、圆、矩形</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Boolean
</td>
<td class="description last">是否相邻</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5 id='touch1'>线和点相邻</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, LineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Point, LineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造线对象
const line1 = new LineString({
coordinates: [
[107.36341, 31.032578],
[110, 31.032578],
[117.13094, 31.032578],
[107.36341, 31.032578],
]
})
// 构造点对象
const point = new Point({
coordinates: [107.36341, 31.032578],
});
// 开始判断相邻
const isTouch = GeometryEngine.touches(line1, point)
console.log("线和点是否相邻:", isTouch)</code></pre>
<p class="code-caption"><h5 id='touch2'>多线和多点相邻</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiPoint, MultiLineString, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiPoint, MultiLineString, GeometryEngine } from "@mapgis/webclient-common"
// 构造多线对象
const multiLineString = new MultiLineString({
coordinates: [
[
[112, 31],
[112, 33],
],
[
[113, 31],
[113, 33],
],
]
})
// 构造多点对象
const multiPoint = new MultiPoint({
coordinates: [
[113, 32],
[113, 31],
],
});
// 开始判断相邻
const isTouch = GeometryEngine.touches(multiLineString,multiPoint)
console.log("多线和多点是否相邻:", isTouch)</code></pre>
<p class="code-caption"><h5 id='touch3'>区和线相邻</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { LineString, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { LineString, Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造区对象
const polygon = new Polygon({
coordinates: [
[
[108, 30],
[115, 30],
[115, 33],
[108, 33],
[108, 30],
],
[
[110, 31],
[113, 31],
[113, 32],
[110, 32],
[110, 31],
],
]
})
// 构造线对象
const line = new LineString({
coordinates: [
[105, 30],
[108, 32],
]
})
// 开始判断相邻
const isTouch = GeometryEngine.touches(polygon, line)
console.log("区和线是否相邻:", isTouch)</code></pre>
<p class="code-caption"><h5 id='touch4'>多区和区相邻</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { MultiPolygon, Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { MultiPolygon, Polygon, GeometryEngine } from "@mapgis/webclient-common"
// 构造多区对象
const multiPolygon = new MultiPolygon({
coordinates: [
[
[
[105.0, 35.0],
[110.0, 35.0],
[110.0, 36.0],
[105.0, 36.0],
[105.0, 35.0],
],
],
[
[
[108, 30],
[115, 30],
[115, 33],
[108, 33],
[108, 30],
],
[
[110, 31],
[113, 31],
[113, 32],
[110, 32],
[110, 31],
],
],
],
});
// 构造区对象
const polygon = new Polygon({
coordinates: [
[
[110, 33],
[113, 33],
[113, 37],
[110, 37],
[110, 33],
],
]
})
// 开始判断相邻
const isTouch = GeometryEngine.touches( multiPolygon, polygon)
console.log("多区是否和区相邻:", isTouch)</code></pre>
<p class="code-caption"><h5 id='touch5'>圆和圆相邻</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Circle, GeometryEngine } = zondy.geometry
// ES6引入方式
import { Circle, GeometryEngine } from "@mapgis/webclient-common"
// 构造圆对象
const circle1 = new Circle({
// 中心点
center: [113, 34],
// 半径
radius: 1,
});
// 构造圆对象
const circle2 = new Circle({
// 中心点
center: [115, 34],
// 半径
radius: 2,
});
// 开始判断相邻
const isTouch = GeometryEngine.touches(circle1, circle2)
console.log("圆和圆是否相邻:", isTouch)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".union">
GeometryEngine.union<span class="signature">(geometries)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Geometry.html">Geometry</a>}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 1107
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='union'></a>
多个几何对象求并,并返回求并后的新几何对象;<br/>
输入的几何类型必须一致,点和多点、区和多区视为同一个类型,且几何对象的坐标系要一致;<br/>
忽略三维高度;<br>
支持的几何有:点(多点)几何对象、区(多区)几何对象、范围几何对象、圆几何对象<br/>
点和点、点和多点、多点和多点合并为一个多点几何对象,如果有多个点坐标(XYZ)相同,则会去重;<br/>
线和线、线和多线、多线和多线合并为一个线几何对象或多线几何对象;<br/>
区和区、区和多区、多区和多区合并为一个区级和对象或多区几何对象;<br/>
矩形和矩形合并为一个多边形几何对象或一个更大的矩形几何对象;<br/>
圆和圆合并为一个多边形几何对象或一个圆几何对象或两个不相交的圆;</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometries</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Geometry.html">Geometry</a>></span>
</td>
<td class="description last">
<p>求并几何或几何数组</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Geometry.html">Geometry</a>
</td>
<td class="description last">求并后的新几何对象</td>
</tr>
</tbody>
</table>
<h5>Examples</h5>
<p class="code-caption"><h5>点和点求并</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Point } from "@mapgis/webclient-common"
// 点和点求并
const point1 = new Point({
coordinates: [1, 1]
})
const point2 = new Point({
coordinates: [2, 1]
})
const point3 = new Point({
coordinates: [3, 1, 100]
})
const union = GeometryEngine.union([point1, point2, point3])
console.log("点和点求并:", union)</code></pre>
<p class="code-caption"><h5>点和多点求并</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, MultiPoint, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Point, MultiPoint } from "@mapgis/webclient-common"
// 点和多点求并
const point1 = new Point({
coordinates: [1, 1]
})
const point2 = new MultiPoint({
coordinates: [
[2, 1],
[3, 1]
]
})
const union = GeometryEngine.union([point1, point2])
console.log("点和多点求并:", union)</code></pre>
<p class="code-caption"><h5>多点和多点求并</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Point, MultiPoint, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Point, MultiPoint } from "@mapgis/webclient-common"
// 多点和多点求并
const point1 = new MultiPoint({
coordinates: [
[2, 1],
[3, 1],
[3, 3, 4]
]
})
const point2 = new MultiPoint({
coordinates: [
[2, 1],
[3, 1]
]
})
const union = GeometryEngine.union([point1, point2])
console.log("多点和多点求并:", union)</code></pre>
<p class="code-caption"><h5>区和区求并</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Polygon } from "@mapgis/webclient-common"
// 区和区求并
const polygon1 = new Polygon({
coordinates: [
[
[-82.574787, 35.594087],
[-82.574787, 35.615581],
[-82.545261, 35.615581],
[-82.545261, 35.594087],
[-82.574787, 35.594087]
]
]
})
const polygon2 = new Polygon({
coordinates: [
[
[-82.560024, 35.585153],
[-82.560024, 35.602602],
[-82.52964, 35.602602],
[-82.52964, 35.585153],
[-82.560024, 35.585153]
]
]
})
const union = GeometryEngine.union([polygon1, polygon2])
console.log("区和区求并:", union)</code></pre>
<p class="code-caption"><h5>区和带洞区求并</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Polygon } from "@mapgis/webclient-common"
// 区和带洞区求并
const polygon1 = new Polygon({
coordinates: [
[
[100, 30],
[110, 30],
[110, 40],
[100, 40],
[100, 30]
]
]
})
const polygon2 = new Polygon({
coordinates: [
[
[105, 30],
[120, 30],
[120, 40],
[105, 40],
[105, 30]
],
[
[108, 35],
[116, 35],
[116, 36],
[108, 36],
[108, 35]
]
]
})
const union = GeometryEngine.union([polygon1, polygon2])
console.log("区和带洞区求并:", union)</code></pre>
<p class="code-caption"><h5>带洞区和带洞区的求并</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Polygon } from "@mapgis/webclient-common"
// 带洞区和带洞区的求并
const polygon1 = new Polygon({
coordinates: [
[
[100, 30],
[110, 30],
[110, 40],
[100, 40],
[100, 30]
],
[
[103, 35],
[106, 35],
[106, 36],
[103, 36],
[103, 35]
]
]
})
const polygon2 = new Polygon({
coordinates: [
[
[105, 30],
[120, 30],
[120, 40],
[105, 40],
[105, 30]
],
[
[108, 35],
[116, 35],
[116, 36],
[108, 36],
[108, 35]
]
]
})
const union = GeometryEngine.union([polygon1, polygon2])
console.log("带洞区和带洞区的求并:", union)</code></pre>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".within">
GeometryEngine.within<span class="signature">(innerGeometry, outerGeometry)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Boolean}</span>
</h4>
<div class="tag-source">
base/geometry/GeometryEngine.js, line 5347
</div>
</div>
</dt>
<dd>
<div class="description">
<p><a id='within'></a>
判断innerGeometry几何对象是否完全在outerGeometry中</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>innerGeometry</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="description last">
<p>内部几何对象</p></td>
</tr>
<tr>
<td class="name"><code>outerGeometry</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="description last">
<p>外部几何对象</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
Boolean
</td>
<td class="description last">是否完全包含</td>
</tr>
</tbody>
</table>
<h5>Example</h5>
<p class="code-caption"><h5>判断是否包含</h5></p>
<pre class="prettyprint"><code>// ES5引入方式
const { Polygon, Point, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, Polygon, Point } from "@mapgis/webclient-common"
// 初始点几何,可以是任意几何
const point = new Point({
coordinates: [1, 1]
})
// 初始化区几何,可以是任意几何
const polygon = new Polygon({
coordinates: [
[
[1, 0],
[10, 0],
[10, 20],
[1, 20],
[1, 0]
]
]
})
// 判断点几何是否被区几何对象包含
const isContains = GeometryEngine.within(polygon, point)
console.log("点几何是否被区几何对象包含:", isContains)</code></pre>
</dd>
</dl>
</article>
</section>
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> on Fri Feb 06 2026 10:41:55 GMT+0800 (中国标准时间)
</footer>
</div>
</div>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/main.js"></script>
</body>
</html>