This file contains hidden or 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
// not working | |
// based on https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/web_mercator.hpp | |
'use strict'; | |
function latY(lat) { | |
var sin = Math.sin(lat * Math.PI / 180); | |
return 0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI; | |
} |
This file contains hidden or 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
function DebugViz(id, options) { | |
var canvas = this.canvas = document.getElementById(id); | |
var ctx = this.ctx = canvas.getContext('2d'); | |
canvas.width = window.innerWidth; | |
} | |
var padding = 5; | |
DebugViz.prototype = { |
This file contains hidden or 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
{"deviation":0.14022095,"coords":[[[3304,1016],[3264,1032],[3280,1056],[3352,1072],[3400,1024],[3448,1008],[3472,1016],[3480,1056],[3432,1064],[3424,1096],[3392,1128],[3368,1120],[3368,1152],[3392,1192],[3368,1192],[3336,1144],[3352,1192],[3344,1224],[3288,1256],[3328,1336],[3328,1408],[3312,1416],[3312,1480],[3280,1592],[3296,1688],[3256,1736],[3264,1792],[3248,1800],[3240,1864],[3216,1880],[3160,1880],[3136,1864],[3128,1896],[3056,1896],[3048,1864],[3008,1832],[2976,1864],[3040,1896],[3040,1928],[3072,1992],[3040,2032],[3040,2056],[3064,2064],[3096,2040],[3112,1920],[3176,2000],[3192,1992],[3200,1936],[3216,1936],[3208,1992],[3224,2032],[3224,2112],[3200,2192],[3176,2216],[3152,2216],[3144,2248],[3104,2256],[3104,2312],[3080,2304],[3072,2328],[3040,2320],[3016,2360],[2984,2360],[2976,2400],[3048,2416],[3056,2376],[3096,2368],[3104,2344],[3248,2352],[3232,2304],[3272,2304],[3288,2328],[3312,2328],[3384,2264],[3416,2280],[3432,2240],[3496,2248],[3512,2216],[3536,2224],[3560,2264],[3488,2296],[3456,2328],[3416 |
This file contains hidden or 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
'use strict'; | |
var polyclip = require('./'); | |
var subject = [[3116,3071],[3118,3068],[3108,3102],[3100,3105],[3096,3113],[3099,3121],[3091,3135],[3099,3133],[3105,3144],[3113,3144],[3105,3143],[3117,3157],[3129,3155],[3137,3167],[3152,3177],[3160,3187],[3172,3204],[3174,3195],[3179,3217],[3197,3225],[3189,3217],[3203,3217],[3199,3202],[3186,3188],[3186,3174],[3174,3166],[3165,3145],[3168,3143],[3159,3143],[3151,3118],[3154,3107],[3165,3110],[3174,3105],[3175,3082],[3186,3076],[3178,3089],[3183,3103],[3196,3116],[3181,3105],[3180,3111],[3155,3111],[3173,3130],[3179,3150],[3197,3170],[3199,3178],[3216,3190],[3214,3203],[3235,3219],[3243,3212],[3244,3198],[3246,3208],[3244,3219],[3236,3240],[3237,3249],[3248,3262],[3263,3267],[3327,3313],[3338,3327],[3340,3340],[3351,3349],[3353,3361],[3345,3365],[3355,3387],[3363,3392],[3364,3401],[3375,3413],[3382,3421],[3394,3431],[3404,3433],[3398,3416],[3406,3433],[3409,3422],[3428,3400],[3423,3392],[3446,3377],[3461,3366],[3495,3354],[3506,3343],[3506,3334],[3495,3338],[35 |
This file contains hidden or 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
// each top-level message in a file is tag-prefixed (like fields) to differentiate between types | |
message Data { | |
oneof data_type { | |
fixed32 block_size = 1; // byte length of the following block (metadata + features/geometries) | |
Metadata metadata = 2; | |
Collection feature_collection = 3; | |
Collection geometry_collection = 4; | |
Collection collection_end = 5; |
This file contains hidden or 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
// g++ or clang++ -o get-trees get-trees.cpp -O3 -DNDEBUG -I../libosmium/include -std=c++11 -lz -lpthread | |
#include <exception> | |
#include <vector> | |
#include <iostream> | |
#include <iomanip> | |
#include <osmium/handler.hpp> | |
#include <osmium/io/pbf_input.hpp> | |
#include <osmium/visitor.hpp> |
This file contains hidden or 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
'use strict'; | |
var osmium = require('osmium'); | |
var file = new osmium.File("../mbtiles/us-west-latest.osm.pbf"); | |
var reader = new osmium.Reader(file, {node: true}); | |
var trees = 0; | |
process.stdout.write('['); |
This file contains hidden or 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
'use strict'; | |
// ported from http://iamtrask.github.io/2015/07/12/basic-python-network/ | |
const ndarray = require('ndarray'); | |
const ops = require('ndarray-ops'); | |
const matrix = (rows, cols, data) => ndarray(new Float32Array(data || (rows * cols)), [rows, cols]); | |
const sigmoid = (out, a) => { |
This file contains hidden or 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
'use strict'; | |
var fs = require('fs'); | |
var path = require('path'); | |
function lazyRead(path, chunkFn, done) { | |
var input = fs.createReadStream(path) | |
.on('readable', handleReadable) | |
.on('end', handleEnd); |
This file contains hidden or 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
~/projects/test → npm -v | |
2.14.4 | |
~/projects/test → npm cache clean | |
~/projects/test → time npm install eslint | |
[email protected] node_modules/eslint | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] |