使用proj4JS进行坐标转换

proj4JS地址icon-default.png?t=N7T8https://github.com/proj4js/proj4js

  • 安装

npm install proj4 --save
  •  引入
import proj4 from "proj4"
  • 定义需要转换的坐标使用的坐标系,参数可以在qgis中查询proj4的值
proj4.defs('EPSG:4548', "+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs")
// 也可以传递数组
proj4.defs([
  [
    'EPSG:4326',
    '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees'],
  [
    'EPSG:4269',
    '+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees'
  ]
]);
  • 将4548坐标转成4326坐标
const a = proj4('EPSG:4548', 'EPSG:4326',  [pointer.x, pointer.y])

你可能感兴趣的:(ArcGIS,API,JS,arcgis,javascript)