I am working on a project Meteor decoder, where I need to calculate the pixel geolocations of the satellite image to draw map overlays. I have all the angles except the azimuth angle. I tried to calculate it from orbital elements, I took two relatively close coordinates at two different timestamp and calculated the angle between them. But this solution is not perfect.
Sample code for calculating every 10th pixel's geolocation, I hope it is clear:
void PixelGeolocationCalculator::calcPixelCoordinates()
{
double angle;
CoordGeodetic satOnGroundPrev;
CoordGeodetic satOnGround;
std::vector<Eci> passList;
DateTime passEnd = DateTime(mPassStart).Add(mPassLength);
for(DateTime currentTime = mPassStart; currentTime <= passEnd; currentTime = currentTime.AddMicroseconds(PIXELTIME_MS * 10 * 1000))
{
passList.push_back(mSgp4.FindPosition(currentTime));
}
std::vector<Eci>::const_iterator it = passList.begin();
std::vector<Eci>::const_iterator prevIt = passList.begin();
++it;
DateTime currentTime = mPassStart;
for (unsigned int i = 0 ; it != passList.end(); prevIt = it, ++it, i++)
{
satOnGroundPrev = Eci(currentTime, prevIt->Position(), prevIt->Velocity()).ToGeodetic();
satOnGround = Eci(currentTime, it->Position(), it->Velocity()).ToGeodetic();
currentTime = currentTime.AddMicroseconds(PIXELTIME_MS * 10 * 1000);
angle = calculateBearingAngle(satOnGround, satOnGroundPrev);
angle = degreeToRadian(90) - angle;
for (int n = 79; n > -79; n--)
{
CoordGeodetic coordinate (los_to_earth(satOnGround, degreeToRadian((((mAlfa) / 79.0)) * n), 0, angle));
mCoordinates.push_back(coordinate);
}
}
}
Any better way to calculate this?