我有拉脱维亚三个城市的坐标
57.4093885、21.5246563
56.9713962、23.9890814
55.8958226、26.4671762
我需要把它们放在我的拉脱维亚地图上我无法理解算法,因为它被放在我的地图上我可以用什么算法把经纬度转换成地图上的点。
my map

最佳答案

对于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))

为latmin、latmax、city latitude lat查找yy,并应用类似的线性插值
 Y = Height * (YY_Lat - YY_LonMin) / (YY_LonMax- YY_LonMin)

09-29 20:10