antimeridian spanners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var VectorTile = require('vector-tile').VectorTile; | |
var Protobuf = require('pbf'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var data = fs.readFileSync(path.join(__dirname, './pbfs/river.vector.pbf')); | |
var tile = new VectorTile(new Protobuf(data)); | |
var layer = tile.layers['russian-river']; | |
var features = []; | |
for (var i = 0; i < layer.length; i++) { | |
features.push(layer.feature(i).toGeoJSON(0, 15, 6)); | |
} | |
var collection = { | |
type: 'FeatureCollection', | |
features: features, | |
}; | |
console.log(JSON.stringify(collection, null, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "FeatureCollection", | |
"features": [ | |
{ | |
"type": "Feature", | |
"geometry": { | |
"type": "LineString", | |
"coordinates": [ | |
[ | |
-180, | |
66.91606486099056 | |
], | |
[ | |
-180, | |
66.91391101065432 | |
], | |
[ | |
-179.98489379882812, | |
66.91444949104746 | |
] | |
] | |
}, | |
"properties": {}, | |
"id": 1 | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment