GetElevation don't work?

Hello.



ver: 2.9.6.0
API key is present


Why GetElevation return True but there is no result in Elevations?
Elevations.Count returns 0


example:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if WebGMaps1.GetElevation(5, 5) then ShowMessage('ok');
  ShowMessage(FloatToStr(WebGMaps1.Elevations.Count));
end;
Because 5?N and 5?E is on the ocean left of Port Harcout, Nigeria.

https://www.google.com/maps/place/5%C2%B000'00.0%22N+5%C2%B000'00.0%22E/@4.9130901,4.6203923,8z

I tried another coordinates.

Can you check it?

Hi,


We are not aware of any issues with GetElevation.
Please note that this functionality is only available from Delphi XE. This is not supported in earlier Delphi versions due to framework limitations.



I use Delphi XE3.


I  made test project for you, can you check it?

https://www.dropbox.com/s/ebctyxbvo58f0wy/Test%20Elevation%20Delphi%20XE3.zip?dl=0
Works here without a problem.

Damn forum software deletes pasted image. :-(
Elevation.Count is 1, Elevation is 193m.

In the test project there is compiled file, can you run it for test?

(Test Elevation Delphi XE3\Win32\Release\Project1.exe)


The test project you provided is working as expected when tested here.
Unfortunately we are unable to test the compiled executable for security reasons.


Can you try using a tool like Fiddler (free download) to view the details of the HTTP request that is used to retrieve the elevation?
If we can see the exact request and response request that should help to find out what is going wrong.



That's the outcome of your executable! You certainly have a problem with your google api key.
As shown above, when I recompile your app with my key, it works.

I wrote in the first message, that API key is present, I just wan't to share my API key.

I used your executable for the last test.
Has that executable your API key compiled in or not?
If not, what is the purpose to provide an executable then?

As said above, in the first test I recompiled your executable with my own API key and it works!
Is that so difficult to understand?

I'm out, don't like to be trolled.

Do you have a Google billing account assigned to your Google developer account? 
This is a new requirement from Google since August 2018.


No, compiled project in the first message without API key. 

This is compiled file with API key
https://www.dropbox.com/s/11lc4bhtkq8er2f/Project1.exe?dl=0


Code of the example:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if WebGMaps1.GetElevation(49, 2) then ShowMessage('GetElevation return True');
  ShowMessage(IntToStr(WebGMaps1.Elevations.Count));
end;


Which version of Delphi you use?

Yes, I have, I know about that.
Now I see where the problem.
method
function TWebGMaps.GetElevationInt(Locations: TStringList; ResultCount: integer): boolean;

  resdat := HttpsGet(url);
  ShowMessage(resdat);


{
   "error_message" : "This API project is not authorized to use this API.",
   "results" : [],
   "status" : "REQUEST_DENIED"
}


For my API key I have enabled services:
Maps JavaScript API
Geocoding API

I tried to enable all available services, but result the same.

I found and enable Maps Elevation API, but now result is:


{
   "error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 95.42.., with empty referer",
   "results" : [],
   "status" : "REQUEST_DENIED"
}

I don't have any limits for this API key, it's strange.

I'd suggest to look at your Google developer console or check with Google.