
The distance in pixels is displayed using a simple application of Pythagoras' Theorem to the endpoints of the line segment drawn.
If the line segment is drawn on data that has some georeferencing information, either explicitly or implied, then a distance calculation is carried out. Explicit georeferencing information is supplied in a few ways. HDF-EOS swath, grid, or point data all have georeferencing information, as do other file formats with projection information such as PDS and FITS data. Implied georeferencing information, for example, would be assumed for a regularly gridded, linear scale image where the names of the axes are 'Longitude' and 'Latitude'. In the case of implied georeferencing information, unless the file from which the data is read provides either a scale factor ( e.g. km/pixel ) or a radius ( e.g. radius of Mars ) or both then it is assumed that the data is earth based and the calculation is carried out using the radius of the earth.
If only a scale factor is supplied, the calculation is simply the scale factor multiplied by the distance in pixels calculated for the line segment drawn.
If a radius is supplied, then a great circle distance calculation is carried out using Sinnott's formula. Given two points P1 (lat1, lon1) and P2 (lat2, lon2 ) then:
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin^2(dlat/2) + cos(lat1) cos(lat2) sin^2(dlon/2)
c = 2 arcsin(sqrt(a))
d = R c
The intermediate result c is the great circle distance in radians. R is the radius of the sphere, and d is the distance in units of the radius.
Please note that a more accurate approximation of the shape of Earth and Mars is an oblate spheroid, as opposed to the sphere assumed. For small distances, the error is neglible.
The menu also allows the choice of the meaning of the horizontal scale in Profile. The default is 0-1, that is, the first picked end of the profile line is zero, and the last picked end is one. One may choose instead to use the horizontal or vertical scales of the original dataset. Or both.