【问题标题】:calculate google maps tile boundary coordinates计算谷歌地图瓷砖边界坐标
【发布时间】:2014-09-02 13:34:52
【问题描述】:

我做了很多搜索,找到了一些有用的资源,但仍然存在计算问题。

我想计算特定图块的 NE 和 SW 坐标。

这是我的方式:

Zoom = 11
x = 1188 
y = 767

number of tile = 2 ^ 11 (equals 2048)
angle1 = 360 / 2048
longitude = (1188 * angle1) - 180

它工作正常。

但纬度部分不是:

angle2 = 170.1022575596 / (2048/2)
latitude = ((2048 / 2) - 767) * angle2

提前致谢

【问题讨论】:

    标签: google-maps mercator


    【解决方案1】:

    您正在寻找的解决方案是这样的:

    z = 11
    x = 1188 
    y = 767
    
    pi = 3.14159
    
    alon1 = (x /2^z)*360.0 - 180.0
    alon2 = ((x+1) /2^z)*360.0 - 180.0
    
    an   = pi-2*pi*y/2^z
    alat1 = 180.0/pi*atan(0.5*(exp(an)-exp(-an)))
    an   = pi-2*pi*(y+1)/2^z
    alat2 = 180.0/pi*atan(0.5*(exp(an)-exp(-an)))
    

    你会得到这个特定图块的 NW (alon1,alat1) 和 SE (alon2,alat2) 坐标。

    【讨论】:

    • 非常感谢,这正是我想要的!在 java 中,如果有人想复制/粘贴: int tilesAtZoomLevel = 1 y/tilesAtZoomLevel;双 alat1 = 180.0/Math.PIMath.atan(0.5*(Math.exp(an1)-Math.exp(-an1))); double an2 = Math.PI-2*Math.PI*(y+1)/tilesAtZoomLevel; double alat2 = 180.0/Math.PI*Math.atan(0.5*(Math.exp(an2)-Math.exp(-an2)));
    猜你喜欢
    • 2012-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多