A Comprehensive Guide to Keyhole Markup Language

Author

Reads 2.5K

Hand with Loop Looking at Map with Pins
Credit: pexels.com, Hand with Loop Looking at Map with Pins

Keyhole Markup Language (KML) is a simple, straightforward way to add geographic information to your website or application. It's an XML-based language that allows you to describe the location and appearance of features on a map.

KML has been around since 2004, when it was first introduced by Google. This was a game-changer for mapping and geospatial data, as it made it easy to create and share interactive maps.

One of the key benefits of KML is its ability to store and display large amounts of geographic data, such as points, lines, and polygons. This makes it a popular choice for applications that require detailed mapping, such as navigation systems and real estate websites.

KML files are typically used to display information on Google Earth and Google Maps, but they can also be used with other mapping platforms and applications.

Key Features

KML is an XML language that allows for geographic annotation and visualization within maps and Earth browsers. It's used to provide a presentation of graphical data on the globe and control the user's navigation.

Suggestion: Nexus S

Credit: youtube.com, How Does KML (Keyhole Markup Language) Work In GIS? - CountyOffice.org

KML is complementary to other standards like GML, WFS, and WMS, and it uses certain geometry elements derived from GML 2.1.2. These elements include point, line string, linear ring, and polygon.

The KML community is diverse, with users ranging from casual users who create placemarks to identify their homes, to scientists who use KML to provide detailed mappings of resources and trends.

Overview

KML is an XML language that's all about geographic visualization, including annotation of maps and images. It's used to control the user's navigation in 2D and 3D maps and earth browsers.

KML has been adopted as an OGC implementation standard, with version 2.2 being the current standard. This means it's been reviewed and agreed upon by the Open Geospatial Consortium (OGC) and Google.

There are four main objectives for KML's standards work: to have one international standard language for geographic annotation, to align with international best practices and standards, to engage the KML community in the process, and to ensure proper life-cycle management of the standard.

Expand your knowledge: Google Fi International Data Speed

Detailed close-up of a metallic door knob and keyhole on a textured wooden door with natural light.
Credit: pexels.com, Detailed close-up of a metallic door knob and keyhole on a textured wooden door with natural light.

KML is complementary to other key standards like GML, WFS, and WMS. It uses certain geometry elements derived from GML 2.1.2, including point, line string, linear ring, and polygon.

The KML community is diverse, with users ranging from casual users who create placemarks to identify their homes, to scientists who use KML to provide detailed mappings of resources and trends.

File Formats

KML files are used to encode and transport geographic data for display in an earth browser, using a tag-based structure with nested elements, names, and attributes.

A KML file specifies a set of features for display in any 3D Earth browser, including placemarks, images, polygons, 3D models, textual descriptions, and more.

The KML file format is similar to HTML, with a focus on geographic data. It uses 3D geographic coordinates, with longitude, latitude, and altitude components.

KML files are often distributed in KMZ files, which are zipped files with a “.kmz” extension. These files must be legacy (ZIP 2.0) compression compatible.

Here are the MIME types for KML and KMZ files:

Model Files and Schemas

Close-up of a textured metal door with a keyhole and handle, showcasing intricate patterns.
Credit: pexels.com, Close-up of a textured metal door with a keyhole and handle, showcasing intricate patterns.

Model files and schemas are crucial for working with KML, a widely used format for geographic data. You can find official model files and encoding schemas at http://schemas.opengis.net/kml/.

These schemas are available for download in a single zip file, making it easy to access all the necessary files at once.

The Open Geospatial Consortium (OGC) provides a public page for the KML 2.2 SWG group, which is responsible for addressing future changes to the standard. You can find this page at http://www.opengeospatial.org/projects/groups/kml2.2swg.

If you have any suggestions or comments about the standard, you can submit a change request, requirement, or comment on the OGC's public page.

Curious to learn more? Check out: How to Find Google Accounts

3 Mime Types

For Google Earth to correctly interpret responses, a KML server must return a response code of HTTP 200 and set the content-type to a suitable MIME type.

There are three MIME types that Google Earth reads: application/vnd.google-earth.kml+xml for KML files, application/vnd.google-earth.kmz for KMZ files, and two AddType directives to set these MIME types for .kml and .kmz file extensions respectively.

The MIME type for KML files is application/vnd.google-earth.kml+xml, while the MIME type for KMZ files is application/vnd.google-earth.kmz.

Here are the MIME types and their corresponding file extensions:

If the server returns invalid KML, the Network Link will stop, deactivate, and output an error message.

Unsupported Elements

Credit: youtube.com, Keyhole Markup Language

When working with KML files, it's essential to know what elements are supported and which ones are not. KML files can include elements that are not supported in ArcGIS Pro.

Unsupported elements in KML files include description snippets. These are essentially extra details that provide more information about a particular feature on the map.

If your KML file contains photo overlays, sky data, tours, or tracks, don't expect them to appear in the map or scene display. They will still be listed in the Contents pane, but they won't be visible.

Here's a list of unsupported elements in KML files:

  • Description snippets
  • Photo overlays
  • Sky data
  • Tours
  • Tracks

Geodetic Reference Systems

KML uses 3D geographic coordinates: longitude, latitude, and altitude, in that order.

The longitude/latitude components are defined by the World Geodetic System of 1984 (WGS84).

Altitude is measured in meters from the WGS84 EGM96 Geoid vertical datum.

If altitude is omitted from a coordinate string, a default value of 0 (approximately sea level) is assumed.

A formal definition of the coordinate reference system used by KML is contained in the OGC KML 2.2 Specification.

This definition references well-known EPSGCRS components.

Broaden your view: Google File System

Wm Kling

Lead Writer

Wm Kling is a seasoned writer with a passion for technology and innovation. With a strong background in software development, Wm brings a unique perspective to his writing, making complex topics accessible to a wide range of readers. Wm's expertise spans the realm of Visual Studio web development, where he has written in-depth articles and guides to help developers navigate the latest tools and technologies.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.