Usage of TWebGMaps.GetElevation

hi,
i want to get the altitude/elevation of a given mappoint and came across the google elevation freature.
is there an example of how to use the GetElevation function with the VCL WebGMaps component?

regards

Hi,


You can find information on the usage of GetElevation in the WebGMaps PDF manual under the topic "Map elevations".
thanx for your reply, but there is no example in the PDF.
i am searching for the error in my code, because GetElevation(Latitude, Longitude: double) ALWAYS returns false!
even a simple call of GetElevation(5,5) returns false!
what am i doing wrong?
regards

The call you mentioned is correct.


Can you please make sure you are using the latest version of TMS VCL WebGMaps and have a valid APIKey assigned?

If the problem persists you can use a tool like Fiddler (free download) to display the HTTP request details and find out if an error has occurred.
We'll consider improving error handling in a future version.
i'm using the latest available version (3.0.0.0) - though after installation TWebGmaps.Version returns 2.9.9.0
when using Fiddler it seems as there is no HTTP request at all!
Other GOOGLE api requests are recorded by Fiddler, but when using GetElevation nothing happens!
Can you please confirm that GetElevation is working as expected?
regards.
We are not aware of any issues with the GetElevation call in TMS VCL WebGMaps v3.0.0.0.
I've retested the sample below and it is working as expected.

Please note that the minimum required Delphi version is Delphi XE. The GetElevation call is not supported in Delphi versions prior to Delphi XE.

Example:
procedure TForm1.FormCreate(Sender: TObject);
begin
  WebGMaps1.APIKey := '<APIKey>';
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 OutputDebugString(pchar(BoolToStr(WebGMaps1.GetElevation(5,5), True)));
 if WebGMaps1.Elevations.Count > 0 then
   OutputDebugString(pchar(FloatToStr(WebGMaps1.Elevations[0].Elevation)));
end;


well, that explains it. i'm using an older Delphi version.
where is it noticed, that this only works above XE? didn't find it in the developers guide PDF...
any chance to make it work with older Delphi versions?
regards
  • The list of features unavailable in Delphi versions prior to Delphi XE can be found on the product page. (https://www.tmssoftware.com/site/webgmaps.asp)
    You are correct that this should also be mentioned in the PDF manual. We'll extend the manual with this info asap.

    - Unfortunately we can't include this feature in older Delphi versions because of a technical limitation in the Delphi framework.
hahaha. very funny. you just added the line to the product page!
https://webcache.googleusercontent.com/search?q=cache:OA7BOh485BMJ:www.tmssoftware.com/site/webgmaps.asp+&cd=1&hl=de&ct=clnk&gl=de
i am 100% sure it wasn't mentioned there an hour ago.

The GetElevation feature was accidentally omitted from the list on the product page.

It was indeed added just now as I noticed it was missing.