";
$data = explode('_',$_POST[image]);
//Variables from filename
$orbit = $data[1]*1; //orbit number
$degree = substr($data[2],0,4)/10; //degree from equator on "night side"
//Constants that must be precise
$mro_orbital_period = 6814-90;
$mars_rotational_period = 88642.6632;
//Initial value
$i_orbit = 823;
$i_degree = 172.0;
$it_latitude = -7.8;
$it_longitude = 279.5;
//Calculate the longitude at "degree" 0 on the initial orbit (823)
$i_longitude = $it_longitude - (180-(($i_degree/360*$mro_orbital_period)/$mars_rotational_period)*360);
//Calculate the time passed since this first orbit
$time_since_initial_value = ($orbit-$i_orbit)*$mro_orbital_period + $degree/360*$mro_orbital_period;
//Calculate an orbit offset, due to the rotation of mars
$longitude_offset = ($time_since_initial_value/$mars_rotational_period*360)%360;
//Treat the different cases of degree
if($degree > 90 && $degree < 270)
{
$longitude_offset += 180;
$latitude = $degree - 180;
}
else if($degree < 90)
$latitude = -$degree;
else if($degree >= 270)
$latitude = 360-$degree;
//Do the final longitude calculation
$longitude = (($i_longitude-$longitude_offset)%360+360)%360;
echo '
This positioning is not scientific, its more of an "educated guess". :) It seems to work reasonably well for some 3 images I tested it with atleast.';
?>
A big thanks to NASA that has made these images possible and avaliable online! They are really awesome. :) Here is the official zoomify-page.
The positioning plot is unaccurate and unscientific, its there just to get a rough estimate on where on mars
the image was taken, based on the information avaliable in the filename (orbitnumber + degrees from equator). Click here to see the code for the above positioning. (badly commented).
If anyone has any comments or ideas in general. Please send me an e-mail
(note to NASA technichans, if one would visit: I am caching the images on my server upon first download, to lessen the load on your servers. Not many visitors here, but every bit counts ;)