Test files › Geospatial › placemarks.kml

Sample KML file (placemarks)

A KML document with a Placemark point, a LineString path and a styled polygon.

↓ Download placemarks.kml
Filenameplacemarks.kml
FormatKML
Size508 bytes (508 bytes)
MIME typeapplication/vnd.google-earth.kml+xml
SHA-256ec08fd9db64a893d4c7a2274d48d0cfe08272f35534465791221683f676221ff
What this file catchesGoogle Earth / Maps import and any KML parser. Includes a <Style> block, so it catches readers that render geometry but silently drop styling.

Handle it in code

Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.

Python

GPX stores lat and lon as attributes; KML writes "lon,lat,alt" text, the opposite order. Read each in its own order and validate the ranges, or points end up swapped across the globe.

import xml.etree.ElementTree as ET

points = []  # (lat, lon)
for el in ET.parse("placemarks.kml").getroot().iter():
    tag = el.tag.rsplit("}", 1)[-1]
    if tag in ("trkpt", "rtept", "wpt"):  # GPX
        points.append((float(el.get("lat")), float(el.get("lon"))))
    elif tag == "coordinates":  # KML: lon,lat[,alt] tuples
        for t in el.text.split():
            lon, lat = map(float, t.split(",")[:2])
            points.append((lat, lon))
bad = [p for p in points if not (-90 <= p[0] <= 90 and -180 <= p[1] <= 180)]
print(f"{len(points)} points, first at lat {points[0][0]}, lon {points[0][1]}")
print(f"{len(bad)} out of range" if bad else "all within range")

Run against this file, it prints: 4 points, first at lat 51.5072, lon -0.1276 all within range

Related guides and tools

Sample GeoJSON, GPX and KML filesMIME typesVerify its SHA-256

Download & verify

curl -fsSL -o "placemarks.kml" "https://files.hexaqa.com/geo/placemarks.kml"
curl -fsSL "https://files.hexaqa.com/geo/placemarks.kml" | sha256sum # expect: ec08fd9db64a893d4c7a2274d48d0cfe08272f35534465791221683f676221ff

More geospatial test files

antimeridian.geojsonmalformed-coords.geojsonpoints.geojsontrack.gpx

← All Geospatial files