UNPKG

@mapgis/webclient-common

Version:

mapgis ES6 format for igserver

10,011 lines 184 kB
<header id="page-title" class="page-title">
    
        <span class="page-title-main">类名</span>
        <span class="page-title-sub">GeometryEngine</span>
    
</header>





<section>

<article>
    <div class="container-overview">
    
        
            <div class='vertical-section'>
                <div class="members">
                    <div class="member">
                        


    
    <h4 class="name" id="GeometryEngine">
        <a class="href-link" href="#GeometryEngine">#</a>
        
        <span class="code-name" id="GeometryEngine" style="font-size:30px">
            
                new GeometryEngine<span class="signature">()</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p>几何分析工具</p>
    </div>
    













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>





















<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='#planarLength'>[12、计算平面长度]</a><br/>
<a href='#geodesicLength'>[13、计算地理长度]</a><br/>
<a href='#rotate'>[14、旋转]</a><br/>
<a href='#distance'>[15、计算距离]</a><br/>
<a href='#touches'>[16、是否相邻]</a><br/>
<a href='#union'>[17、求并]</a><br/>
<a href='#within'>[18、是否被包含(within)]</a><br/>
<a href='#buffer'>[19、缓冲区分析]</a><br/>
<a href='#isSimple'>[20、拓扑检查]</a><br/>
<a href='#getPositionsFromArc'>[21、通过三点弧段构造一组离散的点坐标]</a><br/>
<a href='#getArcFromGeometry'>[22、通过几何中的三点弧段数据,构造离散后的几何对象]</a><br/>
<a href='#getCenter'>[23、通过三个点求圆心]</a><br/>
<a href='#getAngleFromPoints'>[24、计算三点之间的夹角]</a><br/>
<a href='#simplify'>[25、拓扑矫正]</a><br/>
<a href='#getCenterOID'>[26、获取几何中心点]</a><br/></p>




                    </div>
                </div>
            </div>
        
    
    </div>
    
    

    

    

    

    

    

    

    
        <div class='vertical-section'>
            <h3 id='function'>方法</h3>
            <h4 style="margin-top: 20px;margin-bottom: 20px;">方法概述</h4>
            <div class="members">
            <div class="table-container">
                <table class="params table">
                    <thead>
                    <tr>
                        <th>名称</th>
                        <th>返回值类型</th>
                        <th>描述</th>
                    </tr>
                    </thead>
                    <tbody>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#buffer">buffer</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>
|

<span class="param-type">
    
         Array.&lt;<a onclick="getTypeHTML(event)" link="Geometry.html">Geometry</a>>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#contains">contains</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Boolean
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#crosses">crosses</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Boolean
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#cut">cut</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
         Array.&lt;<a onclick="getTypeHTML(event)" link="Geometry.html">Geometry</a>>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#difference">difference</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#disjoint">disjoint</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Boolean
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#distance">distance</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Number
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#equals">equals</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Boolean
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#geodesicLength">geodesicLength</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Number
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#getAngleFromPoints">getAngleFromPoints</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Number
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#getArcFromGeometry">getArcFromGeometry</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#getCenter">getCenter</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
         Array.&lt;Number>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#getCenterOID">getCenterOID</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p>获取几何中心点
</code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#getEllipseCoordinates">getEllipseCoordinates</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Array
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p>获取椭圆离散化点坐标
</code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#getPositionsFromArc">getPositionsFromArc</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Array
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#intersect">intersect</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>
|

<span class="param-type">
    
         Array.&lt;<a onclick="getTypeHTML(event)" link="Geometry.html">Geometry</a>>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#intersects">intersects</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Boolean
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#isSimple">isSimple</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Boolean
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#nearestCoordinate">nearestCoordinate</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
         Project.&lt;<a onclick="getTypeHTML(event)" link="Point.html">Point</a>>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#overlaps">overlaps</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Boolean
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#planarArea">planarArea</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Number
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#planarLength">planarLength</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Number
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#rotate">rotate</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#simplify">simplify</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p>拓扑矫正
</code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#touches">touches</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Boolean
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#union">union</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                            <tr class="deep-level-0">
                                <td class="name"><code><a href="#within">within</a></code></td>
                                <td class="name">
                                    <code>
                                        
                                                
<span class="param-type">
    
             Boolean
    
</span>



                                            
                                    </code>
                                </td>
                                <td class="name"><code><p></code></td>
                            </tr>
                        
                    </tbody>
                </table>
            </div>
            <h4 style="margin-top: 20px;margin-bottom: 20px;">方法详情</h4>
            
                <div class="member">


    
    <h4 class="name" id=".buffer">
        <a class="href-link" href="#.buffer">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="buffer" style="font-size:30px">
            
                buffer<span class="signature">(geometry<span class="signature-attributes">opt</span>, distance<span class="signature-attributes">opt</span>, unit<span class="signature-attributes">opt</span>, unionResults<span class="signature-attributes">opt</span>)</span>
            
        </span>
    </h4>
    

    
    <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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>
|

<span class="param-type">
    
         Array.&lt;<a onclick="getTypeHTML(event)" link="Geometry.html">Geometry</a>>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>要进行缓冲区分析的几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>distance</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             Number
    
</span>
|

<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  
      <td class="default">
      
          1000
      
      </td>
  

  <td class="description last"><p>缓冲距离</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>unit</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LengthUnit.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LengthUnit" global.html#LengthUnit>LengthUnit</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          LengthUnit.meter
      
      </td>
  

  <td class="description last"><p>单位,默认米</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <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"><p>是否将返回的多个几何对象合并为单几何对象,默认为false,即不合并几何</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>缓冲区分析后的几何对象</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>
|

<span class="param-type">
    
         Array.&lt;<a onclick="getTypeHTML(event)" link="Geometry.html">Geometry</a>>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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.meter, 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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".contains">
        <a class="href-link" href="#.contains">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="contains" style="font-size:30px">
            
                contains<span class="signature">(containerGeometry<span class="signature-attributes">opt</span>, insideGeometry<span class="signature-attributes">opt</span>)</span>
            
        </span>
    </h4>
    

    
    <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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>containerGeometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>包含几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>insideGeometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>被包含的几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>是否包含</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Boolean
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".crosses">
        <a class="href-link" href="#.crosses">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="crosses" style="font-size:30px">
            
                crosses<span class="signature">(geometry1, geometry2)</span>
            
        </span>
    </h4>
    

    
    <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;&lt;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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>第一个几何体,支持线、多线;</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>第二个几何体,支持线、多线、面、多面、圆、矩形,两个参数可以调换输入,但其中一个geometry必须是LineString、MultiLineString中的一类;</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>是否穿过</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Boolean
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".cut">
        <a class="href-link" href="#.cut">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="cut" style="font-size:30px">
            
                cut<span class="signature">(geometry, cutter)</span>
            
        </span>
    </h4>
    

    
    <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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>被切割的区对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>cutter</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>切割线几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>切割后的几何数组</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
         Array.&lt;<a onclick="getTypeHTML(event)" link="Geometry.html">Geometry</a>>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".difference">
        <a class="href-link" href="#.difference">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="difference" style="font-size:30px">
            
                difference<span class="signature">(inputGeometry, subtractGeometry)</span>
            
        </span>
    </h4>
    

    
    <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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>inputGeometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>被求差几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>subtractGeometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>求差几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>求差后的几何对象</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".disjoint">
        <a class="href-link" href="#.disjoint">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="disjoint" style="font-size:30px">
            
                disjoint<span class="signature">(geometry1<span class="signature-attributes">opt</span>, geometry2<span class="signature-attributes">opt</span>)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='disjoint'></a>
判断两个几何是否相离,即完全不相交;<br/>
支持自定义坐标系几何对象,两个几何对象的坐标系要一致,忽略三维高度;<br/>
示例如下:<br/>
<a href='#disjoint1'>[是否相离]</a><br/></p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>第一个几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>第二个几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>是否相离</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Boolean
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".distance">
        <a class="href-link" href="#.distance">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="distance" style="font-size:30px">
            
                distance<span class="signature">(geometry1, geometry2, unit)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='distance'></a>
计算两点之间的距离,坐标系取第一个图层的坐标系</p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>第一个几何体,需为point</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>
|

<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPoint.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPoint" MultiPoint.html>MultiPoint</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>第二个几何体,可以为点、多点、线、多线、面、多面、圆、矩形</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>unit</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             String
    
</span>



  
  </td>

  

  <td class="description last"><p>单位,默认为&quot;kilometers&quot;</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>距离</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Number
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".equals">
        <a class="href-link" href="#.equals">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="equals" style="font-size:30px">
            
                equals<span class="signature">(geometry1<span class="signature-attributes">opt</span>, geometry2<span class="signature-attributes">opt</span>)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='equals'></a>
判断两个几何是否相等;<br/>
使用如下判断标准:<br/>
1、类型是否相等;<br/>
2、坐标系是否相等;<br/>
3、两个几何的坐标点是否相等;<br/>
支持任意几何类型;<br/></p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>第一个几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>第二个几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>是否相等</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Boolean
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".geodesicLength">
        <a class="href-link" href="#.geodesicLength">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="geodesicLength" style="font-size:30px">
            
                geodesicLength<span class="signature">(geometry<span class="signature-attributes">opt</span>, unit<span class="signature-attributes">opt</span>)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='geodesicLength'></a>
计算地理几何长度;<br/></p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>unit</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LengthUnit.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LengthUnit" global.html#LengthUnit>LengthUnit</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          LengthUnit.meter
      
      </td>
  

  <td class="description last"><p>单位,默认米</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>几何对象的长度</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Number
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






</div>
            
                <div class="member">


    
    <h4 class="name" id=".getAngleFromPoints">
        <a class="href-link" href="#.getAngleFromPoints">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="getAngleFromPoints" style="font-size:30px">
            
                getAngleFromPoints<span class="signature">(pointA, pointB, pointC)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='getAngleFromPoints'></a>
计算三点之间的夹角</p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>pointA</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  

  <td class="description last"><p>第一个点</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>pointB</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  

  <td class="description last"><p>第二个点</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>pointC</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  

  <td class="description last"><p>第三个点</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>角度</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Number
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".getArcFromGeometry">
        <a class="href-link" href="#.getArcFromGeometry">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="getArcFromGeometry" style="font-size:30px">
            
                getArcFromGeometry<span class="signature">(options)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='getArcFromGeometry'></a>
通过几何中的三点弧段数据,构造离散后的几何对象,类型与原始对象一致</p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>options</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             Object
    
</span>



  
  </td>

  
      <td class="default">
      
      </td>
  

  <td class="description last"><p>构造参数</p></td>
</tr>


  
    
<tr class="deep-level-1">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>带三点弧段数据的几何对象</p></td>
</tr>


  
    
<tr class="deep-level-1">
  
      <td class="name"><code>arcInfo</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
         Array.&lt;Object>
    
</span>



  
  </td>

  
      <td class="default">
      
          []
      
      </td>
  

  <td class="description last"><p>弧段信息参数</p></td>
</tr>


  
    
<tr class="deep-level-1">
  
      <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"><p>弧段中点的数量,注意这个是圆弧的数量,意思是将圆分成360份,如果这个弧段的度数为120度,则有
360 * (120/360) = 120段</p></td>
</tr>


  



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>离散后的新几何对象</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".getCenter">
        <a class="href-link" href="#.getCenter">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="getCenter" style="font-size:30px">
            
                getCenter<span class="signature">(point1, point2, point3, hasZ)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='getCenter'></a>
通过三个点求圆心,数学公式,不用进行投影</p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>point1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  

  <td class="description last"><p>第一个点坐标</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>point2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  

  <td class="description last"><p>第二个点坐标</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>point3</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  

  <td class="description last"><p>第三个点坐标</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <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>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>圆心坐标</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
         Array.&lt;Number>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".getCenterOID">
        <a class="href-link" href="#.getCenterOID">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="getCenterOID" style="font-size:30px">
            
                getCenterOID<span class="signature">(geometry)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p>获取几何中心点
<a id='getCenterOID'></a></p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPoint.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPoint" MultiPoint.html>MultiPoint</a>
    
</span>
|

<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>要计算中心点的几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>中心点几何对象</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






</div>
            
                <div class="member">


    
    <h4 class="name" id=".getEllipseCoordinates">
        <a class="href-link" href="#.getEllipseCoordinates">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="getEllipseCoordinates" style="font-size:30px">
            
                getEllipseCoordinates<span class="signature">(center, semiMajorAxis, semiMinorAxis, number)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p>获取椭圆离散化点坐标
<a id='simplify'></a></p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>center</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>椭圆中心</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <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 class="deep-level-0">
  
      <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 class="deep-level-0">
  
      <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>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>离散点坐标数组</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Array
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






</div>
            
                <div class="member">


    
    <h4 class="name" id=".getPositionsFromArc">
        <a class="href-link" href="#.getPositionsFromArc">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="getPositionsFromArc" style="font-size:30px">
            
                getPositionsFromArc<span class="signature">(options)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='getPositionsFromArc'></a>
通过三点弧段构造一组离散的点坐标,此组离散点是线几何的点坐标</p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>options</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             Object
    
</span>



  
  </td>

  
      <td class="default">
      
      </td>
  

  <td class="description last"><p>构造参数</p></td>
</tr>


  
    
<tr class="deep-level-1">
  
      <td class="name"><code>point1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>
|

<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  
      <td class="default">
      
      </td>
  

  <td class="description last"><p>弧段上的第一个点,弧段的起点</p></td>
</tr>


  
    
<tr class="deep-level-1">
  
      <td class="name"><code>point2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>
|

<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  
      <td class="default">
      
      </td>
  

  <td class="description last"><p>弧段上的第二个点,弧段穿过的点</p></td>
</tr>


  
    
<tr class="deep-level-1">
  
      <td class="name"><code>point3</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>
|

<span class="param-type">
    
         Array.&lt;Number>
    
</span>



  
  </td>

  
      <td class="default">
      
      </td>
  

  <td class="description last"><p>弧段上的第三个点,弧段的终点</p></td>
</tr>


  
    
<tr class="deep-level-1">
  
      <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"><p>弧段中点的数量,注意这个是圆弧的数量,意思是将圆分成360份,如果这个弧段的度数为120度,则有
360 * (120/360) = 120段</p></td>
</tr>


  
    
<tr class="deep-level-1">
  
      <td class="name"><code>spatialReference</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="SpatialReference.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="SpatialReference" SpatialReference.html>SpatialReference</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          new zondy.SpatialReference('EPSG:4326')
      
      </td>
  

  <td class="description last"><p>几何点的空间参考系,默认4326,当不是4326时请指定坐标系,方便进行投影转换,参考示例:<a href='#SpatialReference'>[指定坐标系]</a></p></td>
</tr>


  



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>一组离散的点坐标</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Array
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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,
  // 弧段的参考系,默认是4326,非4326坐标系请指定参考系
  spatialReference: new SpatialReference('EPSG:4326')
})</code></pre>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".intersect">
        <a class="href-link" href="#.intersect">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="intersect" style="font-size:30px">
            
                intersect<span class="signature">(geometry1, geometry2)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='intersect'></a>
计算并返回两个几何对象的相交部分;<br/>
支持任意几何或几何对象数组和另一个几何进行相交,忽略三维高度,坐标系必须相同;<br/>
点和任何几何相交返回点或空对象<br/>
多点和任何几何相交返回点或多点或空对象<br/>
线和任意几何对象相交返回相交点或重叠线或相交点和重叠线或空对象<br/>
区和区、区和多区相交返回区或多区或空对象<br/>
矩形、圆、区、多区之间相交返回区或多区或空对象<br/></p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>
|

<span class="param-type">
    
         Array.&lt;<a onclick="getTypeHTML(event)" link="Geometry.html">Geometry</a>>
    
</span>



  
  </td>

  

  <td class="description last"><p>第一个几何对象或几何对象数组</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>第二个几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>相交部分的几何对象或几何对象数组</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>
|

<span class="param-type">
    
         Array.&lt;<a onclick="getTypeHTML(event)" link="Geometry.html">Geometry</a>>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






</div>
            
                <div class="member">


    
    <h4 class="name" id=".intersects">
        <a class="href-link" href="#.intersects">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="intersects" style="font-size:30px">
            
                intersects<span class="signature">(geometry1<span class="signature-attributes">opt</span>, geometry2<span class="signature-attributes">opt</span>)</span>
            
        </span>
    </h4>
    

    
    <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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>求交的几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>求交的几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>是否相交</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Boolean
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".isSimple">
        <a class="href-link" href="#.isSimple">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="isSimple" style="font-size:30px">
            
                isSimple<span class="signature">(geometry)</span>
            
        </span>
    </h4>
    

    
    <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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>拓扑检查是否通过</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Boolean
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".nearestCoordinate">
        <a class="href-link" href="#.nearestCoordinate">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="nearestCoordinate" style="font-size:30px">
            
                nearestCoordinate<span class="signature">(geometry, inputPoint)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='nearestCoordinate'></a>
在几何对象的coordinates中寻找与指定点距离最近的点</p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPoint.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPoint" MultiPoint.html>MultiPoint</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>几何对象,支持多点、线、多线、面、多面、圆、矩形</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>inputPoint</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>指定点,需为point</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>距离最近的点数组</p>
<ul>
<li>@example <caption><h5>多点到目标点最近点</h5></caption>
// ES5引入方式
const { Point, MultiPoint, GeometryEngine } = zondy.geometry
// ES6引入方式
import { GeometryEngine, MultiPoint, Point } from &quot;@mapgis/webclient-common&quot;
// 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(&quot;多点到目标点最近点:&quot;, pointToMultiPoint);</li>
</ul></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
         Project.&lt;<a onclick="getTypeHTML(event)" link="Point.html">Point</a>>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".overlaps">
        <a class="href-link" href="#.overlaps">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="overlaps" style="font-size:30px">
            
                overlaps<span class="signature">(geometry1, geometry2)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='overlaps'></a>
判断两个几何对象是否重叠,即两个几何相交但不互相包含</p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>第一个几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>第二个几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>几何对象是否重叠</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Boolean
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".planarArea">
        <a class="href-link" href="#.planarArea">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="planarArea" style="font-size:30px">
            
                planarArea<span class="signature">(geometry, unit<span class="signature-attributes">opt</span>)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='planarArea'></a>
计算几何对象的面积;<br/>
仅计算平面面积,忽略地球弧度,当坐标系为WGS84相关坐标系时,也仅会计算平面面积,例如坐标为[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]的区几何的面积为1;<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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>



  
  </td>

  
      <td class="default">
      
      </td>
  

  <td class="description last"><p>计算面积的几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>unit</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="AreaUnits.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="AreaUnits" global.html#AreaUnits>AreaUnits</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          AreaUnits.squareMeters
      
      </td>
  

  <td class="description last"><p>返回值的单位</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>几何对象的面积</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Number
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".planarLength">
        <a class="href-link" href="#.planarLength">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="planarLength" style="font-size:30px">
            
                planarLength<span class="signature">(geometry<span class="signature-attributes">opt</span>, unit<span class="signature-attributes">opt</span>)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='planarLength'></a>
计算几何长度或周长;<br/>
仅计算平面距离,忽略地球弧度,当坐标系为WGS84相关坐标系时,也仅会计算平面距离,例如坐标为[[0, 0], [0, 1]]的线几何的长度为1;<br/>
支持自定义坐标系,忽略三维高度;<br/>
支持的几何类型为线、多线、区、多区、圆形以及矩形;<br/>
当几何为线时,返回线的长度;<br/>
当几何为多线时,返回多线中子线的长度之和;<br/>
当几何为区、圆形以及矩形时,返回其周长;<br/>
当几何为多区时,返回多区中子区的周长之和;<br/>
示例如下:<br/>
<a href='#planarLength1'>[1、计算几何长度]</a><br/>
<a href='#planarLength2'>[2、计算几何周长]</a><br/></p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            
            <th style="min-width: 100px;">默认值</th>
            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          null
      
      </td>
  

  <td class="description last"><p>几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>unit</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LinearUnits.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LinearUnits" global.html#LinearUnits>LinearUnits</a>
    
</span>



  
  </td>

  
      <td class="default">
      
          LinearUnits.meters
      
      </td>
  

  <td class="description last"><p>返回值的单位</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>几何对象的长度或周长</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Number
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".rotate">
        <a class="href-link" href="#.rotate">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="rotate" style="font-size:30px">
            
                rotate<span class="signature">(geometry, angle, rotationOrigin)</span>
            
        </span>
    </h4>
    

    
    <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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>被旋转的几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <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 class="deep-level-0">
  
      <td class="name"><code>rotationOrigin</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>旋转中心点,默认为几何质心</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>旋转后的新几何对象</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>&lt;caption id='rotate2'>&lt;h5>旋转区&lt;/h5>&lt;/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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".simplify">
        <a class="href-link" href="#.simplify">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="simplify" style="font-size:30px">
            
                simplify<span class="signature">(geometry)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p>拓扑矫正
<a id='simplify'></a></p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>要进行矫正的几何</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>矫正后的几何对象</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






</div>
            
                <div class="member">


    
    <h4 class="name" id=".touches">
        <a class="href-link" href="#.touches">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="touches" style="font-size:30px">
            
                touches<span class="signature">(geometry1, geometry2)</span>
            
        </span>
    </h4>
    

    
    <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>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry1</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>用来测试相邻关系的几何,支持线、多线、区、多区、圆、矩形</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometry2</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Point.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Point" Point.html>Point</a>
    
</span>
|

<span class="param-type">
    
             <a link="LineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="LineString" LineString.html>LineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPoint.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPoint" MultiPoint.html>MultiPoint</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiLineString.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiLineString" MultiLineString.html>MultiLineString</a>
    
</span>
|

<span class="param-type">
    
             <a link="MultiPolygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="MultiPolygon" MultiPolygon.html>MultiPolygon</a>
    
</span>
|

<span class="param-type">
    
             <a link="Circle.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Circle" Circle.html>Circle</a>
    
</span>
|

<span class="param-type">
    
             <a link="Extent.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Extent" Extent.html>Extent</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>被测试相邻关系的几何,支持点、多点、线、多线、区、多区、圆、矩形</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>是否相邻</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Boolean
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".union">
        <a class="href-link" href="#.union">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="union" style="font-size:30px">
            
                union<span class="signature">(geometries)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='union'></a>
多个几何对象求并,并返回求并后的新几何对象;<br/>
输入的几何类型必须一致,点和多点、区和多区视为同一个类型,且几何对象的坐标系要一致;<br/>
忽略三维高度;<br>
支持的几何有:点(多点)几何对象、区(多区)几何对象、范围几何对象、圆几何对象<br/>
点和点、点和多点、多点和多点合并为一个多点几何对象,如果有多个点坐标(XYZ)相同,则会去重;<br/>
线和线、线和多线、多线和多线合并为一个线几何对象或多线几何对象;<br/>
区和区、区和多区、多区和多区合并为一个区级和对象或多区几何对象;<br/>
矩形和矩形合并为一个多边形几何对象或一个更大的矩形几何对象;<br/>
圆和圆合并为一个多边形几何对象或一个圆几何对象或两个不相交的圆;</p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>geometries</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
         Array.&lt;<a onclick="getTypeHTML(event)" link="Geometry.html">Geometry</a>>
    
</span>



  
  </td>

  

  <td class="description last"><p>求并几何或几何数组</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>求并后的新几何对象</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
                <div class="member">


    
    <h4 class="name" id=".within">
        <a class="href-link" href="#.within">#</a>
        
            
                <span class='tag'>static</span>
            
        
        <span class="code-name" id="within" style="font-size:30px">
            
                within<span class="signature">(innerGeometry, outerGeometry)</span>
            
        </span>
    </h4>
    

    
    <div class="description">
        <p><a id='within'></a>
判断innerGeometry几何对象是否完全在outerGeometry中</p>
    </div>
    









    <h4>参数</h4>
    
<div class="table-container">
    <table class="params table">
        <thead>
        <tr>
            
            <th>名称</th>
            

            <th>类型</th>

            

            <th class="last">描述</th>
        </tr>
        </thead>

        <tbody>
        

            
<tr class="deep-level-0">
  
      <td class="name"><code>innerGeometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>内部几何对象</p></td>
</tr>



        

            
<tr class="deep-level-0">
  
      <td class="name"><code>outerGeometry</code></td>
  

  <td class="type">
  
      
<span class="param-type">
    
             <a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a>
    
</span>



  
  </td>

  

  <td class="description last"><p>外部几何对象</p></td>
</tr>



        
        </tbody>
    </table>
</div>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    
    

    

    

    
</dl>


















    <div class='columns method-parameter'>
        <div class="column is-2"><label>返回值</label></div>
        <div class="column is-10">
            
                    

<div class="columns">
    
    <div class='param-desc column is-7'><p>是否完全包含</p></div>
    
    
    <div class='column is-5 has-text-left'>
        <label>类型: </label>
        
<span class="param-type">
    
             Boolean
    
</span>



    </div>
    
</div>

                
        </div>
    </div>






    <h5>示例</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>
    


</div>
            
            </div>
        </div>
    

    

    
</article>

</section>