GEODETIC DATUM: WGS84 · CLIENT-SIDE PRECISION · NO SIGN-UP
Open Map Lab

KML Viewer & Google Earth Map Inspector

Upload and inspect Google Earth KML files in your browser. Parses Placemarks, LineStrings, and Polygons onto interactive MapLibre vector maps without installing Google Earth.

By ·Updated Runs in your browser
GIS Vector Inspector
Ready to Locate· Awaiting input

KML File Inspector & Map Viewer

Paste or upload a KML file to render spatial geometries.

Format:

How to use the KML viewer

  1. 1Open a KML file

    Drop or choose a .kml file, for example one exported from Google Earth.

  2. 2Render the placemarks

    Placemarks, lines and polygons are drawn on the map in your browser.

  3. 3Read feature details

    Click a feature to see its name and description.

What Is a KML File?

Originally created in 2001 by Keyhole, Inc. (under the name Keyhole Markup Language) for its pioneering Earth Viewer software, KML became a global cartographic phenomenon following Google's acquisition of Keyhole in 2004 and the launch of Google Earth.

In April 2008, KML 2.2 was officially adopted as an international open consensus standard by the Open Geospatial Consortium (OGC). Unlike flat two-dimensional vector formats, KML was purpose-built from its inception to express three-dimensional geospatial visualization:

  • XML Grammar: Structured as an XML schema declaring spatial features, user-facing rich text popup balloons, camera viewpoints, and temporal spans.
  • Coordinate Triplets: KML coordinate strings are formatted as longitude,latitude,altitude separated by commas (with spaces delimiting sequential points in lines and polygons).
  • Styling Encapsulation: Unlike pure GeoJSON (which separates data from presentation), KML bundles visual styles (icon URLs, fill colors, line weights) directly within the file structure.

What Is a KMZ File and How Is It Opened?

A KMZ file is not a distinct file format; it is a standard compressed PKZIP archive containing a KML document and its associated binary multimedia assets:

The doc.kml Root File

Per the OGC standard, a KMZ archive must contain exactly one root KML file named doc.kml located in the root directory (or referenced as the primary payload). Web-based KMZ viewers utilize client-side WebAssembly ZIP libraries to decompress the archive in browser RAM without uploading files to third-party servers.

Bundled Local Assets

KMZ packages bundle custom pin icons (files/marker.png), ground overlay satellite GeoTIFFs, 3D building models (COLLADA .dae files), and embedded photographs, resolving relative paths internally.

KML Altitude Modes and 3D Features

KML achieves its distinctive 3D capability through specialized altitude and extrusion directives:

  • clampToGround: The default mode. Ignores any altitude coordinate value, draping polygons, lines, and placemark icons directly over the Earth's digital elevation model (DEM) terrain.
  • relativeToGround: Measures altitude in meters above the local terrain surface. Essential for flight paths, drone telemetry, and overhead transmission lines.
  • absolute: Measures altitude in meters above the WGS 84 vertical sea level ellipsoid or geoid (EGM96), matching commercial aviation barometric and satellite altitudes.
  • Extrusion (<extrude>1</extrude>): Extends vertical walls downward from elevated polygons or lines to touch the Earth's surface, transforming 2D boundary outlines into 3D architectural prisms.

How Lines Between Points Are Drawn (Great Circle Calculation)

When KML polylines cross thousands of kilometers (such as transoceanic flight routes), rendering a straight line in Web Mercator introduces severe planar distortion. GIS engines interpolate intermediate geodesic waypoints using spherical slerp (spherical linear interpolation):

GOVERNING MATHEMATICAL EQUATIONA = \frac{\sin((1-f)\delta)}{\sin(\delta)}, \quad B = \frac{\sin(f\delta)}{\sin(\delta)}, \quad \begin{cases} x = A\cos\phi_1\cos\lambda_1 + B\cos\phi_2\cos\lambda_2 \\ y = A\cos\phi_1\sin\lambda_1 + B\cos\phi_2\sin\lambda_2 \\ z = A\sin\phi_1 + B\sin\phi_2 \end{cases}
VARIABLE DEFINITIONS & CONSTANTS
f:Fraction along great-circle arc (0.0 at start, 0.5 at midpoint, 1.0 at destination)
δ (delta):Angular central distance between origin and destination (radians)
φ1, λ1:Latitude and longitude of origin point (radians)
φ2, λ2:Latitude and longitude of destination point (radians)
WORKED BENCHMARK: MIDPOINT (F = 0.5) ALONG TRANSATLANTIC FLIGHT ROUTE: NEW YORK (JFK) TO LONDON (LHR)
JFK Coordinates (P1) = Lat: 40.64° N (0.7093 rad), Lon: -73.78° W (-1.2877 rad)LHR Coordinates (P2) = Lat: 51.47° N (0.8983 rad), Lon: -0.45° W (-0.0079 rad)Angular Central Distance (δ) = 0.8715 radians (~5,554 km / 50.0 degrees)Interpolation Fraction (f) = 0.50 (exact geographic midpoint)
  1. Angular factors: sin(0.8715 rad) = 0.7653
  2. Interpolation weights: A = sin(0.5 * 0.8715) / 0.7653 = sin(0.43575) / 0.7653 = 0.4221 / 0.7653 = 0.5515
  3. Weight B (symmetric at midpoint): B = A = 0.5515
  4. Cartesian Conversion P1: x1 = cos(0.7093)*cos(-1.2877) = 0.2117, y1 = -0.7289, z1 = 0.6513
  5. Cartesian Conversion P2: x2 = cos(0.8983)*cos(-0.0079) = 0.6229, y2 = -0.0049, z2 = 0.7823
  6. Interpolated Cartesian vector: x_mid = 0.5515*(0.2117 + 0.6229) = 0.4603, y_mid = -0.4047, z_mid = 0.7907
  7. Reconverting to Latitude: phi_mid = atan2(0.7907, sqrt(0.4603^2 + (-0.4047)^2)) = atan2(0.7907, 0.6129) = 0.9113 rad = 52.21° N
  8. Reconverting to Longitude: lambda_mid = atan2(-0.4047, 0.4603) = -0.7212 rad = -41.32° W
Computed Result:Geodesic Midpoint = 52.21° N, 41.32° W (Mid-North Atlantic, South of Greenland)

The true great-circle arc peaks significantly north (52.2° N) of both New York and London, saving over 450 km of flight distance compared to a flat Mercator line.

KML Elements Reference (Table)

Consult this comprehensive reference mapping KML elements to web GIS rendering pipelines:

OGC KML 2.2 XML Schema Elements & Web GIS Compatibility

Evaluation of core XML tags, structural containment, cartographic functions, and modern browser translation.

KML XML TagSchema HierarchyCartographic FunctionWeb GIS EquivalentCompatibility Caveat
<Placemark><Document> or <Folder>Primary geographic entity binding geometry, description HTML, and styleGeoJSON Feature objectRequires child geometry (<Point>, <LineString>, or <Polygon>)
<LookAt> / <Camera><Placemark> or top-levelDefines virtual camera position, tilt, roll, altitude, and rangeMapLibre / Leaflet setView / flyTo stateIgnored by flat 2D map viewports without 3D camera support
<Style> & <StyleMap><Document>Specifies icon textures, stroke colors, fill opacity, and hover statesCSS / Vector tile style layer specificationKML uses aabbggrr hex color order, not standard web #rrggbbaa
<GroundOverlay><Folder> or <Document>Drapes a georeferenced raster image over a specified latitude/longitude boxL.imageOverlay or MapLibre raster sourceRotation angles other than 0° require complex canvas warping
<NetworkLink><Document>Dynamic URL reference that polls or streams updated KML from a remote serverGeoJSON vector tile URL / dynamic fetchBlocked by browser CORS security policies unless proxied
<gx:Track><Placemark> (Google Earth Extension)Time-series spatial trajectory combining timestamps and 3D coordinatesGPX Track (<trk>) with elevation & timeRequires Google Earth extension XML namespace (xmlns:gx)

KML Viewer Limits: Network Links and Cross-Site Files

When reading KML files in modern browser environments, engineers routinely encounter several technical hurdles:

  • The KML Color Hex Inversion Trap (AABBGGRR): KML does not use standard HTML hexadecimal colors (#RRGGBBAA). Instead, it encodes colors in reverse byte order as Alpha-Blue-Green-Red (aabbggrr). For example, solid pure red is ff0000ff (alpha=ff, blue=00, green=00, red=ff). Forgetting this inversion turns red lines bright blue.
  • Cross-Origin Resource Sharing (CORS): KML files referencing remote icons or <NetworkLink> endpoints across different domains will be blocked by browser security unless the destination server emits Access-Control-Allow-Origin: * headers.
  • Google Earth Extensions (gx:): Advanced features like animations (gx:Tour) and tracks (gx:Track) require declaring the xmlns:gx="http://www.google.com/kml/ext/2.2" XML namespace, otherwise standard XML parsers fail validation.
KML / KMZ Rendering Constraints
  • KML coordinates must strictly be formatted as longitude,latitude,altitude (with no spaces between coordinate numbers and separating commas).
  • 3D COLLADA (.dae) building models embedded within KMZ files cannot be rendered on 2D Leaflet map views without dedicated Three.js / Cesium WebGL pipelines.
  • Password-protected or encrypted ZIP archives cannot be extracted by standard browser KMZ readers.

Related GIS & File Conversion Tools

Convert and cross-examine spatial layers across our format inspection tools:

Quick facts about the KML viewer

FactValueNotes
File StandardOGC KML 2.2 StandardKeyhole Markup Language XML
Supported GeometriesPlacemarks & LineStringsParses coordinate tags and descriptions
PrivacyLocal XML DOM ParsingNo files transmitted to external servers
PRECISION & EXCEPTIONS

Edge cases and exceptions

KMZ Compressed Archives

KMZ files are zip archives containing a doc.kml file. For best results, extract the .kml file before pasting or uploading.

FIELD APPLICATIONS

The KML viewer: worked examples

1

Google Earth Trail Inspection

Scenario: Visualizing a scenic mountain trail exported from Google Earth.

Outcome: Extracts all placemarks and path waypoints, rendering the complete trail on modern map tiles.

FREQUENTLY ASKED QUESTIONS

Frequently asked questions about the KML viewer

What is a KML file?

KML (Keyhole Markup Language) is an XML-based file format used to display geographic data in applications like Google Earth and GIS software.

What is the difference between KML and KMZ?

KMZ is a zipped KML file that can bundle icons and images.

Does the viewer support KMZ?

Many KMZ files can be opened by unzipping the doc.kml inside. Open the KML directly if the KMZ does not load.

What can a KML file contain?

Placemarks, lines, polygons, styles, folders and sometimes 3D features and tours. This viewer displays points, lines and polygons.

Why do KML colors look wrong?

KML stores color as AABBGGRR, which is reverse of web color order, and some viewers convert it differently.

Is my file uploaded?

No. The file is read locally in your browser and is not sent to any server. Closing or refreshing the page discards it.

How do I export from Google Earth?

Right-click a folder or place in Google Earth, choose Save Place As, and select KML.

Can I convert KML to GeoJSON?

Use the file converters in GIS tools. This viewer is for inspecting KML.

What coordinates does KML use?

Longitude, latitude, altitude in decimal degrees on WGS84.

How big can the file be?

Several megabytes load fine. Very large files may slow the page.

Keep exploring

Data & Cartographic Authority: OGC KML 2.2 · Calculated in your browser from the data you enter

Written and maintained by . Content updated October 30, 2026; data last verified September 19, 2026. See our editorial policy, methodology, or report an error.