Skip to content

Instantly share code, notes, and snippets.

@bmount
bmount / acs_tables.json
Created August 19, 2013 23:33
human readable column name -> description mapping for American Community Survey tables, tract detail dataset
{"dp0150001": "Households with individuals 65 years and over", "dp0090004": "Total races tallied: Asian alone or in combination with one or more other races", "dp0090005": "Total races tallied: Native Hawaiian and Other Pacific Islander alone or in combination with one or more other races", "shape": "Unrepresentable_Domain: Coordinates defining the features.", "dp0090001": "Total races tallied: White alone or in combination with one or more other races", "dp0090002": "Total races tallied: Black or African American alone or in combination with one or more other races", "dp0090003": "Total races tallied: American Indian and Alaska Native alone or in combination with one or more other races", "dp0120006": "Total population: In Households: Child: Own child under 18 years", "dp0010040": "Total Population: Female: Under 5 years", "dp0010041": "Total Population: Female: 5 to 9 years", "dp0010042": "Total Population: Female: 10 to 14 years", "dp0010043": "Total Population: Female: 15 to 19 years", "dp0010044": "Total
@bmount
bmount / example.js
Last active December 20, 2015 23:39
interacting with topographic data in browser console
// In console:
script = document.createElement("script")
script.type = 'text/javascript'
script.src = "http://d3js.org/d3.v3.min.js"
document.body.appendChild(script);
img = new Image
img.crossOrigin = "Anonymous";
img.src= "https://a.tiles.mapbox.com/v3/bmount.srtmsf/-122.4575,37.7575,14/500x500.png"
@bmount
bmount / index.html
Last active December 20, 2015 13:09
Manhattan building construction dates as reported by MapPLUTO
<!doctype html>
<meta charset="utf-8">
<style>
rect {
fill: steelblue;
}
.leg {
@bmount
bmount / fgdb_gut_caveats.md
Last active December 20, 2015 07:28
gut_fgdb_caveats

Refers to experimental file geodatabase conversion in gut

  1. Files have to be zipped, which as far as I can tell is the norm for fgdb distribution (.gdb is just a directory)

  2. This converts to kml because handling layers in geojson exceeds my time budget for this (measured in minutes today!), patches and ideas for going straight to json are welcome: https://github.com/bmount/gut I haven't even had time to read the source of the great gdbflee.

  3. Files larger than 100 megabytes should access the underlying api unproxied:

curl -X POST http://conv.sfgeo.org:5984/_fgdb2kml --data-binary @yourfile.gdb.zip

@bmount
bmount / gist:5863926
Created June 26, 2013 01:10
opencv build with homebrew/some other python. reminder about setting cmake variables
cmake -DPYTHON_EXECUTABLE:PATH='/usr/local/bin/python' -DPYTHON_INCLUDE_DIR:PATH='/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7/' -DPYTHON_LIBRARY:PATH='/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib' -G "Unix Makefiles"
{"dp0150001": "Households with individuals 65 years and over", "dp0090004": "Total races tallied: Asian alone or in combination with one or more other races", "dp0090005": "Total races tallied: Native Hawaiian and Other Pacific Islander alone or in combination with one or more other races", "shape": "Unrepresentable_Domain: Coordinates defining the features.", "dp0090001": "Total races tallied: White alone or in combination with one or more other races", "dp0090002": "Total races tallied: Black or African American alone or in combination with one or more other races", "dp0090003": "Total races tallied: American Indian and Alaska Native alone or in combination with one or more other races", "dp0120006": "Total population: In Households: Child: Own child under 18 years", "dp0010040": "Total Population: Female: Under 5 years", "dp0010041": "Total Population: Female: 5 to 9 years", "dp0010042": "Total Population: Female: 10 to 14 years", "dp0010043": "Total Population: Female: 15 to 19 years", "dp0010044": "Total
@bmount
bmount / srtm_regions.js
Last active December 14, 2015 10:49
Region and url finder for SRTM1
function region (pt) {
var pt = pt, regions, r;
if (!Array.isArray(pt) || pt.length < 2) return false;
/*
* Boundaries of SRTM regions as lower left -> upper right:
* [[min lon,min lat], [max lon, max lat]]
* The records use lower left coordinates, so N37W123.hgt covers 37->38 lat, -123->-122 lon
* See: http://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_definition.jpg
*/
regions = r = [
@bmount
bmount / naip_break-up.py
Created February 9, 2013 01:05
reminder about breaking up huge National Agricultural Imagery Program (NAIP) tif files
# coding: utf-8
import os
# naip SF collection in geotiff from gdalinfo via mrsiddecode:
xmax = 72260
ymax = 21650
x = xmax
y = 21650
tmp = """gdal_translate -of PNG -srcwin {0} {1} 2000 2000 sf2012.tif bigslice/sf_partial-{2}.png"""
while x > 0:
@bmount
bmount / qgis_libs.sh
Created February 7, 2013 00:05
reminder about installing QGIS build from here: http://qgis.dakotacarto.com/ with a combination of libraries from source and homebrew. Leave a comment if you notice something barbaric (or just bad.)
sudo mkdir -p /Library/Frameworks/GDAL.framework/Versions/1.9/
sudo ln -s /usr/local/lib/libgdal.dylib /Library/Frameworks/GDAL.framework/Versions/1.9/GDAL
sudo mkdir -p /Library/Frameworks/PROJ.framework/Versions/4/
sudo ln -s /usr/local/Cellar/proj/4.8.0/lib/libproj.dylib /Library/Frameworks/PROJ.framework/Versions/4/PROJ
# did not work: sudo ln -s `pwd`/libgeos.dylib /Library/Frameworks/GEOS.framework/Versions/3/GEOS
# did work:
# $PWD is /usr/local/Cellar/geos/3.3.6/lib
sudo ln -s `pwd`/libgeos_c.1.dylib /Library/Frameworks/GEOS.framework/Versions/3/GEOS
sudo mkdir -p /Library/Frameworks/SQLite3.framework/Versions/3/
sudo ln -s /usr/local/Cellar/sqlite/3.7.15/lib/libsqlite3.0.8.6.dylib /Library/Frameworks/SQLite3.framework/Versions/3/SQLite3

The now:

curl -o tweet.stream -u $TWUSER:$TWPASS -X POST https://stream.twitter.com/1.1/statuses/filter.json\?locations\=-123.0,37.0,-122.0,38.0

The future:

?? -? tweet.stream ?????:????? -? https://stream.twitter.com/1.1/statuses/filter.json... ?? ???????