當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


JavaScript ArcGIS GeometryService.convexHull用法及代碼示例

基本信息

以下是所在類或對象的基本信息。

AMD: require(["esri/tasks/GeometryService"], (GeometryService) => { /* code goes here */ });

ESM: import GeometryService from "@arcgis/core/tasks/GeometryService";

類: esri/tasks/GeometryService

繼承: GeometryService > Task > Accessor

自從:用於 JavaScript 4.0 的 ArcGIS API

用法說明

GeometryService.convexHull函數(或屬性)的定義如下:

convexHull (geometries, requestOptions) {Promise<Geometry>}


convexHull 操作是在幾何服務資源上執行的。它返回輸入幾何的凸包。輸入幾何可以是點、多點、折線或多邊形。 shell 通常是多邊形,但在退化的情況下也可以是折線或點。

參數:

類型說明
geometries Geometry[]

要創建其凸包的幾何圖形。

requestOptions Object
可選的

用於數據請求的附加 options

返回:

類型 說明
Promise<Geometry> 解析後,返回一個Geometry,表示輸入的凸包。

例子:

let geoms = pointLayer.graphics.map(function(item, i){
  return webMercatorUtils.geographicToWebMercator(item.geometry);
});
geometryService.convexHull(geoms.toArray()).then(function(result){
  convexLayer.add(new Graphic({
    geometry: result
  }));
},function(error){
   console.log("error occured", error)
});

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 GeometryService.convexHull。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。