The kneeboard or the file gives back, per emitter, the top left and the bottom right point coordinates of a rectangle that the emitter could be in (based on the signals it received). It does this with a pair of coordinates. āNW 43,32,10 040,07,39ā is one pair, 43 degrees, 32 minutes and 10 seconds by 40 degrees, 7 minutes and 39 seconds (the North West meaning the top left of a box) with āSE 43,12,12 040,24,40ā being the second pair (the SE meaning the bottom right of a box).
So the output from the Viggen is in the traditional ādegreesā āminutesā secondsā format (plus a hemisphere qualifier, i.e. North or South, East or West, which makes the number positive or negative.
The Google maps API (like most APIs) takes a floating point number rather than human friendly degrees/minutes/seconds as its coordinate system (easier for the math) so we need to convert it. Itās essentially just taking the base (60) and dividing up:
= floating_point_coord = degrees + minutes/60 + seconds/(60*60);
= 43.53611111 = 43 + 32/60 + 10/(60*60);
So with the two sets of coordinates converted to decimal (our box corners we got given) we can give Google maps a box extent to draw like this:
var boxCoords = [
{lat: 43.53611111, lng: 40.1275},
{lat: 43.53611111, lng: 40.41111111},
{lat: 43.20333333, lng: 40.41111111},
{lat: 43.20333333, lng: 40.1275},
];
ā¦which as you can see below, has taken what we know (the top left (TL) and bottom right (BR)) and then substituted in the top right and bottom left points to make four points of a polygon.
var boxCoords = [
{lat: TL_Y, lng: TL_X},
{lat: TL_Y, lng: BR_X},
{lat: BR_Y, lng: BR_X},
{lat: BR_Y, lng: TL_X},
];
I might have typed too much, but thatās the basic idea.