当前位置: 首页 > java >正文

arcgis js统计FeatureLayer的椭球面积、平面面积

1、导入依赖

import FeatureLayer from '@arcgis/core/layers/FeatureLayer'
import { geodesicArea, planarArea, simplify } from '@arcgis/core/geometry/geometryEngine';
import { project, load as projectionLoad } from '@arcgis/core/geometry/projection'

2、初始化project

onMounted(() => {// 第一步:加载投影引擎projectionLoad()
})

3、计算椭球面积、平面面积

const calculateFeatureLayer = async (featureLayer: FeatureLayer) => {const query = featureLayer.createQuery()query.where = '1 = 1'const result = await featureLayer.queryFeatures(query)// 总面积统计let totalGeoArea = 0;let totalPlanarArea = 0;for (const feature of result.features) {if (feature.geometry.type === 'polygon') {let geometry = feature.geometry// 坐标系转换if (geometry.spatialReference.wkid !== 4326) {geometry = await project(geometry, { wkid: 4326 }) as any}// 简化多边形const simplifiedPolygon = simplify(geometry)// 椭球面积const geoArea = geodesicArea(simplifiedPolygon, "square-kilometers")totalGeoArea += geoArea// 平面面积const projectedGeometry = await project(simplifiedPolygon, { wkid: 3857 }) as anyconst planarAreaResult = planarArea(projectedGeometry, "square-kilometers")totalPlanarArea += planarAreaResult}}console.log("椭球面积(平方千米):", totalGeoArea)console.log("毛面积(平方千米):", totalPlanarArea)}
http://www.xdnf.cn/news/8328.html

相关文章:

  • 如果请求体不是JSON格式,UserController层会怎样?
  • PCA例题
  • UG903 (v2024.2)的中文版
  • 楼宇自控系统赋予建筑智慧动能,加速智慧低碳建筑建设进程
  • 代码随想录算法训练营第四十八天
  • 昆仑芯超节点创新设计:1U 4 卡高密算力,无缝适配各类机房环境
  • Linux之Ext系列文件系统(含动静态库)
  • ansible剧本和角色的使用,部署lnmp
  • 搭建自己的语音对话系统:开源 S2S 流水线深度解析与实战
  • 李宏毅《深度学习》:Self-attention 自注意力机制
  • redis 进行缓存实战-18
  • 第J2周:ResNet50V2 算法实战与解析
  • Python爬虫(35)Python爬虫高阶:基于Docker集群的动态页面自动化采集系统实战
  • 内网渗透——红日靶场四
  • 从逻辑视角学习信息论:概念框架与实践指南
  • 127. 单词接龙
  • WDS 无线桥接
  • 交安安全员:交通工程安全领域的关键角色
  • 无人机桥梁检测如何通过数据存储、边缘AI、无线通讯等技术路线,提升检测效率
  • Seata分布式事物案例及详解
  • R语言开始绘图--柱状图
  • 业务场景中使用 SQL 实现快速数据更新与插入
  • MyBatis-Plus 中 QueryWrapper 的 Limit 实现
  • ceph osd 磁盘分区对齐
  • TCP与UDP区别及应用场景详解
  • 力扣HOT100之图论:200. 岛屿数量
  • 【LangChain大模型应用与多智能体开发 ① 初识LangChain 】
  • 用户意图识别模块
  • 跟Gemini学做PPT:字号选择
  • MyBatisPlus使用教程