From 3fe276c199f9c160ed6eb8ac9d590e32e9298b45 Mon Sep 17 00:00:00 2001 From: Contra Date: Thu, 30 Jun 2016 16:21:04 -0400 Subject: [PATCH] add epsg info metadata to features --- dist/index.js | 12 +++++++++++- package.json | 2 +- src/index.js | 12 +++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9f162e1..667f32d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -86,6 +86,16 @@ function processFilePath(context, file, cb) { cb = (0, _once2.default)(cb); var ftp = context.ftp; + var onBoundary = function onBoundary(doc, done) { + // workaround for missing crs info + doc.crs = { + type: 'name', + properties: { + name: 'EPSG:4326' + } + }; + context.onBoundary(file.type, doc, done); + }; ftp.get(file.path, function (err, stream) { if (err) return cb(err); @@ -102,7 +112,7 @@ function processFilePath(context, file, cb) { srcStream.once('end', function () { var docs = JSON.parse(_buffer.Buffer.concat(chunks)).features; debug(' -- ' + _chalk2.default.cyan('Parsed ' + file.path + ', inserting ' + docs.length + ' boundaries now...')); - _async2.default.forEach(docs, _async2.default.ensureAsync(context.onBoundary.bind(null, file.type)), cb); + _async2.default.forEach(docs, _async2.default.ensureAsync(onBoundary), cb); }); stream.resume(); diff --git a/package.json b/package.json index ecd845e..e22f6af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "census-boundaries", - "version": "1.0.4", + "version": "1.0.5", "description": "Downloads and converts US Census TIGER data representing all boundaries in the United States", "main": "dist/index.js", "keywords": [ diff --git a/src/index.js b/src/index.js index 5305509..19d3d6a 100644 --- a/src/index.js +++ b/src/index.js @@ -47,6 +47,16 @@ function processObject(context, object, cb) { function processFilePath(context, file, cb) { cb = once(cb) const { ftp } = context + const onBoundary = (doc, done) => { + // workaround for missing crs info + doc.crs = { + type: 'name', + properties: { + name: 'EPSG:4326' + } + } + context.onBoundary(file.type, doc, done) + } ftp.get(file.path, (err, stream) => { if (err) return cb(err) @@ -61,7 +71,7 @@ function processFilePath(context, file, cb) { srcStream.once('end', () => { const docs = JSON.parse(Buffer.concat(chunks)).features debug(` -- ${chalk.cyan(`Parsed ${file.path}, inserting ${docs.length} boundaries now...`)}`) - async.forEach(docs, async.ensureAsync(context.onBoundary.bind(null, file.type)), cb) + async.forEach(docs, async.ensureAsync(onBoundary), cb) }) stream.resume()