« Google Earth Research Notes | Main | Asteroid Occultations »

September 15, 2005

Google Earth Files - KML/KMZ

So, what are these KML and KMZ files anyway? They are Google Earth's file format for storing placemarks, network link information, and much more. I won't go into detail here, since there are excellent reference documents available from Google (see below). But, let me describe the fundamentals.

KML stands for Keyhole Markup Language (Keyhole was the name of the application before Google bought it and added their own features and larger databases). If you understand HTML/XML you will have little problem understanding the syntax of KML. You can learn about KML from the KML Tutorial, or get the full details from the KML Documentation.

KMZ stands for KML-Zipped. It is the default format for KML because it is a compressed version of the file. One of the more powerful features of KMZ is that it allows any images you use - say custom icons, or images in your descriptions - to be zipped up within the KMZ file. That way you can share these details without having to reference the files through some link to the Internet. For KMZ files without images, the file size will be much smaller than the equivalent KML file.

If you understand basic HTML/XML you can easily get started by saving a simple placemark you've created as a KML file (not the default KMZ), and looking at the resulting text file. If you are a programmer you will probably be fascinated by the topic of Network Links. Network links are one of the most powerful features of GE enabling a KML file to reference data dynamically on a server somewhere out on the Internet.

In a nutshell, learning to do things with KML/KMZ is the equivalent to learning to write a web page, but instead of a web page you are changing the face of the GE. Just like with web page creation tools, you don't have to know KML to create a KML file. You can start placing Placemarks or Image overlays straight from GE's interface.

Posted by FrankTaylor at September 15, 2005 08:22 AM

  • Google Earth Blog © 2005-2008 Copyright by Frank Taylor. All Rights Reserved.
  • All image screenshots from Google Earth are Copyright by Google


  • Comments

    Dear Sir,
    I would to know how i could open through these KML and KMZ files. Please let me know about this. i won't able to open such these kind of files

    Posted by: husam at October 22, 2005 06:15 AM

    i want details about google earth.

    Posted by: prasannakumar thallapeli at November 7, 2005 03:06 AM

    In which format is used by GE to store the geometric information of the earths surface? As far as I understand KML, KML is not able to store any topographic data. Is this right?

    Posted by: Stefan at January 14, 2006 05:09 AM

    The Earth surface data is provided by Google Earth's Primary Database when you connect to Google. (I assume the base sphere is just a simple geometric model built in to the program)

    The topgraphical 3D model is actually a database they got from NASA which was collected by Space Shuttle missions.

    I'm not sure what geometric model they use to store the 3D data, but I believe it is simply tesselated 3-sided polygons.

    Posted by: Frank Taylor at January 14, 2006 08:44 AM

    I want to know that whether the *.kmz/kml file foramt stores more than one location and display it on google earth?

    Posted by: viral Sompura at January 21, 2006 12:29 PM

    Yes, .kml/.kmz files can store many locations in one file (as many as you want really, especially if you use them as a network link to a database where they can be theoretically infinite).

    Posted by: Frank Taylor at January 21, 2006 01:24 PM

    Is it possible to capture the polygon data from Google Earth from a web page? I can control GE from the webpage, but also want to capture what the user does while in GE.

    Posted by: MDV at March 7, 2006 09:04 AM

    Our society has done a number of web sites. However, we are still trying to understand Google Earth Community.
    Two points out of a hundred:
    1. What is inscribed in one computer does not appear on another.
    2. Google has taken much care in inscribing both English and French characters. The notion of WORLD COMMUNITIES is unknown to Google Earth Community. The company knows better.

    Could please indicate un a good source of basic information. Merci.

    MES RESPECTS

    Pierre Larouche, président
    Les Compagnons de Jacques Cartier - osbl president@jacquescartier.org
    http://jacquescartier.org/compagnons/index.html

    Posted by: Pierre Larouche at March 27, 2006 09:45 PM

    How do I get rid of one that I don't want anymore? Am I stuck with it?

    Posted by: Grossman at May 12, 2006 10:38 PM

    You can simply delete any KMZ file in your "Places" pane. Or you can delete the file off your drive if that is what you are asking about.

    Posted by: Frank Taylor at May 12, 2006 11:00 PM

    What kind of feedback can be gathered from GE presently, and what is planned in the near future versions? As far as I read from the KML tutorial, I can get my server triggered on regular periods, with the wiew box currently visible in the client. That is great, but I want want more control, I want to enable user to click on the map (or doubleclick, right-click and choose option, click&move the placemark, etc.) so that the server is informed about certain point in the map. Possible use of this would be updating of my places database, and, in the longer run, an online game about nations and their quest for power and territory. I hope this doesn't mean that I need GE Pro version...

    Posted by: Pavils Jurjans at May 16, 2006 11:36 AM

    I'm trying to create a KMZ file from a KML with an image directory that is referenced in the KML. Is there a simple way of doing this?

    Posted by: Karel at June 11, 2006 05:26 AM

    Is there is way to hide the content of the kmz file so that when loaded into GE the user cannot simply "save as" kml file and then open it from any editor software to easily look at and edit the content ?
    In an other way to go around it : how to disable the "save as" function in the file menu when loading a kmz file ?

    Posted by: Vernice at August 10, 2006 01:07 AM

    How do I create a kmz in my own code. I want to produce dynamic kmz from a website. (It is more compact than kml which I can already do, and the feature of including graphics is interesting).

    Posted by: Timothy at September 6, 2006 02:46 AM

    1. I have my own hardware/software combo to obtain the (lat, long) at a particular place. How do I interface this (database) with Google Earth to render it in real time and provide location tracking?

    2. How do I dynamically update KML files?

    3. How do I call the updated KML files in a periodic fashion?

    Posted by: Sriram Raghavan at September 27, 2006 08:03 AM

    Can I used the poligon created by the google and read it in the arcview to calculate area. If possible How to do it???

    thanks,

    Marcelo Crossa

    Posted by: Marcelo Crossa at November 16, 2006 04:48 PM

    It seems like the COM API does not provide functionality to remove polygons from the "My Places" folder in GE. As a workaround I'm thinking about 1. setting the feature to invisible and 2. remove the kml file from the computer through jscript, except that I can't find where GE stores the kml files for that. I've gone through all the GE directory on my machine. Any clues? Is there a way I can remove a polygon from the "My places" folder in GE from outside GE? (ie. using com api in hta app). Thanks a bunch.

    Posted by: mmenchu at January 17, 2007 03:49 PM

    In a sample web application I need to extract the images from google Earth and use it on my web pages. So how can I do it without manually opening the Google Earth and saving the image using 'Save as' option.

    Posted by: Chidananda Raju at January 24, 2007 03:34 AM

    Does anybody know where google saves the 'My Places' placemarks by default? I recently took a complete backup of my hard drive and then formmated it but without saving My Places to a KMZ file first. I had hundreds of places saved and cannot find anything referencing them in the google earth folders.

    Any help would be much appreciated.

    Thanks,
    John.

    Posted by: John Rogers at February 10, 2007 10:12 AM

    The myplaces.kml file is saved in
    C:\Dokumente_und_Einstellungen\username\Anwendungsdaten\Google\GoogleEarth
    (sorry for the German folder names, but I would have to guess the English names and they would probably not right).
    Anyway, when you restored your system partition then, I'm afraid, all your files are gone.

    It is my principle not to save my data on the system partition, but convince the programs to store them elsewhere. For Google Earth there is some tweaking of the registry necessary to get this done.

    Posted by: Berthold Pasch at February 13, 2007 06:39 PM

    Hi,

    I'd like to edit the kml file to reach a specific location, at a specific altitude.
    There is a 'altitude' tag, but it seems it doesn't have any effect.

    Any idea how to reach a specific altitude, either with a kml file, or within Google Earth itself ?

    Thanks !
    Jerome

    Posted by: Jerome at February 16, 2007 04:54 AM

    How do I delete a KML placemark which has been shared/posted by me? It contained some incorrect information I have attempted to edit, however it still appears in its original format...
    I would very much appreciate being led through the delete or edit process, and be given an indication of how long it takes for the deletion to occur in the GE Community?

    Posted by: coldwaterjohn at February 28, 2007 07:45 AM

    To coldwaterjohn:

    If you have changed your attachment at the GEC with a new KMZ with the correct information, it should show the correct information when you download the attachment.

    If you are asking about the Google Earth Community layer version of your file, that layer is updated about once every 30 - 60 days. So, if that is your issue, you may have to wait about that long before your new version is put into the layer.

    Posted by: Frank Taylor at February 28, 2007 08:42 AM

    I created a .kmz file by creating a subfolder under My Places, putting placemarks in the subfolder and saving the subfolder as a .kmz file.

    However, when the file is opened by Google Earth, the structure is "filename.kmx > subfolder > placeholders".

    Therefore if I post this .kmz online as a tour, the tour does not start automatically. If I press the 'play' button, I get "There are currently no placemarks selected for the tour. Please activate the checkbox for those Placemarks you wish to visit and restart the tour. You can also select a folder and play a tour of all its items whether or not they are checked."

    However, other tours posted on the bulletin board begin automatically as soon as the file is downloaded.

    I cannot move my placeholders up out of the subdirectory as I have other placeholders there. I cannot edit the .kmz file as it is zipped, and I cannot save to .kml (for the purpose of editing the file) because I am using a custom image for the placholder, and this would probably not be incorporated into the .kml file.

    Question: how to get my tour to start automatically?

    Posted by: Chris at March 21, 2007 10:17 AM

    I converted a points layer from ArcGIS to .kmz (using ArcToolbox) and everything loads fine the first time that I start Google Earth. When I exit Google Earth I'm prompted to save my file to "My Places". I click yes and then when I reopen Google Earth the file is in "My Places" but the points themselves are missing. The labels are still there, however. If I delete the .kmz file from "My Places" and then reopen the .kmz file everything looks normal.

    What am I doing wrong? Is there any way to save the file to "My Places" without losing the points the next time that I load Google Earth? Is my only option to keep reopening the .kmz file every time?

    Thanks,
    Jeff

    Posted by: Jeff Miller at March 21, 2007 12:30 PM

    Hi,
    I'm trying to create a kmz file with 1000 points and attached images or perhaps video files that can be viewed in the pop-up display box.

    How do I do this? I realize its possible with Google maps so what I am going to try is this...

    Firstly import my 1000 files into Google Earth Plus as a shapefile created in Arc.

    Save it as a kmz on my organisations website.

    Open in Google maps

    Attach media files through linking them to web based storage, such as you tube.

    I would then like to share this file so is it possible for people to download from my site?

    I'd really appreciate help with this. Its for a humanitarian project in Uganda.

    Bernard

    Posted by: Bernard at April 12, 2007 11:09 AM

    I am a student at the University of Nevada Reno and my class is working on a Google Earth Project. We are trying to take a georeferenced sanborn map of Virginia City, NV in ArcGis and convert the file to KML so that we can place it into Google Earth. We orginally used the geo refed ArcGis file as a .img file and put it into Google Earth and it worked, but when we tried to convert the file to KML it would not come in properly to Google Earth. Anyone have any suggestions?

    Posted by: D at April 26, 2007 06:27 PM

    I e-mailed my KML file to myself and others. (there is an option to do this under the File tab)This procedure seems to insure that the file will be opened by Google earth.

    Posted by: Brian at April 30, 2007 12:38 PM

    hi
    i have two kmz files and i like to link them in a single kml file using the link tags.. when im using to do it giving the single link tag only work. The way im writing the code is:

    MyCar

    mymap.kmz
    mycar.kmz


    plz give me the solution...

    Posted by: Vinod at June 4, 2007 01:15 AM

    How does one place placemarks on a web page?

    Posted by: Ed at July 8, 2007 01:18 AM

    I was expecting to find info on where I could download a reader for KMZ fikes listed, but no,
    It seems a Q/A format would link this info.
    John

    Posted by: John at July 27, 2007 09:49 PM

    Hi... I'd like to have a .kmz file available from a link on my web page however when the link is clicked the file opens in a browser window...how do I force the file to be downloaded to be opened by Google Earth only... thanx

    Posted by: warren at August 14, 2007 05:27 AM

    warren, the answer to your question is setting your Mime types on your web server to support the KML/KMZ file types. Read the answer at Google Earth's Help Center:

    http://earth.google.com/support/bin/answer.py?answer=25094&query=mime+type&topic=&type=

    Posted by: Frank Taylor at August 14, 2007 09:18 AM

    Posters to the Google Earth community offer 3D images they've made, but when I download them, they are in .kmz format, which does not open with the Sketchup software Google provides for making 3D models. Sketchup apparently opens only .skp files. What additional software is needed to view the .kmz files? Once or twice, the .kmz files appeared on a Text word-processor page as a long series of oriental ideograms. Usually, though, nothing happens when I click on the .kmz files.

    Posted by: Lemastre at August 27, 2007 11:12 PM

    I have used GE since about the start...
    Now a new computer.
    I have many "my places" stored "somewhere" on my old PC.
    QUESTION??
    And I've looked, but not found answer???
    Where's this data file stored (by default)??

    Posted by: waide rishel at September 2, 2007 11:25 AM

    Hello,

    I'm going to programmaticaly generate a number of KML files to report insect infestations in the south. Is there a zoom scale/display extent/view resolution to display/hide the placement markers?

    Say if the eye altitude is less than 50 Miles I want my marker to disappear. Its a privacy issue.

    Thanks!!

    Posted by: Tony Courter at September 14, 2007 06:41 PM

    Dear Tony(oops, excuse,)Frank:

    Thanks a lot for your blog!! :)

    i have recently installed GE on a Linux system and have copied by old Myplaces.kmz file to the new GE folder, but when the program runs, it doesn't open the .kmz file. i have seen that this is "zipped" so now understand why its so small, but how do i get it to appear in GE's left pane --Somewhere! under Places...

    Thanks a have a great day! :)

    Posted by: Fred Frazelle at October 7, 2007 12:37 PM

    Hi

    i know how to extract kmz content,
    i like to know how to compress with out using sketchup to export/compress/convert skp file to kmz file.
    thank you..

    Posted by: vinod d at October 11, 2007 12:58 AM

    Hi,
    I am trying to appload my image to 3D Warehouse and am getting this error about KMZ/KML files.

    I have been trying to find out more about these files but its all grey at the moment.

    PLIZ sum! F1!

    Posted by: Isaac Banda at October 16, 2007 03:26 AM

    for test purpose, I just published this kmz file that collects selected Videos (from youtube, dailymotion, turnhere, googlevideo) of the capitals of the world : http://www.VeniVidiWiki.eu/kmz/Capitals-V1.0.kmz
    feedback welcome
    bon voyage !

    Posted by: Sylvie74 at October 17, 2007 05:11 PM

    can we have the google earth database which can be use with net connection and not a single time going on line with google earth

    Posted by: Ganesh at October 26, 2007 08:23 AM

    Is it possible to calculate the area of a polygon you create or you need another program for that?

    Posted by: Dimitris Gryparis at October 29, 2007 07:11 AM

    Can any one guide me how can we convert KMZ/KML file into mapinfo *.tab file?

    Posted by: Farrukh Saleem at November 30, 2007 02:33 AM

    When I try to add content to GE 4.x, it tells me it "Can't create directory". I am using the administrator account. The directory it is trying to create already exists. This is frustrating as there are many nice files that would be nice to see, but I can't open any of them! How can I solve this error?
    Thanks

    Posted by: Steve at January 1, 2008 11:58 PM

    I am also interested in the question about calculating the area of a polygon. Is this possible without another program? If so, how is it done?
    Thanks!

    Posted by: Amy at January 6, 2008 09:23 AM

    I need to know whether or not it is possible to convert a SketchUp model (.skp) to a Google Earth File (KMZ). If it is possible, please tell me how I can convert the model or where to go to find out (specifically).

    Thank You,
    Christian

    Posted by: Christian at January 14, 2008 04:20 PM

    i believe that you need to pay for a better version of sketchup off their website in order to read and save 3d models as .kmz Sorry!!

    Posted by: rory Davidson at February 8, 2008 12:04 PM

    hi
    is it possible to extract the Lat/Lon of the palcemarks from a KMZ/KML file to an Excel sheet??

    Posted by: Salloum at February 11, 2008 04:02 AM

    In terms of determining the areà of a polygon , I recommend averaging the points for a center point , constructing radiàls , and summing the areàs of the resulting triàngles . I have included some Maxima code . If speed is more important than precision , you may try writing a programme in C . Note that for the triàngle areàs , I solved for the angle in the Law of Cosines and substituted it into the angle-side triàngle areà formula .
    {
    Set Points1 as a list that has a list of Points1 like [[x1,y1],[x2,y2],[x3,y3]] . There is no need for repeating the first point at the end .
    Count2 : length( Points1 ) ;
    Buffer1 : [ 0 , 0 ] ;
    for Count1 : 1 step 1 while Count1 <= Count2 do ( Buffer1 : Buffer1 + Points1[ Count1 ] ) ;
    Center1 : Buffer1 / Count2 ;
    Sum1 : 0 ;
    for Count1 : 1 step 1 while Count1 < Count2 do ( Sum1 : Sum1 + block( [ a , b , c ] ,
    a : sqrt( ( Center1[ 1 ] - Points1[ Count1 ][ 1 ] ) ^ 2 + ( Center1[ 2 ] - Points1[ Count1 ][ 2 ] ) ^ 2 ) , b : sqrt( ( Center1[ 1 ] - Points1[ Count1 + 1 ][ 1 ] ) ^ 2 + ( Center1[ 2 ] - Points1[ Count1 + 1 ][ 2 ] ) ^ 2 ) , c : sqrt( ( Points1[ Count1 + 1 ][ 1 ] - Points1[ Count1 ][ 1 ] ) ^ 2 + ( Points1[ Count1 + 1 ][ 2 ] - Points1[ Count1 ][ 2 ] ) ^ 2 ) , ( (a*b*sqrt(-c^4/(4*a^2*b^2)+c^2/(2*b^2)+c^2/(2*a^2)-b^2/(4*a^2)-a^2/(4*b^2)+1/2))/2 ) ) ) ;
    Sum1 : Sum1 + block( [ a , b , c ] , a : sqrt( ( Center1[ 1 ] - Points1[ Count2 ][ 1 ] ) ^ 2 + ( Center1[ 2 ] - Points1[ Count2 ][ 2 ] ) ^ 2 ) , b : sqrt( ( Center1[ 1 ] - Points1[ 1 ][ 1 ] ) ^ 2 + ( Center1[ 2 ] - Points1[ 1 ][ 2 ] ) ^ 2 ) , c : sqrt( ( Points1[ 1 ][ 1 ] - Points1[ Count2 ][ 1 ] ) ^ 2 + ( Points1[ 1 ][ 2 ] - Points1[ Count2 ][ 2 ] ) ^ 2 ) , ( (a*b*sqrt(-c^4/(4*a^2*b^2)+c^2/(2*b^2)+c^2/(2*a^2)-b^2/(4*a^2)-a^2/(4*b^2)+1/2))/2 ) ) ;
    }

    Posted by: Frank Trampe at February 15, 2008 09:38 PM

    i need help for my sketch up models :when i send my model to google earth then save it as kmz there is no problem .but if i add another model and save both models that result with changing the fotos that cover the model.(i use sketch up in order to cover the buildings with their photos and than send them to google earth and save model as kmz and i add another model with foto. i save both model in one kmz. when i open the new kmz i see the fotos of model changed )

    Posted by: esra at February 25, 2008 02:31 PM

    How can I read the .kmz or the .skp formats? I just want to store simple (without texture) 3D models; and then open them with a C++ program. Is there any interface available to do this?

    Posted by: Zeeshan at March 5, 2008 05:27 PM

    I am trying to view a city model with only basic building blocks(7.90 MB) in google earth, but google earth is not responding. Is there a specified minimum KMZ file size, exported from SketchUp that Google earth accepts or is the problem related to memory space available on my PC? Kindly guide.

    Posted by: shridhar at March 10, 2008 08:50 AM

    Kindly inform me how I can convert KMZ\KML data into MapInfo format or DXF format.

    Posted by: DIPANJAN MONDAL at March 31, 2008 06:50 AM

    I can't find a kml file (I lost it when I've changed my Mac), which enable to change the pointer's hand in a cross.
    Do you know where I can find this file?
    Thank you in advance, Cyann

    Posted by: Cyann at April 8, 2008 07:27 AM

    Cyann, I don't think this is a KML file. KML can't change the mouse mode.

    I believe you could be referring to the "Click and Zoom" mode. You can read about this at the GE User Guide here:

    http://earth.google.com/userguide/v4/#mouse

    To set it you go to GE Options (Tools > Options > Navigation > Navigation Mode > Click-and-Zoom) and turn it on. The cursor will change to a cross, and when you click - you zoom. To return to normal mode you can hit CTRL-T (Windows).

    Posted by: Frank Taylor at April 8, 2008 10:34 AM

    please, i need to know how to share a "placemark" (kmz file) with everybody? (i want to make it accessible to anyone using google earth)

    Its very important to me
    thx

    Posted by: ucef at April 13, 2008 08:45 PM

    Does anyone know if there's a way I can export ALL lat/long co-ords contained within a given area/polygon? I've looked in the resulting exported kml file, but it only holds the perimeter points.

    Cheers

    Posted by: Sarge at April 14, 2008 12:31 PM

    Hi

    Wondering if anyone could help me. Is there a way or call to the API that will give me ALL lat/long co-ordinates contained within a given area? ie: Polygon?

    Many thanks, Sarge

    Posted by: Mark Sargeant at April 15, 2008 06:41 AM

    I am trying to include a link to a file using href, and it works when I use the full path to id the target file. However, it will not allow me to use a relative location (going through a parent folder), like:
    ../workbook/targetfile.doc

    Is there a trick to making relative locations work?
    thanks in advance,
    Julio

    Posted by: Julio at April 20, 2008 01:02 AM

    Does anybody ever answer these questions?

    Posted by: Sam at April 24, 2008 12:58 PM

    Hello,

    I'm starting to use Google Maps API on my WEBSITE (www.travellersalmanac.com), and I have really a lot of markers and it generate a KML file very bigger.

    How can I compact this file to get another compatible file with less Kbytes? How can I generate a KMZ file with all my markers?


    Regards!

    Posted by: The Traveller at April 25, 2008 05:02 PM

    hi
    iam using asp.net with c# and i wiant to integrate with google earth i now this could be done by kml file but how i need a example for it where should i write kml file and how should i run it in asp.net please reply me soon its urgent

    Posted by: Jameel at April 30, 2008 06:09 AM

    Post a comment:

    NOTE: Please use English. Comments are moderated.




    Remember Me?




    Sponsored Ad: