Reputation: 51
We have implemented the excellent GMLib library into our Delphi 2007 application, everything works fine. We need to use the Google Maps for Work license (and need the increased quota). We have no idea how this can be implemented into the underlying JavaScript.
Unfortunately there is not much recent activity from the author of GMLib. Does anyone know whether they will be supporting this code in the (near) future?
Upvotes: 0
Views: 304
Reputation: 51
Eventually we found the answer to this ourselves:
The map.html in the Resources folder need changing from API_KEY to client
src="http://maps.google.com/maps/api/js?v=3.17&key=API_KEY&etc.
src="http://maps.google.com/maps/api/js?v=3.17&client=API_KEY&etc.
and the resource file needs rebuilding
The GMMap.APIKey can now be set to the client id (issued by Google, in the form gme-myclientid. Google also require referrer URLs to be registered on the client portal, it is the combination of the client id and referrer URL that gets access
(the important bit) GMMapVCL.pas needs updating
procedure TGMMap.LoadBlankPage;
begin
if not (FWebBrowser is TWebBrowser) then Exit;
FDocLoaded := False;
//TWebBrowser(FWebBrowser).Navigate('about:blank');
TWebBrowser(FWebBrowser).HandleNeeded;
TWebBrowser(FWebBrowser).Navigate('http://myvalidreferrerurl');
end;
It may be possible to register about.blank as a valid referrer URL, but that would effectively open access to anyone who knew the client id. Instead, make sure that there is no document on the TWebBrowser control when loading GMMap, which will cause the above procedure to be run.
Upvotes: 0