Solved

Calling Google Earth to display a UK Post Code

Posted on 2006-10-23
3
484 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month6 days, left to enroll

627 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