OpenLayers坐标转换

HTTP发送请求,获取Polygon坐标点;

将EPSG:4548转换为EPSG:3857

import { register } from "ol/proj/proj4";
import { transform } from "ol/proj";
import proj4 from "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");

register(proj4);

coordinate.map((coord) => transform(coord, "EPSG:4548", "EPSG:3857"));

/**
 * coordinate格式: [[x,y],[x1,y1],[x2,y2],[x3,y3]......]
 */

 

你可能感兴趣的:(WebGIS,webgis,OpenLayers,坐标转换)