Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "eslint-config-unstyled"
}
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ language: node_js
sudo: false
node_js:
- "0.10"
before_install:
- npm install -g npm@~1.4.6
- "0.12"
- "4.1"
script:
- npm install
- npm test
- npm run cov
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## vector-tile-js changelog

### 1.2.0 (2015-12-10)

- Added "id" property to toGeoJSON() output

### 1.1.3 (2015-06-15)

- Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90
Expand Down
8 changes: 7 additions & 1 deletion lib/vectortilefeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,18 @@ VectorTileFeature.prototype.toGeoJSON = function(x, y, z) {
type = 'MultiLineString';
}

return {
var result = {
type: "Feature",
geometry: {
type: type,
coordinates: coords
},
properties: this.properties
};

if ('_id' in this) {
result.id = this._id;
}

return result;
};
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vector-tile",
"description": "Parses vector tiles",
"repository": "https://github.com/mapbox/vector-tile-js.git",
"version": "1.1.3",
"version": "1.2.0",
"license": "BSD",
"main": "index.js",
"dependencies": {
Expand All @@ -15,7 +15,9 @@
"mapnik": "^3.1.6",
"jshint": "^2.6.3",
"pbf": "^1.3.2",
"tape": "~3.5.0"
"tape": "~3.5.0",
"eslint": "~1.00.0",
"eslint-config-unstyled": "^1.1.0"
},
"jshintConfig": {
"trailing": true,
Expand All @@ -25,7 +27,7 @@
"node": true
},
"scripts": {
"test": "jshint lib && tape test/*.test.js",
"test": "eslint lib index.js && jshint lib && tape test/*.test.js",
"cov": "istanbul cover ./node_modules/.bin/tape test/parse.test.js && coveralls < ./coverage/lcov.info"
}
}
1 change: 1 addition & 0 deletions test/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ test('parsing vector tiles', function(t) {

var point = tile.layers.poi_label.feature(11).toGeoJSON(8801, 5371, 14);
t.deepEqual(point.type, 'Feature');
t.deepEqual(point.id, 3000003150561);
t.deepEqual(point.properties, {
localrank: 1,
maki: 'park',
Expand Down