Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub


Parses KML files into GeoJSON objects. GeoJSON Feature objects are converted into individual nodes


npm install gatsby-transformer-kml --save

How to use

Ensure you have gatsby-source-filesystem installed

npm install gatsby-source-filesystem

Configure your gatsby-config.js to point to the directory where your .kml files can be found

// In your gatsby-config.js
module.exports = {
  plugins: [
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/src/kml/`,

How to query

GeoJSON nodes will be of types KmlPoint, KmlLineString, KmlPolygon, KmlMultiPoint, KmlMultiLineString, and KmlMultiPolygon.

You can query the resulting GeoJSON nodes like the following

  allKmlPoint {
    edges {
      node {
        properties {


Only files with valid MIME type of application/vnd.google-earth.kml+xml are supported. Other media types will be ignored by the plugin. kmz is not supported

Currently only data that can be parsed to GeoJSON format is supported. Other KML features such as overlays are not yet implemented.

© 2023 Gatsby, Inc.