Creating KML and KMZ Files For Your Custom Google Maps



The simple way to create KML / KMZ files for Google Maps, Google Earth and etc without actually knowing the syntax.

KML (Keyhole Markup Language) is an XML based file format used to display geographic data in an Earth browser such as Google Earth, Google Maps, and Google Maps for mobile. With some tweaking, it can even be viewed on Bing Maps and Microsoft Virtual Earth.

With KML, you can display pretty much everything on a map. Even more, you can customize the map’s look & feel and it’s behavior to suit your needs. Check out my Demo Map.

 
Getting Started
Download and install Google Earth. If you love codes, you might want to also check the KML primer first, but if you’re anxious to start, then dive in.



Creating Placemarks
Placemark is simply a point on the map. Zoom in to the area where you want to place a placemark and click the “Add Placemark” button on the Google Earth toolbar (the push pin icon).

click image to enlarge

Drag the placemark to the exact location where you want it to be.

For the “Description” you can actually add HTML codes that will be displayed as callout ballon when the placemark is clicked. You can add pictures, YouTube videos, Flash Macromedia files, Internet links and even bookmarks into your balloon.


click image to enlarge

You can also change the placemark icon (the yellow push pin). To use an icon of your own, you can either upload an image / icon file (PNG, GIF) to an online file host. Be sure that the hosting service allows for direct linking (i.e Photobucket). This way, you can choose to save your file as KML and the custom icon will appear on whichever computer where the map is viewed (given the computer has internet connection of course).

Alternately you can browse for an icon image on your local computer. However, in order for the custom icon to able to be viewed on any computer, it need to be zipped for distribution. Therefore you MUST save your placemark as KMZ file, not as KML. Read Saving as KML / KMZ section of this post for more info.

click image to enlarge 



The “Style, Color” tab allows you to change the color of the placemark icon.

click image to enlarge


Most importantly is the “Altitude” tab. Be sure to set it to “Relative to ground” as shown in the image. This will enable the KML file that you will later create to be able to be viewed on Google Maps.
click image to enlarge
Creating Polygons
With polygon, you can create an overlay on the map that denotes an area (ie service coverage, public parks, parking spaces, etc).

As with adding placemarks, zoom in to the area where you want to overlay a polygon and click the “Add Polygon” button on the Google Earth toolbar. Click on the map to add multiple points that will form the polygon. Right click to remove points.

The “Description” tab allows you to add HTML codes that display texts, photos, tables, etc.
The “Style, Color” tab allows you to change the color of the polygon overlay. Be sure to adjust the opacity so that it is semi-transparent. For me 40%-50% opacity is just nice.
click image to enlarge

Most importantly is the “Altitude” tab. Be sure to set it to “Relative to ground”. This will enable the KML file that you will later create to be able to be viewed on Google Maps.
click image to enlarge





Creating Paths
Paths are just lines. Similar to Placemarks and Polygons, you can also add description, change style and color. Be sure to set the Altitude to “Relative to ground”. This will enable the KML file that you will later create to be able to be viewed on Google Maps.

click image to enlarge

Saving as KML / KMZ
Once you’re done adding  Placemarks, Polygons or Path, right-click on the item in the “Places” section of the Sidebar and choose “Save Place As”.

click image to enlarge

Choose KML in “Save as Type” dropdown. Name it, and click “Save”. Or KMZ if you have local images to be included in the distribution.

NOTE: KMZ is a zipped version of KML

You can save each Placemark, Polygon or Path individually, each into a separate KML/KMZ file. Or you can group all of them in one folder, and save the folder as one file.


Download all the sample KML files for Placemark, Polygon and Path here.

What to do next?
Now that you have the KML files, you can email to friends. You can upload it to google map and share it with anyone..

But best of all, you can upload the file online, and use the KMLs to be displayed on any of your custom maps (ie on your blogs, websites, etc).

1 Comment:

Emi said...

Thank you EasternGeek for your great tutorial. Do you know how to add "Get Directions to here" for the places you add to your KML file? Thank you again.

Related Posts with Thumbnails