Skip to content

charnz/gatsby-transformer-kml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gatsby-transformer-kml

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

Install

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: [
    `gatsby-transformer-kml`,
    {
      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 {
          name
        }
      }
    }
  }
}

Notes

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.

About

Parses KML files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published