The idea is to get the coordinates of an address and be able to use these coordinates in the code that follows. This should all happen in one function. Now, converting the address to coordinates is not the problem. this just works. Only when I assign the longitude and latitude to a variable it does not give any values when I call the variables later in the function. TTMSFNCGeoCoding
is used for this.
Function TestFunction:Boolean;
var
ALongitude,ALatitude : string;
FstartAdres : TTMSFNCMapsCoordinateRec;
begin
TMSFNCGeocoding1.GetGeocoding('New York',
procedure(const ARequest : TTMSFNCGeocodingRequest;
const ARequestResult : TTMSFNCCloudBaseRequestResult)
begin
FStartAdres := ARequest.Items[0].Coordinate.ToRec;
ALongitude := FloatToStr(FstartAdres.Longitude);
ALatitude := FloatToStr(FStartAdres.Latitude);
end);
//for example i want to show the data
showmessage(ALongitude); //message is empty
showmessage(ALatitude);//message is empty
end;
if I have forgotten important information let me know