SuperAPI AI 工具集

geometry-api-net

数据与分析

查看项目

更新于 10-16 09:45

技能介绍

用途:面向 .NET 开发者的空间几何计算库,基于 .NET Standard 2.0,核心包为 Esri.Geometry.Core,JSON 扩展包为 Esri.Geometry.Json,许可证 LGPL-2.1-only。

主要能力:提供 Point、Line、Envelope、MultiPoint、Polyline、Polygon 六种几何类型,以及 25+ 空间运算算子,涵盖空间关系判断(Contains、Intersects、Within、Disjoint、Crosses、Touches、Overlaps、Equals、Distance)、集合运算(Union、Intersection、Difference、SymmetricDifference)、几何运算(Buffer、ConvexHull、Simplify、Generalize、Densify、Clip、Offset、Centroid、Boundary、Area、Length)、大地测量(GeodesicDistance、GeodesicArea)与邻近搜索(GetNearestCoordinate、GetNearestVertex、GetNearestVertices)。

使用方式:通过 dotnet add package Esri.Geometry.Core 安装,可选安装 Esri.Geometry.Json 获得 System.Text.Json 支持。两种 API 风格:GeometryEngine 静态方法(推荐)与各 Operator 的 Instance 单例模式。命名空间包括 Core、Geometries、Operators、SpatialReference、IO 与 Json.Converters。支持 WKT、WKB、GeoJSON、Esri JSON 的导入导出,并提供空间参考(如 Wgs84、WebMercator、自定义 WKID)。

适用场景:点面包含判断、经纬度大地距离计算、缓冲区生成、区域交集、几何合并、凸包与质心计算、线简化与加密、序列化往返等。

限制:Polygon 环必须首尾闭合;内部使用几何常量默认容差 1e-10,不可外部配置;集合运算返回 Geometry 基类需类型转换;集合 getter 返回 IReadOnlyList 只读视图;大地测量基于 WGS84,分别使用 Vincenty 公式与球面超量公式;GeoJSON 导出时单路径 Polyline 为 LineString、多路径为 MultiLineString、Envelope 为 Polygon。构建与测试使用 dotnet build、dotnet test 等命令。