常用的坐标系定义方法

import proj4 from "proj4";
import {register} from "ol/proj/proj4";
import {Projection} from "ol/proj";


function  definedProjection  (_epsg) {
  let projection;
  switch (_epsg) {
    case 'EPSG:4528':
      proj4.defs("EPSG:4528", "+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=40500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
      register(proj4);
      projection = new Projection({
        code: 'EPSG:4528',
        extent: [37520456.55526686, 1773540.5950746932, 43213597.20383039, 5379752.8534023315],
        units: 'm'
      });
      break;
    case 'EPSG:4490':
      proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs");
      register(proj4);
      projection = new Projection({
        code: 'EPSG:4490',
        extent: [-180, -90, 180, 90],
        units: 'degree'
      });
      break;
    case 'EPSG:4326':
      proj4.defs("EPSG:4326", "+proj=longlat +datum=WGS84 +no_defs");
      register(proj4);
      projection = new Projection({
        code: 'EPSG:4326',
        extent: [-180, -90, 180, 90],
        units: 'degree'
      });
      break;
    case 'EPSG:3857':
      proj4.defs("EPSG:3857", "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs");
      register(proj4);
      projection = new Projection({
        code: 'EPSG:3857',
        extent: [-20026376.39 - 20048966.10, 20026376.39, 20048966.10],
        units: 'm'
      });
      break;
  }
  return projection;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值