如何通过 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 (将#修改为@)