常见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)"
相关推荐
白白李媛媛3 小时前
上传Vue3+vite+Ts组件到npm官方库保姆级教程
前端·arcgis·npm
zm-v-159304339866 小时前
ArcGIS 水文分析升级:基于深度学习的流域洪水演进过程模拟
人工智能·深度学习·arcgis
新中地GIS开发老师15 小时前
新发布:26考研院校和专业大纲
学习·考研·arcgis·大学生·遥感·gis开发·地理信息科学
Cacciatore->20 小时前
React 基本介绍与项目创建
前端·react.js·arcgis
杨超越luckly3 天前
ArcGISPro应用指南:ArcGISPro制图全流程详解
arcgis·信息可视化·gis·制图·arcgispro
~央千澈~4 天前
UniApp完全支持快应用QUICKAPP-以及如何采用 Uni 模式开发发行快应用优雅草卓伊凡
arcgis
敲敲敲-敲代码4 天前
【ArcGIS10.2】网络数据集构建---最短路径分析
网络·arcgis
人工智能教学实践4 天前
【基于Echarts的地图可视化】
arcgis
Cacciatore->4 天前
Electron 快速上手
javascript·arcgis·electron
南草徽14 天前
arcgis分割 (Split)
arcgis