Free KML sample files
The XML format of Google Earth for placemarks, paths and polygons. Download valid KML test files in 4 exact sizes, from 1 KB to 1 MB, each with a checksum.
- Extension
- .kml
- MIME type
- application/vnd.google-earth.kml+xml
- Kind
- Text
- Category
- GIS
KML files by size
Every file below is a valid Keyhole Markup Language file of exactly the stated size. Open a file's page for its checksum and contents, and to preview it in your browser before downloading.
| File | Size | Contents | Download |
|---|---|---|---|
| 1 KB KML samplesample-kml-1kb.kml | 1 KB1,024 bytes | Placemarks: 2 | Download KML |
| 10 KB KML samplesample-kml-10kb.kml | 10 KB10,240 bytes | Placemarks: 39 | Download KML |
| 100 KB KML samplesample-kml-100kb.kml | 100 KB102,400 bytes | Placemarks: 401 | Download KML |
| 1 MB KML samplesample-kml-1mb.kml | 1 MB1,048,576 bytes | Placemarks: 4,087 | Download KML |
What is a KML file?
KML describes things to draw on a map or a globe: placemarks with a name and a description, paths, polygons, image overlays and the styles used to render them. It began at Keyhole, the company whose viewer became Google Earth, and has been an Open Geospatial Consortium standard since 2008.
A KML file is ordinary XML. Coordinates are written as longitude, latitude and an optional altitude, separated by commas, with a space between one position and the next. A .kmz file is a ZIP archive containing a KML file and any images it uses.
How to recognise a KML file
KML files have no file signature, the magic bytes that most binary formats begin with.
No signature bytes. KML files are identified by parsing their content.
| Extension | .kml |
|---|---|
| MIME type | application/vnd.google-earth.kml+xml |
| Standard | OGC KML 2.2 and 2.3 |
| Root element | <kml> in the namespace http://www.opengis.net/kml/2.2 |
| Coordinate order | Longitude, latitude, altitude |
| Reference system | WGS 84 |
What to test for
These are the behaviours that most often go wrong when software handles KML files.
- Longitude comes first. Reading the pair the other way round moves every point to a different part of the world.
- Inside a position, a space after a comma is an error: the space is what separates one position from the next. Hand-edited files often break this rule.
- KML can pull in remote content through network links and icon URLs. An importer should not fetch them blindly. The samples here refer to nothing outside the file.
Strengths of KML
- Carries styling as well as geometry: icons, colours and line widths.
- Opens directly in Google Earth and most GIS software.
Limitations of KML
- Verbose XML that grows quickly with the number of features.
- Attributes are free-form descriptions unless extended data is used, so they are awkward to query.
Typical uses of KML test files
- Testing map imports and layer rendering
- Checking conversion between KML, GPX and GeoJSON
- Verifying coordinate-order handling
- Load-testing viewers with thousands of placemarks
Software that opens KML
- Google Earth and Google My Maps
- QGIS and ArcGIS
- GDAL and ogr2ogr
- OpenLayers and Leaflet, through plug-ins
Specifications
Related
KML sample files: questions
- What do the KML samples contain?
- Placemarks near sixteen real cities on six continents: mostly points, with a path and a polygon in every ten, and two shared styles.
- Is there a KMZ sample?
- Not at present. A KMZ file is a ZIP archive with a KML file inside, so you can make one by zipping any sample and renaming the result.
- What is the MIME type of a KML file?
- The MIME type is application/vnd.google-earth.kml+xml. The file extension is .kml.
- Is a sample KML file the same as a dummy or example KML file?
- Yes. Sample, test, dummy and example KML files are different names for the same thing: a KML file with known contents that stands in for a real one. Any file on this page will do wherever a tutorial or a test plan asks for a dummy KML file.