From 80b6805bc08b1ae667093224d8db42da09dc0cdb Mon Sep 17 00:00:00 2001 From: Richard Wright Date: Sun, 3 Jun 2018 14:38:55 -0400 Subject: [PATCH 1/2] fix for node 8 execution --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71ae0b9..93cfbc8 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "nan": "^2.4.0", - "node-pre-gyp": "^0.5.19" + "node-pre-gyp": "^0.6.33" }, "devDependencies": { "tap": "~0.4.9", From 21d8ebe8fa644d591d52dd6552c053c2ee92ffa0 Mon Sep 17 00:00:00 2001 From: Richard Wright Date: Sun, 3 Jun 2018 14:39:20 -0400 Subject: [PATCH 2/2] create full GEOJson objects --- index.js | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index e32fab1..5362ca9 100644 --- a/index.js +++ b/index.js @@ -3,8 +3,12 @@ module.exports = s2; s2.S2LatLng.prototype.toGeoJSON = function() { return { - type: 'Point', - coordinates: [this.lng, this.lat] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [this.lng, this.lat] + }, + properties: {} }; }; @@ -15,12 +19,16 @@ s2.S2Cell.prototype.toGeoJSON = function() { } vs.push(new s2.S2LatLng(this.getVertex(0))); return { - type: 'Polygon', - coordinates: [ - vs.map(function(v) { - return [v.lng, v.lat]; - }) - ] + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [ + vs.map(function(v) { + return [v.lng, v.lat]; + }) + ] + }, + properties: {} }; }; @@ -31,14 +39,16 @@ s2.S2LatLngRect.prototype.toGeoJSON = function() { } vs.push(this.getVertex(0)); return { - type: 'Polygon', - coordinates: [ - [ + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [ vs.map(function(v) { return [v.lng, v.lat]; }) ] - ] + }, + properties: {} }; };