How to get the HTML of a TWebGmaps?

How can I get the HTML which is used to display a TWebGMaps?

I tried CompleteHtmlFile, but that was an empty string.

----------------------------------
Reason, I cam coding a server.  A user enters a URL in their browser, my program, running on the server, hanldes the request and returns an HTML page for the browser to disply.

I want that page to contain a lot of things for the uer's browser and I want to embded a google map in it.

I could build a Gogole map request myself, from my database, but if I can use TWebGamps it is less for me to code.

So, is there an easy way to get the HTML which would represent the TWebGmap? I don't mind if I have to sub-class to get at private members.


Hi,


You can get the html from WebGMaps.WebBrowser.document as you would from a regular TWebBrowser control.
However, you probably won't be able to use the html directly as it contains specific code to interact with the WebGMaps control.

Example:
var
  iall : IHTMLElement;
  html : string;
begin
   if Assigned(WebGMaps1.WebBrowser.Document) then
   begin
     iall := (WebGMaps1.WebBrowser.Document AS IHTMLDocument2).body;

     while iall.parentElement <> nil do
     begin
       iall := iall.parentElement;
     end;
     html := iall.outerHTML;
   end;

Have you thought about using the IntraWeb version of WebGMaps: TMS IntraWeb WebGMaps?




Thanks for the help, Bart.

I am curious - doesn't Google return HTML to the component? If so, how can I get that?

The Google map is dynamically generated using JavaScript.
I'm not sure if there is a straightforward way to retrieve the resulting HTML.
Unfortunately this functionality is beyond the scope of the WebGMaps control.

I am confused (it happens often). Surely a browser sends an HTTP request to the Google maps API and revives, in return, some HTML?  Yes, that HTML might be mixed with JS, but it contains what the client browser needs to display the Google map.  Or did I miss something?


In my case, I am coding a server which sits between the client browser & the Google maps server and want to request a Google map, based on information available in a database at my intermediate server, and return that, as part of a complete web page, to the client browser.

I suppose that I could  build the Gogole maps request myself & get the response, but as I already learned the TWebGmaps functionality, I would rather use that. 

Am I wrong about how TWebGmaps works?

I think that is out of the scope of the purpose of TWebGMaps.

The purpose of TWebGMaps is to offer a component that shows the map, allows to interect with the map both via user interface and programmatically, but the main goal remains the visual presentation of the map.

Thanks for the reply. I will look into the code & see whether it is easier to subclass TWebGMaps or just to implement my own interface with Google Maps.


A slightly different question. The database is on my server, so any
client browser needs to go there so that the server can build a request
to Goggle Maps.



My original question question was if I could capture the return from Google Maps.



Now I want to ask it I can easily get at the request which you send to goggle?



If I have that, I can send it to the client and the client can ask for
the Google Map (it sounds awkward, but I want to use data from the
server's database to add markers & polylines to the map).

hi, it doesn't matter now. I quickly wrote my own code to build the JS required. So, my server looks at its database, builds an HTML page with the relevant JS and returns that to the browser.


Thanks for your help. End of thread.