View peermaps-data.md

peermaps data is ready

Peermaps is a project to bring OpenStreetMap data to the p2p web.

I've just finished a big part of this project: subdividing planet-latest.osm.pbf to support ad-hoc extracts. With ad-hoc extracts over p2p networks, you can download only the parts of planet osm that you need without having to download the whole 34G thing and process it using tens of gigabytes of RAM. Using the peermaps data archive, you can build tile sets for the entire planet on very modest hardware. Every .o5m.gz file is at most 1M. More details below.

View drive.js
var namedArchives = require('hyperdrive-named-archives')
var hyperdrive = require('hyperdrive')
var filestore = require('random-access-file')
var sub = require('subleveldown')
var path = require('path')
var DRIVE = 'd', NAMED = 'n'
module.exports = function (db, opts) {
var dir = opts.dir
View archive.js
var namedArchives = require('hyperdrive-named-archives')
var hyperdrive = require('hyperdrive')
var filestore = require('random-access-file')
var path = require('path')
var DRIVE = 'd', NAMED = 'n'
module.exports = function (db, opts) {
var dir = opts.dir
var named = namedArchives({
View main.js
var html = require('yo-yo')
var root = document.body.appendChild(document.createElement('div'))
var state = { n: 0 }
update()
function update () {
html.update(root, html`<div>
<h1>${state.n} clicks</h1>
<div>
<button onclick=${onclick}>click</button>
View vector-globe.md

making a vector globe

when you're done, it should look like this:

install some commands if you don't already have them:

View main.js
{
"scripts": {
"watch": "budo main.js"
},
"browserify": {
"transform": [ "glslify" ]
}
}
View show.js
var level = require('level')
var db = level('log1')
var hyperlog = require('hyperlog')
var log = hyperlog(db, { valueEncoding: 'json' })
var through = require('through2')
var pump = require('pump')
pump(log.createReadStream(), through.obj(write))
function write (row, enc, next) {
View globe.js
var regl = require('regl')()
var camera = require('regl-camera')(regl, {
minDistance: 1, distance: 3 //, phi: -Math.PI/2
})
var mat4 = require('gl-mat4')
var icosphere = require('icosphere')
//var scoords = require('varying-spherical-coordinates')
var glsl = require('glslify')
//var resl = require('resl')
View index.glsl
vec3 uv_to_xyz (vec2 uv) {
return vec3(
sin(uv.x)*cos(uv.y),
sin(uv.y),
cos(uv.x)*cos(uv.y)
);
}
#pragma glslify: export(uv_to_xyz)
View build.sh
#!/bin/bash
if test "$1" == 'watch'; then
drmark -t glslify -t multi-regl-transform --deferred -wvd --live \
-i index.md -o "./wrap.sh > index.html"
else
drmark -t glslify -t multi-regl-transform --deferred \
-i index.md -o "./wrap.sh > index.html"
fi