Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ideal-postcodes/postcodesiocsv

A quick command line script to translate a CSV of postcodes
https://github.com/ideal-postcodes/postcodesiocsv

Last synced: 10 days ago
JSON representation

A quick command line script to translate a CSV of postcodes

Awesome Lists containing this project

README

        

# Postocodes.io CSV Translation

A quick command line script to translate a CSV of postcodes (with postcodes in first column) into a list of results retrieved from the Postcodes.io API

## Install

Since this is a command line script, you will need to install this globally

```
npm install postcodesiocsv -g
```

## Getting Started

```
postcodesiocsv -i -o
```

This will return postcode,longitude,latitude by default. Specify your own output schema with the `-s` flag with properties separated by a comma

```
postcodesiocsv -i -o -s postcode,country,northings,eastings
```

You can specify the column index for where your postcodes will be using the `-c` flag. Note, this is zero indexed, so `-c 1` represents the second column

```
postcodesiocsv -i -o -c 2
```

## Example

input.csv

```
CA7 3AJ
HP10 9AW
INVALID POSTCODE
PL17 7BW
```

Run with:
```
postcodesiocsv -i example.csv -o output.csv
```

output.csv
```
CA7 3AJ,-3.32567403434222,54.7646808638358
HP10 9AW,-0.711040381510592,51.5989108287906
INVALID POSTCODE,,
PL17 7BW,-4.31379882001634,50.5040671479147
```

## Changelog

1.0.3 Include flag to set postcode column

1.0.2 Initiate script from ./bin/

1.0.0 Initial commit