This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

grunt-codepoint-open-transform

0.1.0 • Public • Published

grunt-codepoint-open-transform

Transforms the Ordnance Survey "Code-Point Open" data.

Getting Started

This plugin requires Grunt ~0.4.5

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-codepoint-open-transform --save-dev

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

grunt.loadNpmTasks('grunt-codepoint-open-transform');

The "codepoint_open_transform" task

Overview

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

grunt.initConfig({
    codepoint_open_transform: {
        options: {
            // Task-specific options go here.
        },
        your_target: {
            // Target-specific file lists and/or options go here.
        },
    },
});

Options

options.headers

Type: Number Default value: 1

Indicates which row of headers to use (object keys in JSON files)

options.latlng

Type: Boolean Default value false

Include Latitude & Longitude conversions in output.

options.minimal

Type: Boolean Default value: false

Include only minimal data in output.

options.whitespace

Type: Boolean Default value: true

Include whitespace in output to assist when reading the output files directly.

Output Formats

File format is determined by the destination file suffix.

JSON, Object of Arrays

Destinations ending in ooa.json will output JSON along the following form:

{
    "foo": [
        "foo 1",
        "foo 2",
        "foo 3"
    ],
    "bar": [
        "bar 1",
        "bar 2",
        "bar 3"
    ]
}

JSON, Array of Objects

Presently this output method will generate a file that appears valid, ** however, the output file will likely trigger memory constraints** ** due to the 1.47 million objects in the array.** Destinations ending in aoo.json will output JSON along the following form:

[
    {
        "foo": "foo 1",
        "bar": "bar 1"
    },
    {
        "foo": "foo 2",
        "bar": "bar 2"
    },
    {
        "foo": "foo 3",
        "bar": "bar 3"
    }
]

SQLite

Destinations ending in .sqlite will output SQLite databases.

SQL

Destinations ending in .sql will output SQL scripts.

Usage Example

grunt.initConfig({
    codepoint_open_transform: {
        default: {
            files: {
                'dist/codepoint-open-test.ooa.json': 'lib/codepo_gb.zip'
            }
        }
    },
});

Contributing

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

0.3.0

  1. SQL Support

0.2.0

  1. SQLite Support

0.1.0

  1. JSON Support

Dependencies (3)

Dev Dependencies (2)

Package Sidebar

Install

npm i grunt-codepoint-open-transform

Weekly Downloads

0

Version

0.1.0

License

none

Last publish

Collaborators

  • signpostmarv