Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Latest commit

 

History

History
17 lines (11 loc) · 3.45 KB

KML.md

File metadata and controls

17 lines (11 loc) · 3.45 KB

Keyhole Markup Language (KML)

Keyhole Markup Language (KML) is an XML notation 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. KML became an international standard of the Open Geospatial Consortium in 2008.[1][2] Google Earth was the first program able to view and graphically edit KML files. Other projects such as Marble have also started to develop KML support.


KML and Google Earth

Google Earth is probably the biggest publicly accessible GIS in the world, and certainly the most popular browser for geographic data. All displays in Google Earth are controlled by KML files, which are written in the Keyhole Markup Language developed by Keyhole, Inc. KML is an XML-based language for managing the display of three-dimensional geospatial data. This format is now used in several geographical browsers (Google Maps, ArcGIS Explorer, World Wind, KDE Marble and similar) and is one of the most used OGC standards for spatial data.

The KML files can be edited using an ASCII editor (as with HTML), but they can also be edited directly in e.g. Google Earth. KML files are very often distributed as KMZ files, which are just zipped KML files with a *.kmz extension. This interactive KML sampler will give you some good idea about what is all possible via KML.

Although there are several browsers for KML files, the examples shown in this tutorial are based on Google Earth. To install Google Earth, run the Google Desktop installer that you can obtain from the Google's website. To start a KML file, just double-click it and the map will be displayed using the default settings. Other standard Google's background layers, such as roads, borders, places and similar geographic features, can be turned on of off using the Layers panel. There is also a commercial Plus and Pro versions of Google Earth, but for purpose of exercises in this guide, the free version is more than enough.

An important note: loading your data from R to Google Earth can be time consuming. First, you need to understand that there is a difference between loading the vector and raster maps to Google Earth. Typically, it is relatively easy to load vector data such as points or lines to Google Earth, and somewhat more complicated to do the same with raster maps. Also note that, because Google Earth works exclusively only with Latitude/Longitude projection system WGS84 ellipsoid), all vector/raster maps that are not in this system need to be first reprojected before they can be exported. Be aware that there are many other packages that allow importing GIS layers such as shape files, GPX tracks or GeoTiFFs to Google Earth. This tutorial focuses only on writing KML files from R via the plotKML package, but there are also several alternative open source solutions for parsing KML files (e.g. pyKML).

Also note that there are some serious limitations in what you can and cannot do with scientific visualizations produced using Google Earth (i.e. screenshots). Even though most of the screen can be covered with your own data and R plots in Google Earth window, Google still might require that you sign some copyright agreement or request a permission to use their software for commercial applications. For more info please refer to the Google geoguidelines.