According to Wikipedia (retrieved April 10, 2011), “Keyhole Markup Language (KML) is an XML schema for expressing geographic annotation and visualization within Internet-based, two-dimensional maps and three-dimensional Earth browsers. KML was developed for use with Google Earth, which was originally named Keyhole Earth Viewer. It was created by Keyhole, Inc, which was acquired by Google in 2004. The name "Keyhole" is an homage to the KH reconnaissance satellites, the original eye-in-the-sky military reconnaissance system first launched in 1976. KML is an international standard of the Open Geospatial Consortium.”
KML version 2.2 is one of the many Open Geospatial Consortium (OGC) standards. OGC is “is an international industry consortium of 420 companies, government agencies and universities participating in a consensus process to develop publicly available interface standards. OGC® Standards support interoperable solutions that "geo-enable" the Web, wireless and location-based services and mainstream IT.” (retrieved April 10 2011).
See also: Google Sketchup tutorial
End-users of programs such as Google Earth are not exposed to XML coding since the pro version of the software allows defining placemarks as well as virtual tours through a GUI interface.
Below, we show a basic example of the XML code that just defines a placemark with coordinates and a description
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Placemark>
<name>Faclab Unige</name>
<description>Fablab de l'université de Genève sur le site de Batelle</description>
<Point>
<coordinates>6.139765530824662,46.176638424281556,0</coordinates>
</Point>
</Placemark>
</kml>
While KML defines placemarks, views on placemarks, virtuals tours, etc. it is usually distributed withing a ".kmz file, which is a zip file. The *.kmz includes a kml file plus various multimedia assets.
Google Earth Pro, i.e. the desktop version (not the browser version) allows editing *kmz files.
The main functionalities are in the "Add" menu, also available as icons on the menu bar.
Each item (e.g. placemark, model or picture) can be edited and repositioned.
Saving a folder as a KMZ file and using it:
Google Earth can display 3D models in Collada format.
To create collada files, you could use any sort of 3D modeling or CAD tool. Most formats can be converted to Collada.
To add a model, use the model icon (or Add->model). Then fill in the properties window. To re-edit properties, right-click on the item in the places panel
Within the properties popup, you can
Shnaphot current view
button in the View tab of the properties popup.You also can directly manipulate the model (open the properties popup first)
Within the KML file, the placement XML code of the model could then look like the fragment below, and, as explained below, you then can edit the doc.kml file in the exported *kmz archive to add things that the authoring interface does not allow doing.<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> <Document>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
......
<Folder>
<name>UniGE</name>
.............
<Placemark id="OpenAirTemple">
<name>Open Air Temple</name>
<description><![CDATA[This was made (as a test with) TinkerCAD Code<a href="https://www.tinkercad.com/codeblocks/7JpQZDXcLjG-rotated-matrix-of-simple-towers">https://www.tinkercad.com/codeblocks/7JpQZDXcLjG-rotated-matrix-of-simple-towers</a>Blocks]]></description>
<LookAt>
<longitude>6.138808314750876</longitude>
<latitude>46.19514246054897</latitude>
<altitude>0</altitude>
<heading>0.0005688108686985107</heading>
<tilt>60.00112631496884</tilt>
<range>144.7967905032639</range>
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
</LookAt>
<styleUrl>#m_ylw-pushpin</styleUrl>
<Model id="model_2">
<altitudeMode>relativeToGround</altitudeMode>
<Location>
<longitude>6.138624480121518</longitude>
<latitude>46.19521277632689</latitude>
<altitude>8</altitude>
</Location>
<Orientation>
<heading>219.1029213043479</heading>
<tilt>0</tilt>
<roll>0</roll>
</Orientation>
<Scale>
<x>0.1646009085056746</x>
<y>0.1645994077651669</y>
<z>0.1646001581354208</z>
</Scale>
<Link>
<href>files/Rotated Matrix of simple towers 270.dae</href>
</Link>
<ResourceMap>
</ResourceMap>
</Model>
</Placemark>
...............
A tour is just another item in a places folder. To create a tour:
Warning: One you placed a tour inside a places folder and after using the tour you cannot add other objects. Move the tour to another folder to do so.
As of Jan 2020, the free (online version) of Sketchup no longer allows creating *.kmz files. You either should acquire a commercial version or else directly use Google Earth Pro, as explained above.
In Sketchup Pro, you can place a Sketchup model in the right place with very little work.
Now do the following adjustements
The export as Google Earth model
Open in Google Earth, clicking on the file should do. Else use File->Open
If the position and the view isn't right, adjust what you can do in Sketchup, then do some KML surgery (see below)
Google Earth files are Zip 2.0 archives that use the *.kmz extensions.
KMZ architecture
Examples
A KMZ archive includes at least:
As of Jan 2020, the only KML editing software seems to be Google Earth Professional, see above for an introduction.
Most often KML is used with Google Earth, inside a KMZ file. KMZ is a zip archive that will include a KML file plus all the assets it uses. Assets also can be references with URL.
If you never experienced an XML format before, you might read Editing XML tutorial.
The easiest way to see a KML file is the following: In Google Earth, you can right-click a Feature in the Places panel and copy it. To view the corresponding KML for the copied object, open your favorite text editor and paste the selection into it. (KML reference guide).
Otherwise, you can extract the KML file from a KMZ archive. Get a useful zip program like 7-zip or learn how to deal with *.zip files using Windows Explorer
You now can enhance the experience, for example:
The KML reference guide is well done
First things you may need to fix:
Important tip
When in Google Earth, click right on an item in the places panel to the left. Then copy. Then paste into a text editor. It will give you the *.kml.
Below is a simple example exported from sketchup (enhancing WUG with a swimming pool)
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Folder>
<name>gs-interface-google-earth-demo</name>
<description>Created with <a href="http://sketchup.google.com">Google SketchUp</a></description>
<visibility>1</visibility>
<LookAt>
<heading>317.4387945958</heading>
<tilt>70.27179262714</tilt>
<latitude>46.25706768089</latitude>
<longitude>6.151697277086</longitude>
<range>52.92320526358</range>
<altitude>22.58315454372</altitude>
</LookAt>
<Folder>
<name>Tour</name>
<Placemark>
<name>Scene 1</name>
<visibility>1</visibility>
<LookAt>
<heading>317.4387945958</heading>
<tilt>70.27179262714</tilt>
<latitude>46.25706768089</latitude>
<longitude>6.151697277086</longitude>
<range>52.92320526358</range>
<altitude>22.58315454372</altitude>
</LookAt>
</Placemark>
</Folder>
<Placemark>
<name>Model</name>
<description></description>
<Style id="default"/>
<Model>
<altitudeMode>relativeToGround</altitudeMode>
<Location>
<latitude>46.257066</latitude>
<longitude>6.151696</longitude>
<altitude>0</altitude>
</Location>
<Orientation>
<heading>357.941140275</heading>
<tilt>0</tilt>
<roll>0</roll>
</Orientation>
<Scale>
<x>1</x>
<y>1</y>
<z>1</z>
</Scale>
<Link>
<href>models/untitled.dae</href>
</Link>
</Model>
</Placemark>
</Folder>
</kml>
Same example improved:
Live example: gs-interface-google-earth-demo.kmz
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Folder>
<name>gs-interface-google-earth-demo</name>
<description>WUG enhanced with a swimming pool and some palm trees</description>
<visibility>1</visibility>
<LookAt>
<heading>317.4387945958</heading>
<tilt>70.27179262714</tilt>
<latitude>46.25706768089</latitude>
<longitude>6.151697277086</longitude>
<range>52.92320526358</range>
<altitude>22.58315454372</altitude>
</LookAt>
<Folder>
<name>Tour</name>
<Placemark>
<name>Scene 1</name>
<visibility>1</visibility>
<LookAt>
<heading>317.4387945958</heading>
<tilt>70.27179262714</tilt>
<latitude>46.25706768089</latitude>
<longitude>6.151697277086</longitude>
<range>52.92320526358</range>
<altitude>22.58315454372</altitude>
</LookAt>
</Placemark>
<Placemark>
<name>Scene 2</name>
<visibility>1</visibility>
<LookAt>
<heading>317.4387945900</heading>
<tilt>70.27179262714</tilt>
<latitude>46.25706768089</latitude>
<longitude>6.151697277086</longitude>
<range>20</range>
<altitude>10</altitude>
</LookAt>
</Placemark>
<Placemark>
<name>In the pool</name>
<visibility>1</visibility>
<LookAt>
<heading>180</heading>
<tilt>70.27179262714</tilt>
<!-- play with five digits. Plus to go east, plus to go south -->
<latitude>46.25699</latitude>
<longitude>6.15175</longitude>
<range>5</range>
<altitude>5</altitude>
</LookAt>
</Placemark>
</Folder>
<Placemark>
<name>Model</name>
<description>Swimming Pool</description>
<Style id="default"/>
<Model>
<!-- this is interpreted as above land if not on sea ... won't take neg values pff -->
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
<Location>
<latitude>46.257066</latitude>
<longitude>6.151697277086</longitude>
<altitude>0</altitude>
</Location>
<Orientation>
<heading>357.941140275</heading>
<tilt>0</tilt>
<roll>0</roll>
</Orientation>
<Scale>
<x>1</x>
<y>1</y>
<z>1</z>
</Scale>
<Link>
<href>models/untitled.dae</href>
</Link>
</Model>
</Placemark>
</Folder>
</kml>
Here is a simple tour of Uni Mail and Uni Pignon with some extra thrown in.
Since the code is rather lengthy you can examine it in Keyhole Markup language/Uni Pignon - Mail KML example.
To Do: Create a more streamlined tour !