zoukankan      html  css  js  c++  java
  • ol.proj.transform 坐标系转换

    code

    var s = [[547225.076059,3375153.970705],[547268.959189,3374903.376212],[547381.875693,3374854.140213],[547555.065457,3375144.238708],[547225.076059,3375153.970705]];
    var ss = s.map((it, index) => {
      // mark(it[0], it[1], 80, `${index+1}`);
      return ol.proj.transform(it, SRS, 'EPSG:4326')
    });
    
    new Polygon([ss]);
    

    Polygon#transform

    https://openlayers.org/en/latest/apidoc/module-ol_geom_Polygon-Polygon.html#transform

    see

    坐标系
    // 3857 google
    // 4326 WGS-84:是国际标准,GPS坐标(Google Earth使用、或者GPS模块)
    // 2437 GCJ-02:中国坐标偏移标准,Google Map、高德、腾讯使用
    // BD-09:百度坐标偏移标准,Baidu Map使用
    
    坐标系转换
    ‘EPSG:4326’-经纬度坐标-WGS84
    ‘EPSG:3857’- xy坐标-web墨卡托
    
    》》》:
    1.var m_center=[116.35,39.9];//地图中心点-经纬度坐标
    //经纬度转至xy
    m_center = ol.proj.transform(m_center,‘EPSG:4326’, ‘EPSG:3857’ );
    
    //反过来
    2. var m_center=[12914838.35,4814529.9];//地图中心点-xy坐标
    //经纬度转至经纬度
    m_center = ol.proj.transform(m_center, ‘EPSG:3857’ ,‘EPSG:4326’);
    
    ol3默认的坐标系为3857,即在创建ol.map的时候,若不指定projection,则默认为EPSG:3857
    ————————————————
    版权声明:本文为CSDN博主「听风许诺」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/weixin_41591572/article/details/85263826
    
  • 相关阅读:
    mysql索引
    mysql锁机制
    mysql授权
    mysql执行计划
    mysql知识补遗
    求助:springboot调用存储过程并使用了pagehelper分页时报错com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
    java面试题1
    Yarn
    MapRudecer
    Hive数据倾斜和解决办法
  • 原文地址:https://www.cnblogs.com/develon/p/15236807.html
Copyright © 2011-2022 走看看