Skip to content

Instantly share code, notes, and snippets.

View miketahani's full-sized avatar

Mike Tahani miketahani

View GitHub Profile
@miketahani
miketahani / threejs-assignUVs
Created May 15, 2014 00:57
assign UVs to a planar surface (three.js)
// via http://stackoverflow.com/questions/20774648/three-js-generate-uv-coordinate
var assignUVs = function( geometry ){
geometry.computeBoundingBox();
var max = geometry.boundingBox.max;
var min = geometry.boundingBox.min;
var offset = new THREE.Vector2(0 - min.x, 0 - min.y);
@miketahani
miketahani / querystring-reader
Created May 15, 2014 02:37
parse simple querystring parameters
var qs = window.location.search.substr(1).split('&'),
args = {};
qs.forEach(function(arg) {
arg = arg.split('=');
args[arg[0]] = arg[1];
});
@miketahani
miketahani / README.md
Last active August 29, 2015 14:04 — forked from d2fn/README.md
@miketahani
miketahani / gist:cc217107990d0ca452b4
Created January 3, 2015 05:05
wget past 90 days of OPD crime reports, save as the current date + .json
wget http://data.oaklandnet.com/resource/ym6k-rx7a.json -O `date "+%Y.%m.%d"`.json

Processing LiDAR to extract building heights

Walk through

Detailed walk through of building extraction using postgis

First lets pull a data layer from of openstreetmap. You can do this any which way you’d like, as there are a variety of methods for pulling openstreetmap data from their database. Check the [wiki] (http://wiki.openstreetmap.org/wiki/Downloading_data) for a comprehensive list. My favourite method thus far is pulling the data straight into QGIS using the open layers plugin. For those who may want to explore this method, check [this tutorial] (http://www.qgistutorials.com/en/docs/downloading_osm_data.html). For building extraction you only need building footprints, and include the building tags. Not all polygons are of type building in OSM, so we can download all the polygons, and then filter the layer for only polygons tagged as buildings.

LiDAR data was pulled from USGS via the Earth Explorer site. [Here] (http://earthobservatory.nasa.gov/blogs/ele

@miketahani
miketahani / gist:dc94764efa456405c9bc
Created February 18, 2015 05:37
ST3 user settings
{
"always_show_minimap_viewport": true,
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"caret_extra_width": 0,
"caret_style": "blink",
"color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_face": "inconsolata-g",
"font_size": 7.5,
@miketahani
miketahani / debug-canvas-image.js
Last active August 29, 2015 14:16
create a hovering image that displays the contents of an HTML5 canvas
(function () {
var img = document.createElement('img');
document.body.appendChild(img);
img.style.position = 'fixed';
img.style.top = 0;
img.style.right = 0;
img.style.width = '500px';
img.style.background = '#fff';
img.style['z-index'] = 1000000;
window.addEventListener('keypress', function (e) {
@miketahani
miketahani / canvas-clipmask-compositing.js
Created February 27, 2015 03:29
creating a canvas clip mask using compositing operations
ctx.save();
ctx.beginPath();
ctx.fillStyle = 'white';
path.context(ctx)(landClipTopo);
ctx.fill();
ctx.globalCompositeOperation = 'source-in';
ctx.fillStyle = 'red';
ctx.fillRect(w/2-200, h/2-200, 200, 200);
@miketahani
miketahani / canvas-clipmask.js
Created February 27, 2015 03:31
create a canvas clip mask using clip()
ctx.save();
ctx.beginPath();
path.context(ctx)(landClipTopo);
ctx.closePath();
ctx.clip();
ctx.fillStyle = 'red';
ctx.fillRect(w/2-200, h/2-200, 200, 200);