如何识别图像上特定 GPS 坐标对应的像素?

How to identify pixels corresponding to a particular GPS coordinates on an image?

我有一个google地图图像,其中图像中两个位置的GPS坐标(Lat1,Long1)和(Lat2,Long2)是已知的,它们对应的像素也称为(x1, y1) 和 (x2,y2).

现在我有了一个新的 GPS 位置坐标 (lat3, long3),它落在图像中。我需要找到图像上与此位置对应的像素 (x3,y3) ?

请帮我做数学题,怎么做?,

假设坐标网是线性的,

  x1 - x3       x1 - x2
----------- = -----------
Long1-Long3   Long1-Long2

  y1 - y3       y1 - y2
----------- = -----------
Lat1 - Lat3   Lat1 - Lat2

所以,

x3 = x1 - (Long1 - Long3)*(x1 - x2) / (Long1 - Long2)
y3 = y1 - (Lat1 - Lat3)*(y1 - y2) / (Lat1 - Lat2)

只有在比例相当低(例如城市地图,而不是大陆地图)并且离极地足够远的情况下,该假设才是合理的。

这里有一个 repository 可以简化大量绘制地图图像的过程。希望这有帮助。