常见gis几何格式(wkt、geojson、arcgis json)的转换方法

1.相关链接

https://github.com/terraformer-js/terraformer

2.arcgis geometry json与geojson互转

Convert ArcGIS JSON geometries to GeoJSON geometries and vice versa.

复制代码
npm install @terraformer/arcgis

(1)arcgis geometry json转换成geojson格式

复制代码
import { arcgisToGeoJSON } from "@terraformer/arcgis"

arcgisToGeoJSON({
  "x":-122.6764,
  "y":45.5165,
  "spatialReference": {
    "wkid": 4326
  }
});

>> { "type": "Point", "coordinates": [ -122.6764, 45.5165 ] }

(2)geojson转换成arcgis geometry json

复制代码
import { geojsonToArcGIS } from "@terraformer/arcgis"

geojsonToArcGIS({
  "type": "Point",
  "coordinates": [45.5165, -122.6764]
})

>> { "x":-122.6764, "y":45.5165, "spatialReference": { "wkid": 4326 } }

3.wkt与geojson格式互转

Tools to convert WKT geometries to GeoJSON geometries and vice versa.

(1)wkt转成geojson

复制代码
import { wktToGeoJSON } from "@terraformer/wkt"

wktToGeoJSON("POINT (-122.6764 45.5165)");

>> { "type": "Point", "coordinates": [ -122.6764, 45.5165 ] }

(2)geojson转成wkt

复制代码
import { geojsonToWKT } from "@terraformer/wkt"

const geojsonPoint = {
  "type": "Point",
  "coordinates": [-122.6764, 45.5165]
}

geojsonToWKT(geojsonPoint)

>> "POINT (-122.6764 45.5165)"
相关推荐
阿智@112 天前
推荐使用 pnpm 而不是 npm
前端·arcgis·npm
GIS思维2 天前
ArcGIS(Pro)在线地图服务被禁?提示感叹号?应急方案来了——重新正常显示
arcgis·arcgispro
bug总结2 天前
多楼层室内定位可视化 Demo(A*路径避障)
arcgis
草木红3 天前
express 框架基础和 EJS 模板
arcgis·node.js·express
wanzhong23333 天前
ArcGIS学习-17 实战-密度分析
学习·arcgis
树谷-胡老师4 天前
公元前3400年至公元2024年全球国家地理边界演变数据集
数据库·arcgis·信息可视化
wanzhong23335 天前
ArcGIS学习-20 实战-县域水文分析
学习·arcgis
树谷-胡老师6 天前
2005–2021年中国城市级终端能源消费(含可再生能源)综合数据集
arcgis·能源
坫鹏加油站6 天前
【ArcGIS】如何编辑图层的属性表
arcgis
wanzhong23337 天前
ArcGIS学习-18 实战-降雨量空间分布插值分析
学习·arcgis