Southside
V2EX  ›  问与答

求助! openlayers 和 leaflet 代码转换

  •  
  •   Southside · Oct 9, 2023 · 1244 views
  •   You need to sign in to view this topic
    This topic created in 1028 days ago, the information mentioned may be changed or developed.

    因为项目要在内网部署,现在用 leaflet 根据部署环境同时加载天地图(互联网)和内网的瓦片图。但是甲方的 demo 是用 openlayers 的,里面有代码

    new ol.tilegrid.TileGrid({
    	tileSize: 256,
    	origin: [-180, 90],
    	resolutions: [1.4078260157100582, 0.70312500000000022, 0.35156250000000011]
    });
    

    这些代码不知道怎么配置到 leaflet 里面。现在 leaflet 可以正常加载天地图,但是加载内网的瓦片图好像是定位错误了。求助一下大佬们。

    Supplement 1  ·  Oct 10, 2023
    现在排查出 y 轴坐标有偏移
    内网正确的地址:/MapServer/tile/12/577/3387
    leaflet 现在的地址:TILECOL=3387&TILEROW=1500&TILEMATRIX=12
    1 replies    2023-10-10 09:17:30 +08:00
    Southside
        1
    Southside  
    OP
       Oct 10, 2023
    y 轴坐标在 12 级缩放下大概差了 1000 左右
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2846 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:02 · PVG 17:02 · LAX 02:02 · JFK 05:02
    ♥ Do have faith in what you're doing.