Is there a way to do this from a 'stand alone' application?
Thanks,
Brian
"Brian" <BrianWr...@yahoo.com> a écrit dans le message de news:
47541b93$1...@newsgroups.borland.com...
Actually I saw this but it is more to do with embedding a map in a web page.
What I hope to be able to do is something much simpler like downloading a
section of a map (centred at a given lat/long) as a bitmap and displaying it
in an image or similar.
Still hoping......
Brian
"rap" <vold...@laposte.net> wrote in message
news:4754746f$1...@newsgroups.borland.com...
procedure TForm1.Button1Click(Sender: TObject);
var _latitude:Real;
_longitude:Real;
const _zoom = 12; // 12 = city, 8 = region
const GoogleAPIKey = 'your Google API key here'
var _html:TStringlist;
_oldsep:char;
_web:TMsWinWeb;
WebBrowser1: TWebBrowser;
begin
_web := TMsWinWeb.Create(nil);
WebBrowser1:= TWebBrowser.Create(Application);
self.InsertControl(webbrowser1);
webbrowser1.Left := 1;
webbrowser1.Left := 1;
webbrowser1.Width := 640;
webbrowser1.Height := 480;
webbrowser1.Show;
_latitude := _web.WebProvider.Latitude.Trigonometric;
_longitude := _web.WebProvider.Longitude.Trigonometric;
_oldsep := DecimalSeparator;
DecimalSeparator := '.';
_html := tstringlist.create;
_html.Add('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"');
_html.Add(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
_html.Add('<html xmlns="http://www.w3.org/1999/xhtml">');
_html.Add(' <head>');
_html.Add(' <meta http-equiv="content-type" content="text/html;
charset=utf-8"/>');
_html.Add(' <title>Google Maps JavaScript API Example</title>');
_html.Add(' <script
src="http://maps.google.com/maps?file=api&v=2&key=' + GoogleAPIKey +
'"');
_html.Add(' type="text/javascript"></script>');
_html.Add(' <script type="text/javascript">');
_html.Add(' //<![CDATA[');
_html.Add(' function load() {');
_html.Add(' if (GBrowserIsCompatible()) {');
_html.Add(' var map = new
GMap2(document.getElementById("map"));');
_html.Add(' map.setCenter(new GLatLng(' + FloatToStr(_latitude)
+ ',' + FloatToStr(_longitude) + '),' + IntToStr(_zoom) + ');');
_html.Add(' }');
_html.Add(' }');
_html.Add(' //]]>');
_html.Add(' </script>');
_html.Add(' </head>');
_html.Add(' <body onload="load()" onunload="GUnload()">');
_html.Add(' <div id="map" style="width: 640px; height:
480px"></div>');
_html.Add(' </body>');
_html.Add('</html>');
_html.SaveToFile('c:\googlemap.html');
WebBrowser1.Navigate('c:\googlemap.html');
while webbrowser1.Busy
do application.processmessages;
WebBrowser1.Free;
_html.Free;
_web.Free;
deletefile('c:\googlemap.html');
DecimalSeparator := _oldsep;
end;
DH
"Brian" <BrianWr...@yahoo.com> a écrit dans le message de news:
47541b93$1...@newsgroups.borland.com...
>