Skip to content

Grunt task for converting KML and GPX files to GeoJSON and TopoJSON

License

Notifications You must be signed in to change notification settings

Tim-Intellipharm/grunt-togeojson

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grunt-togeojson

Grunt task for converting KML and GPX files to GeoJSON and TopoJSON

Build Status Code Climate Dependency Status Built with Grunt Analytics

Getting Started

This plugin uses Grunt, toGeoJSON, TopoJSON, Geobuf, and jsdom.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-togeojson --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-togeojson');

The "togeojson" task

Overview

In your project's Gruntfile, add a section named togeojson to the data object passed into grunt.initConfig().

Configure the files list as described in the multi task section of the Grunt documentation.

grunt.initConfig({
  togeojson: {
    maps: {
      files: {
        // Target-specific file lists and/or options go here.
      }
    }
  }
})

Options

Conversion will use the same basename of the source file for the destination file.

options.input

Type: String

Default value: 'auto'

Possible values: 'auto', 'kml', 'gpx'

options.output

Type: String

Default value: 'geojson'

Possible values: 'geojson', 'topojson'

options.compress

Type: Boolean

Default value: false

Possible values: true, false

Compress the resulting GeoJSON or TopoJSON with Geobuf.

options.rename

Type: Function

Parameters: source, destination, output format

Returns: String

The function should return a string of the new destination path for the file

Contributing

Please refer to a GitHub blog post on how to create somewhat perfect pull request.

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 2015-01-27 v1.0.0 Conversion to TopoJSON and Geobuf added
  • 2013-09-30 v0.1.0 Initial release

License

Copyright (c) Juga Paazmaya [email protected]

Licensed under the MIT license.

About

Grunt task for converting KML and GPX files to GeoJSON and TopoJSON

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%