Skip to main content
1 of 3

Why is the azimuthal projection not drawn correctly?

I am using Azimuthal equidistant projection, formulas from wiki

double calcDist(double phi0, double lamda0, double lamda, double phi)
{
    double cos=qSin(phi0)*qSin(phi)+qCos(phi0)*qCos(phi)*qCos(lamda-lamda0);
    double roval=qAcos(cos)*R;
    return roval;
}

double calcTeta(double phi0, double lamda0, double lamda, double phi)
{
    double upper= qCos(phi)*qSin(lamda-lamda0);
    double down=qCos(phi0)*qSin(phi)-qSin(phi0)*qCos(phi)*qCos(lamda-lamda0);
    double tetaVal=qAtan2(upper, down);
    return tetaVal;
}

QPointF xyCalc(double dist, double teta)
{
    double x=dist*qSin(teta);
    double y=-dist*qCos(teta);
    double sum=2000.0;
    // return QPointF(10*y+sum, -3*x+sum);
    return QPointF(20*x+sum, 20*y+sum);
}

I want to see a projection around my cent. But it is drawn around the north pole. Why is that?

enter image description here

I'm using layer 10 map. I took the latitude and longitude of one and the tiles and would like to see a circle around it. Wrong formula? Or do I not understand how it works?

centerTileLatLong=TilesMath::GetLatLongFromTilePixel(QPoint(615,327), 10, QPoint(128,128));

for (int tileIndexX=615; tileIndexX< 890; ++tileIndexX)
    for (int tileIndexY=300; tileIndexY<330; ++tileIndexY)
         get lang long of every pixel, translate and draw xy with some scale factor

Heading