Andróide: Como: plotar as coordenadas de latitude e longitude do mundo real para obter imagens estáticas com ângulos diferentes?
Já tenho a conversão de coordenadas de latitude e longitude (atual) em coordenadas de pixel. Então, eu também plotei com sucesso a corrente na imagem estática. Mas o problema é que o ângulo da imagem estática não é proporcional ao mapa do mundo rea
Aqui está a conversão de latência e longitude em pixels (obrigado a @Dan S, respondeu aquimarque um determinado lat em imagem fixa):
public final static BigDecimal PI = BigDecimal.valueOf(Math.PI);
public final static double OneEightyDeg = 180.0d;
public final static double ImageSize = 512d;
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 * ImageSize;
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 * ImageSize;
return currentPixelX;
}
Aqui está a saída de um determinado lat long contra meuimagem parad ( saída real da marca verde):
Aqui está o mapa do mundo real de um determinado período de tempo aída esperada da marca verde):