This package has been deprecated

Author message:

It was interesting while it was useful and needed. Things change

grunt-togeojson

4.0.0 • Public • Published

grunt-togeojson

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

Build Status Maintainability dependencies Status Built with Grunt

Getting Started

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

Please note that the minimum version of Node.js required is 10.13.0, which is the active Long Term Support (LTS) version, starting from the release 4.0.0 of this plugin.

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'

The default value ('auto') will determine the type based on the input file extension, namely checking if it is .gpx or not.

options.output

Type: String

Default value: 'geojson'

Possible values: 'geojson', 'topojson'

Using 'topojson' will disable options.compress.

options.compress

Type: Boolean

Default value: false

Possible values: true, false

Compress the resulting GeoJSON with Geobuf. Please note that TopoJSON is not supported to be compressed via Geobuf.

options.rename

Type: Function

Default value: null

Parameters: src (source file path), dest (destination file path), options.output

Returns: String

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

Contributing

"A Beginner's Guide to Open Source: The Best Advice for Making your First Contribution".

Also there is a blog post about "45 Github Issues Dos and Don’ts".

Linting is done with ESLint and can be executed with npm run lint. There should be no errors appearing after any JavaScript file changes.

Release History

  • v4.0.0 (2020-05-28)
    • Minimum Node.js version lifted from 8.11.1 to 10.13.0
    • Dependencies updated of course 🎩
    • Run tests with versions 10, 12, and 14 of Node.js at Travis CI
  • v3.0.0 (2018-11-10)
    • TopoJSON behaves differently, check your output after updating to this release
    • Add options.rename #9
    • Several API changes in the updated dependencies have been migrated, such as JSDOM
    • Minimum Node.js version lifted from 4.2.0 to 8.11.1
    • main property in package.json was pointing to a wrong file
    • Migrated from deprecated togeojson to @mapbox/togeojson, which was merely a package name change
  • v2.2.0 (2016-08-10)
    • Dependencies are sure 🎩 up to date
    • Use shared ESLint configuration and ESLint directly without the Grunt.js plugin
  • v2.1.0 (2016-04-05)
    • Update dependencies and remove grunt-cli from devDependencies as it is in grunt now
  • v2.0.1 (2016-02-22)
    • Grunt.js 1.0.0 is coming out soon, so its use has been tested
    • Dependencies updated
  • v2.0.0 (2015-10-28)
    • Upgraded to jsdom v7, which means to force using Node.js 4.2.0 (LTS)
  • v1.1.0 (2015-05-05)
    • Remove Geobuf/TopoJSON combination since it is not supported
  • v1.0.0 (2015-01-27)
    • Conversion to TopoJSON and Geobuf added
  • v0.1.0 (2013-09-30)
    • Initial release

License

Copyright (c) Juga Paazmaya paazmaya@yahoo.com

Licensed under the MIT license.

Package Sidebar

Install

npm i grunt-togeojson

Weekly Downloads

3

Version

4.0.0

License

MIT

Unpacked Size

10.1 kB

Total Files

4

Last publish

Collaborators

  • paazmaya