Delphi XE5/Android
Trying to display a map showing a customer address location but the map always shows a map of the Eiffel Tower in Paris (assume this is the default location set in the component). My code is:
procedure TForm1.Display_SiteLocation;
begin
GeoCoding1.Address := sSiteAddress;
if (Geocoding1.LaunchGeocoding = erOk) then
begin
WebGMaps1.MapOptions.DefaultLatitude := Geocoding1.ResultLatitude;
WebGMaps1.MapOptions.DefaultLongitude := Geocoding1.ResultLongitude;
// Add a marker for the site
WebGmaps1.Markers.Add(Geocoding1.ResultLatitude,
Geocoding1.ResultLongitude,
sSiteName);
// set zoom level
WebGmaps1.MapOptions.ZoomMap := 19;
end;
end;
I have set some labels on the form (not shown in the above code) to let me know if the correct Lat/Long is being passed from the LaunchGeocoding method...and the ResultLatitude and ResultLongitude are getting the correct co-ordinates.
Why does my map keep displaying Paris when the address I am passing is in Australia???
Any help would be appreciated.
regards
Bill
DefaultLatitude / DefaultLongitude are what is used when you call WebGMaps.Launch, so it needs to be set before you perform the launch.
If you wish to change the coordinates after launch, please use:
WebGMaps1.MapPanTo(NewLatitude, NewLongitude);
'Launch' is not an available option under FireMonkey/Android development. The code I used (see original post) is taken from your developers guide example that comes with the component. So I don't understand how you can set the Default Latitude/Longitude before launch. 'MapPanTo(NewLatitude,NewLongitude)' works but still shows the default 'Paris" map first.
Bill
Dear Mr. Zwirs,
Can you call WebGmaps1.Initialize; after setting the zoomfactor ?
// set zoom level
WebGmaps1.MapOptions.ZoomMap := 19;
WebGmaps1.MapOptions.ZoomMap := 19;
WebGmaps1.Initialize;
Kind Regards,
Pieter
Pieter Scheldeman2014-03-18 03:53:28