Keyhole Markup Language: Difference between revisions

Content deleted Content added
added example
m Reverted edit by 2A02:E0:6F15:4B00:3162:7D3C:9F3B:F70C (talk) to last version by Wafitzge
Tags: Rollback Mobile edit Mobile web edit
 
(418 intermediate revisions by more than 100 users not shown)
Line 1:
{{Short description|Notation for expressing geographic annotation and visualization within Internet-based maps}}
'''KML''' ('''K'''eyhole '''M'''arkup '''L'''anguage) is an XML-based schema for managing 3D geospatial data in the program [[Google Earth]] (previously called Keyhole before it was bought up by google). KML files are often distributed as KMZ, zipped KML files. The KML file specifies a placemark for Google Earth. It contains a basic description of the place, [[longitude]], [[latitude]], [[tilt]] and some other information. KML files serve a similar purpose as worldwind:// urls in NASA [[World Wind]] but contains more information than just the longitude and latitude.
{{Redirect|KML}}
{{Infobox file format
| name = Keyhole Markup Language
| icon = Keyhole Markup Language.png
| iconcaption =
| icon_size = 66px
| screenshot =
| screenshot_size =
| caption =
|_noextcode = on
| extensions = <code>.kml</code>, <code>.kmz</code>
|_nomimecode = on
| mime = {{plainlist|
* <code>application/vnd.google-earth.kml+xml</code>
* <code>application/vnd.google-earth.kmz</code>
}}
| type code =
| uniform_type =
| conforms_to =
| magic =
| developer = [[Keyhole, Inc.]], [[Google]]
| released = <!-- {{start date and age|YYYY|mm|dd|df=yes/no}} -->
| latest_release_version =
| latest_release_date = <!-- {{start date and age|YYYY|mm|dd|df=yes/no}} -->
| genre = [[GIS file formats|GIS file format]]
| container_for =
| contained_by =
| extended_from = [[XML]]
| extended_to =
| standard = <!-- or: | standards = -->
| free =
| url =
}}
 
'''Keyhole Markup Language''' ('''KML''') is an [[XML]] notation for expressing geographic annotation and visualization within 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.<ref>{{cite web|url=http://www.opengeospatial.org/pressroom/pressreleases/857 |title=OGC® Approves KML as Open Standard |website=Open Geospatial Consortium |date=2008-04-14 |access-date=2018-11-20 |url-status=dead |archive-url=https://web.archive.org/web/20181130160455/http://www.opengeospatial.org/pressroom/pressreleases/857 |archive-date=Nov 30, 2018 }}</ref><ref>{{cite web|url=http://www.opengeospatial.org/standards/kml |title=KML |website=Open Geospatial Consortium |access-date=2018-11-20}}</ref> Google Earth was the first program able to view and graphically edit KML files, but KML support is now available in many [[Geographic information system|GIS]] software applications, such as [[Marble (software)|Marble]],<ref>{{cite web|url=http://marble.kde.org/kml-guide.php |title=KML Support in Marble |website=Marble |access-date=2018-11-20}}</ref> [[QGIS]],<ref>{{cite web|url=https://maps.cga.harvard.edu/qgis_2/wkshop/import_kml.php |title=Import from KML. QGIS 2.0 Workshop.}}</ref> and [[ArcGIS]].<ref>{{cite web|url=https://pro.arcgis.com/en/pro-app/latest/help/data/kml/kml-layers.htm |title=KML layers. ArcGIS Pro 3.4}}</ref>
Example KML document
 
== Structure ==
<nowiki>
The KML file specifies a set of features (place marks, images, polygons, 3D models, textual descriptions, etc.) that can be displayed on maps in [[Geographic information system|geospatial software]] implementing the KML encoding. Every place has a [[longitude]] and a [[latitude]]. Other data can make a view more specific, such as tilt, heading, or altitude, which together define a "camera view" along with a timestamp or timespan. KML shares some of the same structural grammar as [[Geography Markup Language]] (GML). Some KML information cannot be viewed in Google Maps or Mobile.<ref>{{cite web|title=KML content isn't available in Google Maps |url=https://support.google.com/maps/answer/41136?hl=en|archive-url=https://web.archive.org/web/20160426184815/https://support.google.com/maps/answer/41136?hl=en|website=Google Help |archive-date=2016-04-26|access-date=2020-01-26}}</ref>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Placemark>
<description>New York City</description>
<name>New York City</name>
<LookAt id="khLookAt539">
<longitude>-74.0063934326172</longitude>
<latitude>40.71417236328126</latitude>
<range>618.7009686335238</range>
<tilt>-4.812906559956015e-026</tilt>
<heading>-1.937595207549944e-014</heading>
</LookAt>
<Point>
<coordinates>-74.0063934326172,40.71417236328126,0</coordinates>
</Point>
</Placemark>
</kml>
</nowiki>
 
KML files are very often distributed as '''KMZ''' files, which are [[ZIP (file format)|zipped]] KML files with a .kmz extension. The contents of a KMZ file are a single root KML document and optionally any overlays, images, icons, and [[COLLADA]] 3D models referenced in the KML including network-linked KML files. The root KML document by convention is a file named "doc.kml" at the root directory level, which is the file loaded upon opening. By convention the root KML document is at root level and referenced files are in subdirectories (e.g. images for overlay).<ref>{{cite web|url=https://code.google.com/apis/kml/documentation/kmzarchives.html | access-date = 2009-12-16 | title = KMZ Files |work=Keyhole Markup Language |publisher=Google for Developers }}</ref>
 
An example KML document is:
==External links==
 
* [http://www.google.com/earth/sites/ Google Earth - Sightseeing(KMZ files)]
<syntaxhighlight lang="xml">
* [http://bbs.keyhole.com/boards/postlist/Board-SupportKML.html KML discussion forum]
<?xml version="1.0" encoding="UTF-8"?>
[[Category:XML standards]]
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name>New York City</name>
<description>New York City</description>
<Point>
<coordinates>-74.006393,40.714172,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
</syntaxhighlight>
 
The [[MIME type]] associated with KML is ''application/vnd.google-earth.kml+xml''; the MIME type associated with KMZ is ''application/vnd.google-earth.kmz''.
 
== Geodetic reference systems in KML ==
For its reference system, KML uses 3D geographic coordinates: longitude, latitude, and altitude, in that order, with negative values for west, south, and below mean sea level. The longitude/latitude components (decimal degrees) are as defined by the [[World Geodetic System|World Geodetic System of 1984 (WGS84)]]. Altitude, the vertical component, is measured in meters from the [[EGM96|WGS84 EGM96 Geoid vertical datum]]. If altitude is omitted from a coordinate string, e.g. (-77.03647, 38.89763) then the default value of 0 (approximately sea level) is assumed for the altitude component, i.e. (-77.03647, 38.89763, 0).
 
A formal definition of the coordinate reference system (encoded as GML) used by KML is contained in the OGC KML 2.2 Specification. This definition references well-known [[EPSG Geodetic Parameter Dataset|EPSG]] [[geographic coordinate system|CRS]] components.<ref>{{cite book|editor1-last=Wilson|editor1-first=Tim|title=OGC KML|date=2008-04-14|publisher=Open Geospatial Consortium, Inc.|page=14|url=http://portal.opengeospatial.org/files/?artifact_id=27810|access-date=9 June 2015}}</ref>
 
== OGC standard process ==
The KML 2.2 specification was submitted to the Open Geospatial Consortium to assure its status as an open standard for all [[Virtual globe|geobrowsers]]. In November 2007 a new KML 2.2 Standards Working Group was established within OGC to formalize KML 2.2 as an OGC standard. Comments were sought on the proposed standard until January 4, 2008,<ref>{{cite press release | title =The OGC Seeks Comment on OGC Candidate KML 2.2 Standard | publisher =Open Geospatial Consortium | date =2007-12-04 | url =http://www.opengeospatial.org/pressroom/pressreleases/802 | access-date =2007-12-10 }}</ref> and it became an official OGC standard on April 14, 2008.<ref>{{cite web | access-date = 2008-04-14 | url = http://www.news.com/8301-10784_3-9917421-7.html | title = Google mapping spec now an industry standard | publisher = [[CNET]] | date = 2008-04-14 | last = Shankland | first = Stephen | archive-date = 2008-05-12 | archive-url = https://web.archive.org/web/20080512011112/http://www.news.com/8301-10784_3-9917421-7.html | url-status = dead }}</ref>
 
The OGC KML Standards Working Group finished working on change requests to KML 2.2 and incorporated accepted changes into the KML 2.3 standard.<ref>{{cite web|access-date=2013-10-07|url=http://www.opengeospatial.org/projects/groups/kmlswg|title=OGC KML 2.3 SWG|publisher=OGC}}</ref>
The official OGC KML 2.3 standard was published on August 4, 2015.<ref>{{cite web|access-date=2015-08-04|url=http://docs.opengeospatial.org/is/12-007r2/12-007r2.html|title=OGC KML 2.3 Standard|date=4 August 2015|publisher=OGC}}</ref>
 
== See also ==
* [[ALOHAnet|Packet radio protocols]]
* [[Brian McClendon]]
* [[CityGML]]
* [[GeoJSON]]
* [[Geospatial content management system]]
* [[GPS eXchange Format]]
* [[CORONA (satellite)|Keyhole satellite series]]
* [[NASA WorldWind]]
* [[Point of interest]]
* [[SketchUp#File formats|SketchUp file formats]]
* [[The Blue Marble]]
* [[Waypoint]]
* [[Wikimapia]]
 
== References ==
{{Reflist}}
 
== External links ==
* [http://www.opengeospatial.org/standards/kml/ OGC KML 2.2 Standard]
* [http://schemas.opengis.net/kml/2.2.0/ OGC Official KML 2.2 Schema]
* [https://developers.google.com/kml/documentation/?csw=1 Google's KML Documentation]
 
{{OGC}}
{{Google LLC}}
{{Authority control}}
 
[[Category:Keyhole Markup Language| ]]
[[Category:Articles with example code]]
[[Category:GIS file formats]]
[[Category:Google]]
[[Category:Open formats]]
[[Category:Open Geospatial Consortium]]
[[Category:XML-based standards]]
[[Category:XML markup languages]]
[[Category:Data compression]]