geocoding-example/batch_node/README.md at master · mapbox/geocoding-example · GitHub
Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Latest commit

 

History

History
34 lines (24 loc) · 844 Bytes

File metadata and controls

34 lines (24 loc) · 844 Bytes

Node.js - Mapbox Batch Geocoder

mapbox_batch.js reads queries from an input text file, one per line, and constructs parallelized batch queries.

Results are stored in an output directory as JSON files.

Requirements

Installation

npm install

Usage

Command line:

MapboxAccessToken=YOUR_ACCESS_TOKEN node mapbox-batch.js input_file.txt /path/to/output/directory

Programmatic:

var fs = require('fs'),
    mapbox = require('./mapbox-batch.js');

var geocoder = mapbox('YOUR_ACCESS_TOKEN');
geocoder.on('data', function(data) {
    console.log(data);
});
fs.createReadStream('/path/to/source/data.txt').pipe(geocoder);