Skip to content

Instantly share code, notes, and snippets.

-- Instance of ST_AsText that can handle an array of geometries
create or replace function ST_AsText(geometry[])
returns text
language plpgsql immutable as
$$
declare
g geometry;
res text := '{';
begin
if $1 is null or array_length($1, 1) = 0 then
@max-mapper
max-mapper / index.js
Created February 11, 2014 19:43
dat cors test
var request = require('browser-request')
request('http://test.local:6461', function(err, resp, body) {
console.log('root', err, resp, body)
})
request('http://test.local:6461/_package', function(err, resp, body) {
console.log('package', err, resp, body)
})
@tmcw
tmcw / README.md
Created March 29, 2013 14:46
A little helper for there and back again gifs

When run in a directory of gifs, this numbers them and makes an a b c d animation go a b c d d c b a.

-- from http://www.spatialdbadvisor.com/postgis_tips_tricks/92/filtering-rings-in-polygon-postgis
CREATE OR REPLACE FUNCTION filter_rings(geometry, DOUBLE PRECISION)
RETURNS geometry AS
$BODY$
SELECT ST_BuildArea(ST_Collect(b.final_geom)) AS filtered_geom
FROM (SELECT ST_MakePolygon((/* Get outer ring of polygon */
SELECT ST_ExteriorRing(a.the_geom) AS outer_ring /* ie the outer ring */
), ARRAY(/* Get all inner rings > a particular area */
SELECT ST_ExteriorRing(b.geom) AS inner_ring
@eclubb
eclubb / sqlite2pg.sh
Created March 30, 2012 17:20
Script to import SQLite3 database into PostgreSQL
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3

Abundant testing data have existed for decades. Today we have the tools to access and consume these data like never before. Use the search bar to see how your neighborhood schools are performing. See which neighborhoods enjoy schools with high graduation rates and where more resources are needed. Included are reading and math breakdowns for the 2009-2010 school year, as well indication of how scores have changed since the previous year. For a deeper dive click through on each school to see performance in reading and math for the last three school years, as well as district averages for the 2009-2010.

Visualizing the dynamic geography of testing data not only empowers individual choices about where to send their children, but enables policymakers and researcher to see trends in how schools are performing only visible on a map.

#!/usr/bin/env bash
WD=`pwd`
tiger_em () {
directory=$WD/$1
shift
until [ -z "$1" ]
do
get_em $directory "ftp://ftp2.census.gov/geo/tiger/TIGER2010/"$1
shift