常见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)"
相关推荐
梅如你12 小时前
中国2026年路网数据
arcgis·gis·遥感
梦想的初衷~19 小时前
GPT × ArcGIS 强强联合:AI助力数据处理、空间分析、可视化及多案例综合应用实战教程
人工智能·gpt·arcgis
时间的情敌2 天前
《WebGIS EPSG:4326 与 EPSG:3857 墨卡托投影转换》
arcgis·mars2d
时间的情敌2 天前
《Mars2D 快速上手,从零搭建三维 GIS 项目》
arcgis·mars2d
那年那棵树3 天前
基于WebGis的人生如旅地图系统
前端·arcgis·vue·课程设计
梅如你4 天前
全国逐年 1KM 分辨率 NDVI 植被指数数据集(2000-2024)
arcgis·gis·遥感
const_qiu6 天前
第二章 2.4:搭建 Monorepo 骨架 + 共享包 @autix/contracts
java·人工智能·arcgis
地图小课堂7 天前
Bigemap Pro 教程|如何打开Arcgis文件格式(shp、gdb、gdbtable、mdb)
arcgis
广州浮点FLOATLIC7 天前
ArcGIS Pro 批处理失败,怎样判断是脚本报错还是许可条件不满足?
arcgis·许可管理·许可证管理·许可监控
hsg778 天前
简述:ArcGIS Pro新建地图底图加载慢,选项设置方法
arcgis·建库