We have just added a link to our exact location on Google Earth – have a look at http://www.yandles.co.uk home page to see how it works… (The link is at the bottom of the page)
It works by calling a link that is stored as a ‘*.kml’ file on the server. In our case, the link is www.yandles.co.uk/kml/yandles1.kml
If you are interested in adding a similar feature to your website, the following is a simple tutorial on ‘How To’
The process consists of:
A) Capturing the location as a file;
B) Converting the resulting *.KMZ file into a *.KML file
C) Minor edit of the *.kml file
D) Creating a link on the web page.
E) Uploading the kml file to your server
A) Capturing the KMZ file for your location:
a1) Open Google Earth and find your location. Zoom in, rotate and set the angle of view to your needs.
a2) Click the Mail ICON in the tool bar above the map.
a3) Select ‘Snapshot of 3D View’ (the middle option), then click on the ‘Mail’ button. This will open up your email software. (You don’t need to actually send the email – see next step)
a4) In the email software, locate the ‘attachment’ that will be labelled ‘GoogleEarth_Placemark.kmz’. Right click on it and copy it to memory.
a5) With Windows Explorer, create a directory such as ‘GE KMZ’ and Paste the copied kmz file therein. (Do not close the email client until you have pasted the attachment.)
a6) For convenience sake, rename the file to something meaningful (as in our case yandles1.kmz)
B) Converting the KMZ to a KML file:
The KMZ file is an ordinary zip file and needs to be unzipped. Easily done…
b1) Simply rename the extension from *.kmz to *.zip (Ignore the warning that you will get!)
b2) Unzip the file and locate the resulting ‘doc.kml’ (Do not double click on this yet…)
b3) Rename doc.kml to something meaningful (yandles1.kml)
C) Minor edit of KML file:
c1) open the kml file in a text editor such as notepad
c2) on the 4th line you will see <name>~GE5A.kmz</name> …
c3) … Change this to something meaningful – our case: <name>Yandles Home</name>
c4) then on about line 34, find <name>GoogleEarth_Placemark</name> …
c5) … Change this also - in our case: <name>Yandles of Martock</name>
c6) Save the file with these 2 minor edits.
c7) Upload this file on to your server. (In our case, into a directory named ‘kml’)
D) Creating a link on the web page
The link is exactly the same as any other standard html link two samples:
Sample 1) <a href="kml/yandle1.kml">Yandles on Google Earth</a>
Sample 2) <a href="kml/yandle1.kml"><img src="kml/yandles-on-ge-130pxw.gif" alt="Yandles on Goole Earth" width="130" height="67" border="0" /></a>
(Sample 2 is a clickable image link)
Upload the page and away you go…
- - - - - - - -
Trouble shooting:
Test the link in separate browsers especially in IE and Firefox… - Not all host servers are configured to parse a kml or kmz file and act as an ‘Earth Browser Server’. Note: The Actinic Server IS so configured and does act as an Earth Server. (We hare hosted by Actinic )
If, when you click on the link, you get a page open up and see the code/script, your host browser is not configured to do so…
Solution 1 – a work around for Internet Explorer. Open the kml file and delete the first line:
<?xml version="1.0" encoding="UTF-8"?> Make absolutly sure that there are spaces left on the deleted line 1 and that line 2 is now in the line 1 position - this is critical.
Save and upload to server - This should now work in Internet Explorer. It will not work with Firefox which will still display the code/script.
Solution 2 – the preferred solution:
Contact the Systems Administrator at your hosting company. Explain what you are trying to achieve and point him to the Official Google Earth statement:
QUOTE:
KML MIME Types
When responding to a request from Google Earth (or any Earth browser), a KML server must follow a certain set of rules so that Google Earth can correctly interpret its responses.
Upon success, the server must return a response code of HTTP 200 and set the response's content-type to a suitable MIME type, as described here.
Google Earth reads KML and KMZ files.
The MIME type for KML files is
• application/vnd.google-earth.kml+xml
The MIME type for KMZ files is
• application/vnd.google-earth.kmz
For Apache, add these lines to the httpd.conf file:
• AddType application/vnd.google-earth.kml+xml .kml
• AddType application/vnd.google-earth.kmz .kmz
See the Microsoft documentation for details on setting up MIME types on Microsoft's IIS.
The body of the response must contain valid KML data, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>). If the server returns invalid KML, the Network Link will stop, deactivate, and output an error message.
UNQUOTE
I am grateful to Chris Dicken and the Actinic Systems Administrator for their help.
It works by calling a link that is stored as a ‘*.kml’ file on the server. In our case, the link is www.yandles.co.uk/kml/yandles1.kml
If you are interested in adding a similar feature to your website, the following is a simple tutorial on ‘How To’
The process consists of:
A) Capturing the location as a file;
B) Converting the resulting *.KMZ file into a *.KML file
C) Minor edit of the *.kml file
D) Creating a link on the web page.
E) Uploading the kml file to your server
A) Capturing the KMZ file for your location:
a1) Open Google Earth and find your location. Zoom in, rotate and set the angle of view to your needs.
a2) Click the Mail ICON in the tool bar above the map.
a3) Select ‘Snapshot of 3D View’ (the middle option), then click on the ‘Mail’ button. This will open up your email software. (You don’t need to actually send the email – see next step)
a4) In the email software, locate the ‘attachment’ that will be labelled ‘GoogleEarth_Placemark.kmz’. Right click on it and copy it to memory.
a5) With Windows Explorer, create a directory such as ‘GE KMZ’ and Paste the copied kmz file therein. (Do not close the email client until you have pasted the attachment.)
a6) For convenience sake, rename the file to something meaningful (as in our case yandles1.kmz)
B) Converting the KMZ to a KML file:
The KMZ file is an ordinary zip file and needs to be unzipped. Easily done…
b1) Simply rename the extension from *.kmz to *.zip (Ignore the warning that you will get!)
b2) Unzip the file and locate the resulting ‘doc.kml’ (Do not double click on this yet…)
b3) Rename doc.kml to something meaningful (yandles1.kml)
C) Minor edit of KML file:
c1) open the kml file in a text editor such as notepad
c2) on the 4th line you will see <name>~GE5A.kmz</name> …
c3) … Change this to something meaningful – our case: <name>Yandles Home</name>
c4) then on about line 34, find <name>GoogleEarth_Placemark</name> …
c5) … Change this also - in our case: <name>Yandles of Martock</name>
c6) Save the file with these 2 minor edits.
c7) Upload this file on to your server. (In our case, into a directory named ‘kml’)
D) Creating a link on the web page
The link is exactly the same as any other standard html link two samples:
Sample 1) <a href="kml/yandle1.kml">Yandles on Google Earth</a>
Sample 2) <a href="kml/yandle1.kml"><img src="kml/yandles-on-ge-130pxw.gif" alt="Yandles on Goole Earth" width="130" height="67" border="0" /></a>
(Sample 2 is a clickable image link)
Upload the page and away you go…
- - - - - - - -
Trouble shooting:
Test the link in separate browsers especially in IE and Firefox… - Not all host servers are configured to parse a kml or kmz file and act as an ‘Earth Browser Server’. Note: The Actinic Server IS so configured and does act as an Earth Server. (We hare hosted by Actinic )
If, when you click on the link, you get a page open up and see the code/script, your host browser is not configured to do so…
Solution 1 – a work around for Internet Explorer. Open the kml file and delete the first line:
<?xml version="1.0" encoding="UTF-8"?> Make absolutly sure that there are spaces left on the deleted line 1 and that line 2 is now in the line 1 position - this is critical.
Save and upload to server - This should now work in Internet Explorer. It will not work with Firefox which will still display the code/script.
Solution 2 – the preferred solution:
Contact the Systems Administrator at your hosting company. Explain what you are trying to achieve and point him to the Official Google Earth statement:
QUOTE:
KML MIME Types
When responding to a request from Google Earth (or any Earth browser), a KML server must follow a certain set of rules so that Google Earth can correctly interpret its responses.
Upon success, the server must return a response code of HTTP 200 and set the response's content-type to a suitable MIME type, as described here.
Google Earth reads KML and KMZ files.
The MIME type for KML files is
• application/vnd.google-earth.kml+xml
The MIME type for KMZ files is
• application/vnd.google-earth.kmz
For Apache, add these lines to the httpd.conf file:
• AddType application/vnd.google-earth.kml+xml .kml
• AddType application/vnd.google-earth.kmz .kmz
See the Microsoft documentation for details on setting up MIME types on Microsoft's IIS.
The body of the response must contain valid KML data, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>). If the server returns invalid KML, the Network Link will stop, deactivate, and output an error message.
UNQUOTE
I am grateful to Chris Dicken and the Actinic Systems Administrator for their help.
Comment