gpt4 book ai didi

java - 在谷歌地图中给定缩放级别计算 map 上方的高度

转载 作者:行者123 更新时间:2023-11-29 03:22:37 26 4
gpt4 key购买 nike

我正在尝试计算给定缩放级别的 map 上方的高度(忽略地形)。我知道特定缩放级别的比例方程是 591657550.5/2^(level-1) ( https://gis.stackexchange.com/questions/7430/google-maps-zoom-level-ratio ),但我不确定如何使用此信息(或这是否是正确的信息)来解决 map 上方的高度。感谢您的帮助。

最佳答案

我将我的谷歌地图大小设置为 5 厘米,选择了一个缩放级别,然后使用该缩放级别在谷歌地球中重新找到该位置以获得眼睛高度级别(角度大小方程中的 D 值 http://en.wikipedia.org/wiki/Forced_perspective )。通过首先将我在屏幕上的 map 长度设置为 5cm,然后使用 591657550.5/2^(level-1) *5cm 的比例方程来计算角度中的 h 值,我能够在角度大小方程中找到 h 值尺寸方程。知道这两个变量后,我就能够计算出本地图宽度为 5 厘米 (85.36222058) 时,谷歌地图显示图像的恒定角度。根据这些信息,我能够构建这种方法,该方法可以相对准确地根据缩放级别计算 map 上方的眼睛高度

public float getAltitude(float mapzoom){
//this equation is a transformation of the angular size equation solving for D. See: http://en.wikipedia.org/wiki/Forced_perspective
float googleearthaltitude;
float firstPartOfEq= (float)(.05 * ((591657550.5/(Math.pow(2,(mapzoom-1))))/2));//amount displayed is .05 meters and map scale =591657550.5/(Math.pow(2,(mapzoom-1))))
//this bit ^ essentially gets the h value in the angular size eq then divides it by 2
googleearthaltitude =(firstPartOfEq) * ((float) (Math.cos(Math.toRadians(85.362/2)))/(float) (Math.sin(Math.toRadians(85.362/2))));//85.362 is angle which google maps displays on a 5cm wide screen
return googleearthaltitude;
}

对不起,如果我的解释解释得不好。如果你们想使用这种方法,请随意。对不起,任何措辞不当的句子。

关于java - 在谷歌地图中给定缩放级别计算 map 上方的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22750373/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com