Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Calling Google Earth to display a UK Post Code

Posted on 2006-10-23
3
Medium Priority
?
489 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 28

Accepted Solution

by:
TName earned 2000 total points
ID: 17796765
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
ID: 17797115
>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
ID: 17797459
>>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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

719 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