我已经建立了一个活动,该活动采用用于地图的自定义图像,然后知道左上角和右下角的 gps,我在地图顶部绘制了 gps。它工作得很好,但我想提高准确性。我知道它关闭了,因为当我记录设备位置并将其插入谷歌地图时,它实际上比我在自定义地图上表示的更准确。
所以....既然我有地图的左上角和右下角 gps 并将它们映射到相应的像素坐标,我如何才能使用 Helmert 变换准确地将设备 gps 绘制成像素。
编辑:
我目前正在使用它来将设备的 gps 绘制到屏幕上。
public double getCurrentPixelY(Location upperLeft, Location lowerRight, Location current) {
double hypotenuse = upperLeft.distanceTo(current);
double bearing = upperLeft.bearingTo(current);
double currentDistanceY = Math.cos(bearing * Math.PI / OneEightyDeg) * hypotenuse;
// "percentage to mark the position"
double totalHypotenuse = upperLeft.distanceTo(lowerRight);
double totalDistanceY = totalHypotenuse * Math.cos(upperLeft.bearingTo(lowerRight) * Math.PI / OneEightyDeg);
double currentPixelY = currentDistanceY / totalDistanceY * ImageSizeH;
return currentPixelY;
}
public double getCurrentPixelX(Location upperLeft, Location lowerRight, Location current) {
double hypotenuse = upperLeft.distanceTo(current);
double bearing = upperLeft.bearingTo(current);
double currentDistanceX = Math.sin(bearing * Math.PI / OneEightyDeg) * hypotenuse;
// "percentage to mark the position"
double totalHypotenuse = upperLeft.distanceTo(lowerRight);
double totalDistanceX = totalHypotenuse * Math.sin(upperLeft.bearingTo(lowerRight) * Math.PI / OneEightyDeg);
double currentPixelX = currentDistanceX / totalDistanceX * ImageSizeW;
return currentPixelX;
}
我知道我需要在某个地方进行调整,但是看着 helmert 转换,我不知道从哪里开始使用我现有的代码来实现它。
编辑:
在网上查看了更多内容后,我发现使用大圆公式可能会有所帮助。这是我正在实施的链接
http://introcs.cs.princeton.edu/java/12types/GreatCircle.java.html