#### # new GeometryEngine()

几何分析工具

查看源代码 common/base/geometry/GeometryEngine.js, line 18

##### 支持如下方法：

[1、是否包含(contains)]
[2、是否穿过]
[3、几何切割]
[4、几何求差]
[5、是否相离]
[6、是否相等]
[7、是否相交]
[8、返回两个几何对象的相交部分]
[9、距离最近的点]
[10、是否重叠]
[11、计算平面面积]
[12、计算平面长度]
[13、计算地理长度]
[14、旋转]
[15、计算距离]
[16、是否相邻]
[17、求并]
[18、是否被包含(within)]
[19、缓冲区分析]
[20、拓扑检查]

### 方法

#### # static buffer(geometryopt, distanceopt, unitopt, unionResultsopt)

缓冲区分析;
支持点几何、多点几何、线几何、多线几何、区几何、多区几何、矩形几何、圆形几何或任意几何组成的几何数组;
忽略三维高度，当geometry为几何数组时，其子元素的坐标系必须相同;
如果distance是数字，则可以为正值或负值，是正值则向外扩张，是负值，则表示向内收缩;
如果distance是数字，且geometry为几何数组，则该数字会应用到所有geometry数组的子元素;
如果distance是数组且geometry是数组，当distance的长度小于geometry数组的长度时，会以distance的最后一个子元素扩充distance数组，使其长度和geometry数组的长度相同，之后将distance数组和geometry数组根据下标一一对应，执行缓冲区分析;
如果distance是数组，但geometry不是数组，则使distance数组的第一个子元素做为缓冲距离来执行缓冲区分析;
注意一个或多个几何执行缓冲区分析后，由于缓冲后几何扩大，可能导致一个或多个几何出现重合的情况;;
示例如下：
[1、区缓冲分析]
[2、多区缓冲分析]
[3、几何数组缓冲区分析]
[4、几何数组缓冲区分析 - 结果几何合并]
[5、区缓冲分析 - 自定义坐标系]
[6、点缓冲分析]
[7、线缓冲分析]
[8、矩形缓冲分析]
[9、圆形缓冲分析]

#### 参数:

名称 | 类型 | 默认值 | 描述
--- | --- | --- | ---
`geometry` | Geometry | Array.<Geometry> | null | 要进行缓冲区分析的几何对象
`distance` | Number | Array.<Number> | 1000 | 缓冲距离
`unit` | LengthUnit | LengthUnit.meter | 单位，默认米
`unionResults` | Boolean | false | 是否将返回的多个几何对象合并为单几何对象，默认为false，即不合并几何

查看源代码 common/base/geometry/GeometryEngine.js, line 576

返回值:

缓冲区分析后的几何对象

类型: Geometry | Array.<Geometry>

##### 示例

##### 区缓冲分析

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

##### 多区缓冲分析

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

##### 几何对象数组的缓冲区分析

    // 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])

##### 几何数组缓冲区分析 - 分析结果几何求并

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

##### 区缓冲分析 - 自定义坐标系

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

##### 点缓冲分析

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

##### 线缓冲分析

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

##### 矩形缓冲分析

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

##### 圆形缓冲分析

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

#### # static contains(containerGeometryopt, insideGeometryopt)

判断containerGeometry对象是否完全包含insideGeometry对象;
忽略三维高度;
支持自定义坐标系的几何对象，几何的坐标系必须相同;
包含标准如下： 点包含点的标准为：两个点几何坐标是否相等;
线包含线的标准为：一条线上的点都在另一条线上，或两条线的点坐标相同;
区包含线的标准为：线在区几何内，但线不全部在区几何边线上(包括内圈和外圈的边线);
区包含线的标准为：点在区几何内，不在边线上(包括内圈和外圈的边线);
区包含区的标准为：一个区在另一个区内(如果有带洞区域，则不能在带洞区域内，可以挨着边线)，边线可以重合;
其他情况为上述标准的组合;
由于包含的情况太多，这里仅列举部分示例，示例如下：
[1、区包含点]
[2、多点包含点]
[3、区包含线]
[4、圆包含矩形]
[5、几何包含 - 自定义坐标系]

#### 参数:

名称 | 类型 | 默认值 | 描述
--- | --- | --- | ---
`containerGeometry` | Geometry | null | 包含几何对象
`insideGeometry` | Geometry | null | 被包含的几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 4042

返回值:

是否包含

类型: Boolean

##### 示例

##### 区包含点

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

##### 多点包含点

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

##### 区包含线

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

##### 圆包含矩形

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

##### 几何包含 - 自定义坐标系

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

#### # static crosses(geometry1, geometry2)

判断一个几何对象是否穿过另一个几何对象;
要穿过的几何类型为：线、多线，忽略三维高度;
被穿过的几何类型为：线、多线、矩形、圆、区以及多区，忽略三维高度，穿线和被穿过几何的坐标系必须相同;
要穿过的几何与被穿过的几何（geometry1和geometry2）可以调换输入，但其中一个geometry必须是LineString、MultiLineString中的一类;
当被穿过的几何类型为MultiLineString、MultiPolygon时，只要MultiLineString和MultiPolygon中有一个要素被穿过，就算穿过，返回true;
当要穿过的几何类型为MultiLineString时，只要MultiLineString中有一条线穿过geometry2（被穿过的几何体），就算穿过，返回true;
如果两条线出现重叠，此种情况不算穿过，返回false;<br/ 如果两条线出现“入”型、“L”型，此种情况不算穿过，返回false;
线与圆相切的情况不算穿过，返回false;
线和多边形的一条边重叠，算穿过，返回true;
当polygon有内圈时，只要穿过外圈就算穿过，返回true;
示例如下：
[1、线穿过线]
[2、线穿过多线]
[3、线穿过区]
[4、多线穿过区]
[5、多线穿过多区]

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry1` | LineString | MultiLineString | 第一个几何体，支持线、多线；
`geometry2` | LineString | Polygon | MultiLineString | MultiPolygon | Circle | Extent | 第二个几何体，支持线、多线、面、多面、圆、矩形，两个参数可以调换输入，但其中一个geometry必须是LineString、MultiLineString中的一类；

查看源代码 common/base/geometry/GeometryEngine.js, line 5463

返回值:

是否穿过

类型: Boolean

##### 示例

##### 线穿过线

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

##### 线穿过多线

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

##### 线穿过区

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

##### 多线穿过区

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

##### 多线穿过多区

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

#### # static cut(geometry, cutter)

使用一条线来切割几何，将其分割为多个几何对象;
被切割的几何类型为：线、多线、区以及多区，忽略三维高度，切线和被切割几何的坐标系必须相同;
此接口不会像arcgis的geometryEngine.cut方法那样，返回切割线左右两边的几何对象数组，而是把所有的被切割好的几何组成一个数组并返回;
如果切割线和被切割几何没有相交，则会返回一个空数组;
线切割线会返回被切割后的线几何数组;
线切割多线仅会返回被切割后的线几何数组，如果多线中的某一个线段不与切割线相交，则不会返回该线段几何;
线切割区会返回被切割后的区几何数组，如果切线仅仅是部分和区相交，但是没有穿过几何，会返回一个仅包含该区几何对像的数组;
线切割多区仅会返回被切割后的区几何数组，如果多区中的某一个区不与切割线相交，则不会返回该区几何;
示例如下：
[1、线切割线]
[2、线切割多线]
[3、线切割区]
[4、线切割多区]
[5、几何切割 - 自定义坐标系]

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry` | LineString | MultiLineString | Polygon | MultiPolygon | 被切割的区对象
`cutter` | LineString | 切割线几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 6625

返回值:

切割后的几何数组

类型: Array.<Geometry>

##### 示例

##### 线切割线

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

##### 线切割多线

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

##### 线切割区

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

##### 线切割多区

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

##### 几何切割 - 自定义坐标系

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

#### # static difference(inputGeometry, subtractGeometry)

几何求差，即返回inputGeometry几何对象减去subtractGeometry几何对象之后的部分;
支持区、多区、矩形和圆形之间进行相互求差;
支持自定义坐标系几何，忽略三维高度;
求差后可能返回一个区几何或一个多区几何或者一个空对象;
由于示例太多，仅列举部分示例，示例如下：
[1、区和区求差]
[2、区和多区求差]
[3、多区和圆形求差]
[4、矩形和圆求差]

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`inputGeometry` | Polygon | MultiPolygon | Extent | Circle | 被求差几何对象
`subtractGeometry` | Polygon | MultiPolygon | Extent | Circle | 求差几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 203

返回值:

求差后的几何对象

类型: Polygon | MultiPolygon

##### 示例

##### 区和区求差

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

##### 区和多区求差

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

##### 多区和圆形求差

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

##### 矩形和圆求差

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

#### # static disjoint(geometry1opt, geometry2opt)

判断两个几何是否相离，即完全不相交;
支持自定义坐标系几何对象，两个几何对象的坐标系要一致，忽略三维高度;
示例如下：
[是否相离]

#### 参数:

名称 | 类型 | 默认值 | 描述
--- | --- | --- | ---
`geometry1` | Geometry | null | 第一个几何对象
`geometry2` | Geometry | null | 第二个几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 5210

返回值:

是否相离

类型: Boolean

##### 示例

##### 是否相离

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

#### # static distance(geometry1, geometry2, unit)

计算两点之间的距离，坐标系取第一个图层的坐标系

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry1` | Point | 第一个几何体，需为point
`geometry2` | Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon | Circle | Extent | 第二个几何体，可以为点、多点、线、多线、面、多面、圆、矩形
`unit` | String | 单位，默认为"kilometers"

查看源代码 common/base/geometry/GeometryEngine.js, line 4801

返回值:

距离

类型: Number

##### 示例

##### 点和点求距离

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

##### 点和线求距离

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

##### 点和面求距离

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

#### # static equals(geometry1opt, geometry2opt)

判断两个几何是否相等;
使用如下判断标准：
1、类型是否相等;
2、坐标系是否相等;
3、两个几何的坐标点是否相等;
支持任意几何类型;

#### 参数:

名称 | 类型 | 默认值 | 描述
--- | --- | --- | ---
`geometry1` | Geometry | null | 第一个几何对象
`geometry2` | Geometry | null | 第二个几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 4985

返回值:

是否相等

类型: Boolean

##### 示例

##### 判断几何是否相等

    const isEquals = GeometryEngine.equals(new Point({
      coordinates: [1, 10]
    }), new Point({
      coordinates: [1, 10]
    }))
    console.log("点和点是否相同：", isEquals)

#### # static geodesicLength(geometryopt, unitopt)

计算地理几何长度;

#### 参数:

名称 | 类型 | 默认值 | 描述
--- | --- | --- | ---
`geometry` | LineString | null | 几何对象
`unit` | LengthUnit | LengthUnit.meter | 单位，默认米

查看源代码 common/base/geometry/GeometryEngine.js, line 1544

返回值:

几何对象的长度

类型: Number

#### # static intersect(geometry1, geometry2)

计算并返回两个几何对象的相交部分;
支持任意几何或几何对象数组和另一个几何进行相交，忽略三维高度，坐标系必须相同;
点和任何几何相交返回点或空对象
多点和任何几何相交返回点或多点或空对象
线和任意几何对象相交返回相交点或重叠线或相交点和重叠线或空对象
区和区、区和多区相交返回区或多区或空对象
矩形、圆、区、多区之间相交返回区或多区或空对象

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry1` | Geometry | Array.<Geometry> | 第一个几何对象或几何对象数组
`geometry2` | Geometry | 第二个几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 1802

返回值:

相交部分的几何对象或几何对象数组

类型: Geometry | Array.<Geometry>

#### # static intersects(geometry1opt, geometry2opt)

判断两个几何对象是否相交;
支持任意几何类型求交;
支持自定义坐标系的几何对象，两个求交几何的坐标系必须相同，忽略三位高度;
由于示例太多，这里仅列举部分示例，示例如下：
[1、线和区求交]
[2、点和区求交]
[3、区和多区求交]
[4、矩形和圆形求交]
[5、几何求交 - 自定义参考系]

#### 参数:

名称 | 类型 | 默认值 | 描述
--- | --- | --- | ---
`geometry1` | Geometry | null | 求交的几何对象
`geometry2` | Geometry | null | 求交的几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 1525

返回值:

是否相交

类型: Boolean

##### 示例

##### 线和区求交

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

##### 点和区求交

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

##### 区和多区求交

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

##### 矩形和圆形求交

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

##### 几何求交 - 自定义参考系

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

#### # static isSimple(geometry)

对几何对象进行拓扑检查;
支持的几何类型为线、多线、区和多区，支持任意坐标系几何，忽略三维高度;
线类型的标准为：1、自身的非相邻线段不会自相交(两个线段仅有一个端点重叠不算相交)；2、线自身的线段不会重叠;
多线类型的标准为：1、自身的子线段必须是拓扑正确的；2、子线段不会相交;
区类型的标准为：1、外圈和内圈满足线类型的拓扑检查标准；2、外圈和内圈、内圈和内圈不会相交；3、内圈不会超过外圈;
多区类型的标准为：1、自身的子区必须是拓扑正确的；2、子区不会相交;
示例如下：
[1、对线几何进行拓扑检查]
[2、对多线几何进行拓扑检查]
[3、对区几何进行拓扑检查]
[4、对多区几何进行拓扑检查]

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry` | LineString | MultiLineString | Polygon | MultiPolygon | 几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 7100

返回值:

拓扑检查是否通过

类型: Boolean

##### 示例

##### 对线几何进行拓扑检查

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

##### 对多线几何进行拓扑检查

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

##### 对区几何进行拓扑检查

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

##### 对多区几何进行拓扑检查

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

#### # static nearestCoordinate(geometry, inputPoint)

在几何对象的coordinates中寻找与指定点距离最近的点

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry` | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon | Circle | Extent | 几何对象,支持多点、线、多线、面、多面、圆、矩形
`inputPoint` | Point | 指定点，需为point

查看源代码 common/base/geometry/GeometryEngine.js, line 3261

返回值:

距离最近的点数组

- @example

  ##### 多点到目标点最近点

  // ES5引入方式 const { Point, MultiPoint, GeometryEngine } = Zondy.Geometry // ES6引入方式 import { GeometryEngine, MultiPoint, Point } from "@mapgis/webclient-common" // inputPoint const inputPoint = new Point({ coordinates: [108, 28], }); // geometry MultiPoint const multiPoint = new MultiPoint({ coordinates: [ [110, 20], [109, 19], ], }); // 多点到目标点最近点 const pointToMultiPoint = GeometryEngine.nearestCoordinate( multiPoint, inputPoint ); console.log("多点到目标点最近点：", pointToMultiPoint);

类型: Project.<Point>

##### 示例

##### 线到目标点最近点

    // 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);

##### 区到目标点最近点

    // 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);

#### # static overlaps(geometry1, geometry2)

判断两个几何对象是否重叠，即两个几何相交但不互相包含

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry1` | Geometry | 第一个几何对象
`geometry2` | Geometry | 第二个几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 2820

返回值:

几何对象是否重叠

类型: Boolean

##### 示例

##### 几何是否重叠

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

#### # static planarArea(geometry, unit)

计算几何对象的面积;
仅计算平面面积，忽略地球弧度，当坐标系为WGS84相关坐标系时，也仅会计算平面面积，例如坐标为[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]的区几何的面积为1;
支持自定义坐标系，忽略三维高度;
支持区、多区、矩形和圆形几何对象;
当为区或多区几何对象时，若该区带洞或多区的子区带洞，则会减去这些洞的面积;
示例如下：
[1、计算区(不带洞)面积]
[2、计算区(带洞)面积]
[3、计算多区面积]
[4、计算圆面积]
[5、计算矩形面积]

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry` | Polygon | MultiPolygon | Circle | Extent | 计算面积的几何对象
`unit` | LengthUnit | 单位，默认米，当为经纬度相关坐标系时，该参数失效

查看源代码 common/base/geometry/GeometryEngine.js, line 3591

返回值:

几何对象的面积

类型: Number

##### 示例

##### 计算区(不带洞)面积

    // ES5引入方式
    const { Polygon, GeometryEngine } = Zondy.Geometry
    const { LengthUnit } = Zondy.Enum
    // 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 meter = GeometryEngine.planarArea(polygon)
    console.log("meter:", meter)
    // 单位千米
    const kilometer = GeometryEngine.planarArea(polygon, LengthUnit.kilometer)
    console.log("kilometer:", kilometer)
    // 单位英里
    const mile = GeometryEngine.planarArea(polygon, LengthUnit.mile)
    console.log("mile:", mile)

##### 计算区(带洞)面积

    // ES5引入方式
    const { Polygon, GeometryEngine } = Zondy.Geometry
    const { LengthUnit } = Zondy.Enum
    // 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 meter = GeometryEngine.planarArea(polygon)
    console.log("meter带洞:", meter2)
    // 单位千米
    const kilometer = GeometryEngine.planarArea(polygon, LengthUnit.kilometer)
    console.log("kilometer带洞:", kilometer)
    // 单位英里
    const mile = GeometryEngine.planarArea(polygon, LengthUnit.mile)
    console.log("mile带洞:", mile)

##### 计算多区面积

    // ES5引入方式
    const { MultiPolygon, GeometryEngine } = Zondy.Geometry
    const { LengthUnit } = Zondy.Enum
    // 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 meter3 = GeometryEngine.planarArea(multiPolygon)
    console.log("meter多区:", meter3)
    // 单位千米
    const kilometer3 = GeometryEngine.planarArea(multiPolygon, LengthUnit.kilometer)
    console.log("kilometer多区:", kilometer3)
    // 单位英里
    const mile3 = GeometryEngine.planarArea(multiPolygon, LengthUnit.mile)
    console.log("mile多区:", mile3)

##### 计算圆面积

    // ES5引入方式
    const { Circle, GeometryEngine } = Zondy.Geometry
    const { LengthUnit } = Zondy.Enum
    // ES6引入方式
    import { Circle, LengthUnit, GeometryEngine } from "@mapgis/webclient-common"
    //圆几何
    const circle = new Circle({
      center: [0, 0],
      radius: 10
    })
    // 计算圆几何面积
    // 单位米
    const meter3 = GeometryEngine.planarArea(circle)
    console.log("meter圆几何:", meter3)
    // 单位千米
    const kilometer3 = GeometryEngine.planarArea(circle, LengthUnit.kilometer)
    console.log("kilometer圆几何:", kilometer3)
    // 单位英里
    const mile3 = GeometryEngine.planarArea(circle, LengthUnit.mile)
    console.log("mile圆几何", mile3)

##### 计算矩形面积

    // ES5引入方式
    const { Extent, GeometryEngine } = Zondy.Geometry
    const { LengthUnit } = Zondy.Enum
    // ES6引入方式
    import { Extent, LengthUnit, GeometryEngine } from "@mapgis/webclient-common"
    //矩形几何
    const extent = new Extent({
      xmin: 0,
      ymin: 0,
      xmax: 2,
      ymax: 2
    })
    // 计算矩形几何面积
    // 单位米
    const meter3 = GeometryEngine.planarArea(extent)
    console.log("meter矩形几何:", meter3)
    // 单位千米
    const kilometer3 = GeometryEngine.planarArea(extent, LengthUnit.kilometer)
    console.log("kilometer矩形几何:", kilometer3)
    // 单位英里
    const mile3 = GeometryEngine.planarArea(extent, LengthUnit.mile)
    console.log("mile矩形几何", mile3)

#### # static planarLength(geometryopt, unitopt)

计算几何长度或周长;
仅计算平面距离，忽略地球弧度，当坐标系为WGS84相关坐标系时，也仅会计算平面距离，例如坐标为[[0, 0], [0, 1]]的线几何的长度为1;
支持自定义坐标系，忽略三维高度;
支持的几何类型为线、多线、区、多区、圆形以及矩形;
当几何为线时，返回线的长度;
当几何为多线时，返回多线中子线的长度之和;
当几何为区、圆形以及矩形时，返回其周长;
当几何为多区时，返回多区中子区的周长之和;
示例如下:
[1、计算几何长度]
[2、计算几何周长]

#### 参数:

名称 | 类型 | 默认值 | 描述
--- | --- | --- | ---
`geometry` | LineString | MultiLineString | Polygon | MultiPolygon | Circle | Extent | null | 几何对象
`unit` | LengthUnit | LengthUnit.meter | 单位，默认米

查看源代码 common/base/geometry/GeometryEngine.js, line 3754

返回值:

几何对象的长度或周长

类型: Number

##### 示例

##### 计算几何长度

    // 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)
    console.log("线几何长度：", length)
    // 单位千米
    const length2 = GeometryEngine.planarLength(line, LengthUnit.kilometer)
    console.log("线几何长度：", length2)
    // 单位英里
    const length3 = GeometryEngine.planarLength(line, LengthUnit.mile)
    console.log("线几何长度：", length3)

##### 计算几何周长

    // 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)
    console.log("区几何周长：", length)
    // 单位千米
    const length2 = GeometryEngine.planarLength(polygon, LengthUnit.kilometer)
    console.log("区几何周长：", length2)
    // 单位英里
    const length3 = GeometryEngine.planarLength(polygon, LengthUnit.mile)
    console.log("区几何周长：", length3)

#### # static rotate(geometry, angle, rotationOrigin)

顺时针旋转几何，支持所有基础几何对象;
可以指定旋转中心点，当不指定时使用几何质心;
忽略三维高度;
支持自定义坐标系几何，几何对象与旋转中心点的坐标系必须一致;
示例如下：
[1、旋转多点]
[2、旋转区]
[3、旋转多区]
[4、旋转线]
[5、旋转多线]
[6、旋转矩形]
[7、旋转圆形]
[8、旋转区 - 自定义坐标系]
[9、绕点旋转 - 区]
[10、绕点旋转 - 点]

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry` | Geometry | 被旋转的几何对象
`angle` | Number | 旋转角度，单位度，顺时针旋转
`rotationOrigin` | Point | 旋转中心点，默认为几何质心

查看源代码 common/base/geometry/GeometryEngine.js, line 3061

返回值:

旋转后的新几何对象

类型: Geometry

##### 示例

##### 旋转多点

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

    <caption id='rotate2'><h5>旋转区</h5></caption>
    // ES5引入方式
    const { Polygon, GeometryEngine } = Zondy.Geometry
    // ES6引入方式
    import { Polygon, GeometryEngine } from "@mapgis/webclient-common"
    // 构造区几何
    const polygon = new Polygon({
      coordinates: [
        [
          [108.36341, 29.032578],
          [116.13094, 29.032578],
          [116.13094, 33.273224],
          [108.36341, 33.273224],
          [108.36341, 29.032578],
        ]
      ]
    })
    // 执行旋转操作
    const rotateGeometry = GeometryEngine.rotate(polygon, 10)

##### 旋转多区

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

##### 旋转线

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

##### 旋转多线

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

##### 旋转矩形

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

##### 旋转圆形

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

##### 旋转区 - 自定义坐标系

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

##### 绕点旋转 - 区

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

##### 绕点旋转 - 点

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

#### # static touches(geometry1, geometry2)

判断一个几何对象是否和另一个几何对象相邻 被测试相邻关系的几何类型为：线、多线、矩形、圆、区以及多区，忽略三维高度;
用来测试相邻关系的几何类型为：点、多点、线、多线、矩形、圆、区以及多区，忽略三维高度，穿线和被穿过几何的坐标系必须相同;
线和点相邻的标准为：点在线的两端，且线不是头尾闭合的;
对于multi类型的几何（如多点、多线、多区）,无论其和任何其他支持的几何类型判断touch，只要multi中的一个与另一个geometry有包含关系、相交关系，touch即为false;
对于区、线、圆、矩形和多点判断相邻关系时，只有有一个点在区内、线上、矩形内、圆内，touch即为false;
示例如下：
[1、线和点相邻]
[2、多线和多点相邻]
[3、区和线相邻]
[4、多区和区相邻]
[5、圆和圆相邻]

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometry1` | LineString | Polygon | MultiLineString | MultiPolygon | Circle | Extent | 用来测试相邻关系的几何，支持线、多线、区、多区、圆、矩形
`geometry2` | Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon | Circle | Extent | 被测试相邻关系的几何，支持点、多点、线、多线、区、多区、圆、矩形

查看源代码 common/base/geometry/GeometryEngine.js, line 5882

返回值:

是否相邻

类型: Boolean

##### 示例

##### 线和点相邻

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

##### 多线和多点相邻

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

##### 区和线相邻

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

##### 多区和区相邻

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

##### 圆和圆相邻

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

#### # static union(geometries)

多个几何对象求并，并返回求并后的新几何对象；
输入的几何类型必须一致，点和多点、区和多区视为同一个类型，且几何对象的坐标系要一致；
忽略三维高度；
支持的几何有：点(多点)几何对象、区(多区)几何对象、范围几何对象、圆几何对象
点和点、点和多点、多点和多点合并为一个多点几何对象，如果有多个点坐标(XYZ)相同，则会去重；
线和线、线和多线、多线和多线合并为一个线几何对象或多线几何对象；
区和区、区和多区、多区和多区合并为一个区级和对象或多区几何对象；
矩形和矩形合并为一个多边形几何对象或一个更大的矩形几何对象；
圆和圆合并为一个多边形几何对象或一个圆几何对象或两个不相交的圆；

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`geometries` | Array.<Geometry> | 求并几何或几何数组

查看源代码 common/base/geometry/GeometryEngine.js, line 1110

返回值:

求并后的新几何对象

类型: Geometry

##### 示例

##### 点和点求并

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

##### 点和多点求并

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

##### 多点和多点求并

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

##### 区和区求并

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

##### 区和带洞区求并

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

##### 带洞区和带洞区的求并

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

#### # static within(innerGeometry, outerGeometry)

判断innerGeometry几何对象是否完全在outerGeometry中

#### 参数:

名称 | 类型 | 描述
--- | --- | ---
`innerGeometry` | Geometry | 内部几何对象
`outerGeometry` | Geometry | 外部几何对象

查看源代码 common/base/geometry/GeometryEngine.js, line 5245

返回值:

是否完全包含

类型: Boolean

##### 示例

##### 判断是否包含

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