developmentseed / vt-geojson Goto Github PK
View Code? Open in Web Editor NEWExtract GeoJSON from Mapbox vector tiles.
License: BSD 2-Clause "Simplified" License
Extract GeoJSON from Mapbox vector tiles.
License: BSD 2-Clause "Simplified" License
Running: npm install -g vt-geojson
processing (master) $ npm install -g vt-geojson
npm ERR! Error: Unsupported URL Type: github:anandthakker/node-mbtiles
npm ERR! at parseUrl (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:148:13)
npm ERR! at npa (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:62:12)
npm ERR! at resolver (/usr/local/lib/node_modules/npm/lib/install.js:679:42)
npm ERR! at null._onTimeout (/usr/local/lib/node_modules/npm/lib/install.js:674:7)
npm ERR! at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "vt-geojson"
npm ERR! cwd /Users/aaron/processing
npm ERR! node -v v0.10.30
npm ERR! npm -v 2.0.0-alpha-5
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/aaron/processing/npm-debug.log
npm ERR! not ok code 0
the variations based on tiles
param are weird -- switch to an options object.
Currently we're just spitting out console errors whenever the tileset doesn't contain a tile. We should do something better here -- maybe emit a custom event.
Again, with browserify: When using a secure URL, at some point along the line the URL is injected with ":80" at the end of the domain, causing an SSL error.
I think this is because node-tilejson is hanging onto a connection or something, but unsure. And if so, unsure of the best way to close it.
This module is working great for selecting points along a route from my vector tile source, but for some reason it seems to fail with one particular tile.
The trouble tile seems to be [[19086,24820,16]]
in my aarondennis.7i147a82
tile source. There could be others too, I just happened on this one. I used tippecanoe to create these tiles, and maybe the problem was there, but it seems that vt-geojson can't process something about this tile.
I expected the script below to output the red point features inside the yellow tile boundaries from the image above, but after success with only some of the features, it then returns an error.
var cover = require('tile-cover'),
vtGeoJson = require('vt-geojson');
// tile boundaries
var area = {
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-75.157470703125,
39.956069770090046
],
[
-75.157470703125,
39.9602803542957
],
[
-75.1519775390625,
39.9602803542957
],
[
-75.1519775390625,
39.956069770090046
],
[
-75.157470703125,
39.956069770090046
]
]
]
},
"properties": {}
}
var limits = {
min_zoom: 16,
max_zoom: 16
};
var tiles = cover.tiles(area.geometry, limits);
var source = 'tilejson+http://api.tiles.mapbox.com/v4/aarondennis.7i147a82.json?access_token=pk.eyJ1IjoiYWFyb25kZW5uaXMiLCJhIjoiem5LLURoYyJ9.T3tswGTI5ve8_wE-a02cMw'
vtGeoJson(source, { tiles: tiles })
.on('data', function(feature) {
console.log(feature);
});
The error I receive:
/Users/aaron/node_modules/vt-geojson/node_modules/vector-tile/lib/vectortilefeature.js:81
throw new Error('unknown command ' + cmd);
^
Error: unknown command 0
at VectorTileFeature.loadGeometry (/Users/aaron/node_modules/vt-geojson/node_modules/vector-tile/lib/vectortilefeature.js:81:19)
at VectorTileFeature.toGeoJSON (/Users/aaron/node_modules/vt-geojson/node_modules/vector-tile/lib/vectortilefeature.js:133:23)
at /Users/aaron/node_modules/vt-geojson/index.js:120:41
at Array.forEach (native)
at processTile (/Users/aaron/node_modules/vt-geojson/index.js:115:10)
at Gunzip.onEnd (zlib.js:227:5)
at Gunzip.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)
The same area is successfully processed if I change the zoom limits to 17.
When using browserify to create a bundle suitable for browsers, at some point along the line the z, x, and y parameters are passed NaN. This, of course, fails.
offer a progress callback, estimating % done with (sum of examined features) / (total test polygon area)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.