gatsby-transformer-kml

0.0.3 • Public • Published

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.

Package Sidebar

Install

npm i gatsby-transformer-kml

Weekly Downloads

4

Version

0.0.3

License

MIT

Unpacked Size

4.45 kB

Total Files

5

Last publish

Collaborators

  • charnz