微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何通过 Proj4Leaflet 正确更改 Leaflet 中的投影?

如何解决如何通过 Proj4Leaflet 正确更改 Leaflet 中的投影?

我正在尝试更改基本传单项目中的坐标系。我想使用 epsg:2178。只有灰色背景而不是地图。我不知道出了什么问题。下面是我的代码错误

  var crs = new L.Proj.CRS("epsg:2178","+proj=tmerc +lat_0=0 +lng_0=21 +k=0.999923 +x_0=7500000 +y_0=0 +ellps=GRS80 +units=m +no_defs",[7390450.4069,5440301.5811,7609549.5931,6042141.2701],{
    resolutions: [
      8192,4096,2048,1024,512,256,128
    ],origin: [0,0]
  });

  var map = new L.Map('map',{
    crs: crs,center: [7424026.01,5547802.71],zoom: 6,})

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{
  
  continuousWorld: true,attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

Uncaught TypeError: Cannot read property 'x' of undefined
    at o.Point._add (leaflet.js:5)
    at o.Point.add (leaflet.js:5)
    at e.layerPointToLatLng (leaflet.js:5)
    at e._fireDOMEvent (leaflet.js:6)
    at e._handleDOMEvent (leaflet.js:6)
    at HTMLdivelement.h (leaflet.js:6)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。