Parses KML files into GeoJSON objects. GeoJSON Feature
objects are converted into individual nodes
npm install gatsby-transformer-kml --save
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/`,
},
},
],
};
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
}
}
}
}
}
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.