常见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)"
相关推荐
中科GIS地理信息培训1 天前
【实操】在 ArcGIS Pro 中,计算多边形的面积时,需排除缓冲区要素中与多边形重叠的部分
arcgis·arcgis pro
中科GIS地理信息培训1 天前
ArcGIS Pro镶嵌数据集:绝不仅是数据之和
arcgis·arcgis pro
开心些3 天前
ArcGIS批量出图
arcgis
非科班Java出身GISer6 天前
ArcGIS JS API 5.0 ESM 双模块系统冲突解决方案
arcgis·arcgis js 引入问题·arcgis js amd·arcgis esm引入问题·arcgis js 资源冲突
中科GIS地理信息培训23 天前
【ArcGIS Pro 3.7新增功能4】增强空间统计中【评估点聚合的图格大小】工具:分析字段和时间间隔
人工智能·算法·arcgis
雪的季节24 天前
GIS 矢量数据格式
arcgis
非科班Java出身GISer24 天前
ArcGIS JS 基础教程(11):飞行定位 goTo
arcgis·arcgis js 飞行定位·arcgis js 定位·arcgis js 各种定位·arcgis js 飞行·arcgis js 定位到对象
我是Superman丶24 天前
前端技术手势识别
arcgis
da-peng-song1 个月前
ArcGIS Desktop使用入门(四)——生成经纬度坐标
arcgis·经纬度坐标
da-peng-song1 个月前
ArcGIS Desktop使用入门(三)图层右键工具——定义查询
数据库·arcgis·拆分数据·定义查询