我有拉脱维亚三个城市的坐标
57.4093885,21.5246563
56.9713962,23.9890814
55.8958226,26.4671762
我需要将它们放在我的拉脱维亚地图上。我无法理解算法,因为它放在我的地图上。我可以使用什么算法将我的纬度和经度转换为地图上的点。
答案 0 :(得分:0)
对于Merkator投影映射相当简单。
地图有边界坐标 - LatMin, LonMin, Lattin, LonMax
。它对应于坐标为0,0,宽度,高度的屏幕矩形。
经度有线性映射
X = Width * (Lon - LonMin) / (LonMax- LonMin)
应该计算纬度with some math:
a = 6378137 //geo-ellipsoid parameters
b = 6356752.31
f=(a-b)/a
e=sqrt(2*f-f^2) //excentricitet
YY = a * ln(Tan(pi / 4 + Lat / 2) *
((1 - e * sin(Lat)) / (1 + e * sin(Lat)))**(e/2));
更简单,更不精确的版本:
YY = a * ln(Tan(pi / 4 + Lat / 2))
为LatMax找到YY,用于LatMax,用于城市纬度Lat并应用类似的线性插值
Y = Height * (YY_Lat - YY_LonMin) / (YY_LonMax- YY_LonMin)