Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Geobuf encoding #17

Merged
merged 2 commits into from

1 participant

Tom MacWright
Tom MacWright tmcw merged commit 2a54772 into from
Tom MacWright tmcw deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 16, 2014
  1. Tom MacWright

    Geobuf encoding

    tmcw authored
  2. Tom MacWright

    Bump dyno

    tmcw authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 5 deletions.
  1. +3 −3 index.js
  2. +3 −2 package.json
6 index.js
View
@@ -5,6 +5,7 @@ var s2 = require('s2'),
concat = require('concat-stream'),
geojsonCover = require('./lib/geojsoncover'),
uniq = require('uniq'),
+ geobuf = require('geobuf'),
log = require('debug')('cardboard'),
queue = require('queue-async');
@@ -22,7 +23,6 @@ function Cardboard(db) {
Cardboard.prototype.insert = function(primary, feature, cb) {
var indexes = geojsonCover.geometry(feature.geometry),
- featureStr = JSON.stringify(feature),
db = this.db;
log('indexing ' + primary + ' with ' + indexes.length + ' indexes');
@@ -31,7 +31,7 @@ Cardboard.prototype.insert = function(primary, feature, cb) {
q.defer(db.putItem, {
id: 'cell!' + index + '!' + primary,
layer: 'default',
- val: featureStr
+ val: geobuf.featureToGeobuf(feature).toBuffer()
});
});
q.awaitAll(function(err, res) {
@@ -83,7 +83,7 @@ Cardboard.prototype.dumpGeoJSON = function(callback) {
Cardboard.prototype.export = function(_) {
return this.db.createReadStream()
.pipe(through({ objectMode: true }, function(data, enc, cb) {
- this.push(JSON.parse(data.value));
+ this.push(geobuf.geobufToFeature(data.value));
cb();
}))
.pipe(geojsonStream.stringify());
5 package.json
View
@@ -27,7 +27,7 @@
"dependencies": {
"JSONStream": "~0.7.3",
"concat-stream": "~1.4.5",
- "dyno": "0.0.2",
+ "dyno": "0.1.0",
"geojson-extent": "0.0.1",
"geojson-normalize": "0.0.0",
"geojson-stream": "0.0.0",
@@ -38,7 +38,8 @@
"through2": "~0.4.1",
"uniq": "~1.0.0",
"debug": "~1.0.3",
- "rw": "~0.1.1"
+ "rw": "~0.1.1",
+ "geobuf": "~0.1.0"
},
"devDependencies": {
"dynalite": "~0.3.6",
Something went wrong with that request. Please try again.