tilelive-csvin

0.2.11 • Public • Published

BuildStatus

tilelive-csvin

A tilelive provider for CSV inputs that supports streaming reads.

Usage

This example requires @mojodna's fork of mbtiles for createWriteStream().

"use strict";
 
var MBTiles = require("mbtiles"),
    tilelive = require("tilelive");
 
var CSV = require("tilelive-csv")(tilelive);
 
new CSV("csvin+file://./data.csv?delimiter=\t&encoding=base64", function(err, src) {
  new MBTiles("mbtiles://./tiles.mbtiles", function(err, sink) {
    src.createReadStream().pipe(sink.createWriteStream());
  });
});

Options

The following query parameters are recognized:

  • delimiter - Column delimiter. Defaults to ,.
  • encoding - Option source encoding. Defaults to null. Other valid values: base64.
  • columnIndex - 0-based index for the column containing data. Defaults to 1.

Supported Protocols

This provider understands the file: (e.g. csvin+file://./stuff.csv) and stdin: protocols.

Why?

CSV is a popular format with the Big Data set.

Streaming

For sparsely filled or unknown bounding boxes, iterating over a known list of tiles is more efficient than using a tilelive Scheme.

getInfo()?

That's not implemented. You'll want to fake it by generating your own TileJSON separately. Perhaps one could be provided as a query parameter? (Patches welcomed!)

Base64 Encoding?

CSV is a text-based format, after all.

Writing?

Nope. Why?

Random Access (getTile())?

Nope.

Readme

Keywords

none

Package Sidebar

Install

npm i tilelive-csvin

Weekly Downloads

2

Version

0.2.11

License

ISC

Last publish

Collaborators

  • mojodna