1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Procedure TForm3.Convert;
var SDirLat, sLatitude, sDirLon, sLonDeg, sLongitude, sCaption :String;
dLatDeg, dLatMin, dLatSec, dLonDeg, dLonMin, dLonSec, dLatitude,
dLongitude :Extended;
PosError, ind :Integer;
begin
For ind := 0 to lPoints.Count-1 do
Begin
LSt.StrictDelimiter := True;
LSt.Delimiter := ';';
LSt.DelimitedText := Lpoints.Strings[ind];
sCaption := Lst[0];
sLatitude := Lst[1];
sLongitude := Lst[2];
//Convert String in DMS
//Latitude
sDirLat := Copy(sLatitude,1,1);
Val(Copy(sLatitude,2,2),dLatDeg,PosError);
if sDirLat = 'S' then
dLatDeg := - dLatDeg;
Val(Copy(sLatitude,6,2),dLatMin,PosError);
Val(Copy(sLatitude,10,5),dLatSec,PosError);
//Longitude
sDirLon := Copy(sLongitude,1,1);
sLonDeg := Copy(sLongitude,2,3);
sLonDeg := ReplaceText(sLonDeg,'°','');
dLonDeg := StrToFloat(sLonDeg);
if sDirLon = 'W' then
dLonDeg := - dLonDeg;
Val(Copy(sLongitude,6,2),dLonMin,PosError);
Val(Copy(sLongitude,10,5),dLonSec,PosError);
//Convert Coordinates in decimal coordinates
dLatitude := DMS2Extended(dLatDeg,dLatMin,dLatSec);
dLongitude := DMS2Extended(dLonDeg,dLonMin,dLonSec);
//Draw Waypoint on Map
//******** Appel de la fonction de tracé sur Google Map **********************
End;
end; |
Partager