常见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)"
相关推荐
yngsqq2 天前
关于arcgis中坐标系、投影的一些知识
arcgis
李建军2 天前
ArcGISPro 新建shp+数据结构
arcgis
瑞瑞大大3 天前
环境影响评价(EIA)中,土地利用、植被类型及生态系统图件的制作
arcgis·shp
xa138508693 天前
ArcGIS Pro显示缓存空间不足导致编辑或加载数据显示不完全
arcgis
新中地GIS开发老师3 天前
vue中使用高德地图自定义掩膜背景结合threejs
前端·vue.js·arcgis·gis开发·地理信息科学·地信
卢可以3 天前
$ npx electron-forge import 一直报权限问题 resource busy or locked,
javascript·arcgis·electron
柳鲲鹏4 天前
ArcGIS注册开发账号及API KEY
arcgis
吉水于人5 天前
Arcgis/GeoScene API for JavaScript 三维场景底图网格设为透明
前端·javascript·arcgis
xa138508695 天前
为什么 ARCGIS PRO ArcGISIndexingServer.exe 使用大量计算机内存?
arcgis
我不当帕鲁谁当帕鲁6 天前
arcgis for js实现层叠立体效果
前端·javascript·arcgis