Solved

Calling Google Earth to display a UK Post Code

Posted on 2006-10-23
3
477 Views
Last Modified: 2010-04-05
Is there a simple command line option to call Google Earth to display a UK Post Code (assuming that Google Earth is installed). If not, what is the easiest way to do this ?

Is there a way to test to see if Google Earth is installed

Are there any copyright issues or breaches in trying to do this?

Thanks.
0
Comment
Question by:WeeStinker
  • 3
3 Comments
 
LVL 28

Accepted Solution

by:
TName earned 500 total points
Comment Utility
Hi,
I've never done anything with GE, but you made me curious. While I don't know if you can pass a postal code as a parameter to GE, I tried to build a kml file with the post code and pass that as parameter. It works, kind of...
While the method works perfectly when you write coordinates into the kml file (GE opens and really goes to and zooms into the provided location), when only the post code is provided (It's supposed to work for the US, Canada and the UK), GE opens and displays the placemark, but only goes to that place if you double click the place mark. Now if you save the placemark as a kml file again, you will see that GE has added coordinates. If you make your code write those coordinates into the kml file that you pass to GE, everithing works fine.
I'm sure there are no copyright issues if you launch their program and make it go to a specific site :)

procedure TForm1.Button1Click(Sender: TObject);
var
s,FName,Zip:String;

begin
  FName:='C:\Test.kml';
  Zip:='SW1H 0BD';
  OpenGE(FName,Zip);
end;


function TForm1.OpenGE(FName,Zip:String):Boolean;
var
SL:TStringList;
begin
   SL:=TStringList.Create;
   SL.Add('<?xml version="1.0" encoding="UTF-8"?>');
   SL.Add('<kml xmlns="http://earth.google.com/kml/2.1">');
   SL.Add('<Document>');
   SL.Add('<Placemark>');
   SL.Add('<open>1</open>');
   SL.Add('<name>Test</name>');
   SL.Add('<description>A Zip Test</description>');
   SL.Add('<address>'+Zip+'</address>');
   //SL.Add('<Point>');
   //SL.Add('<coordinates>-0.134256,51.499365,0</coordinates>');
   //SL.Add('</Point>');
   SL.Add('</Placemark>');
   SL.Add('</Document>');
   SL.Add('</kml>');
   SL.SaveToFile(FName);
   ShellExecute(Handle,PChar('open'), PChar('C:\Program Files\Google\Google Earth\GoogleEarth.exe'), PChar(FName), nil, SW_SHOW);
end;
0
 
LVL 28

Expert Comment

by:TName
Comment Utility
>Is there a way to test to see if Google Earth is installed

Have a look at ginsonic's post in this thread:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20263911.html
It loads a list of all installed programs in a listbox (could be changed to use a stringlist)
Then you can loop through the listbox and see if GE is installed, e.g:

for i:=0 to ListBox1.Items.Count-1 do begin
     if Trim(ListBox1.Items[i])='Google Earth' then
       ShowMessage('Yes');
0
 
LVL 28

Expert Comment

by:TName
Comment Utility
>>Are there any copyright issues or breaches in trying to do this?
>I'm sure there are no copyright issues if you launch their program and make it go to a specific site :)

It just occured to me that you might mean copyright issues regarding the postal codes. No idea about that, maybe someone from the UK can help.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now