Skip to content

Instantly share code, notes, and snippets.

select jsonb_build_object(
'type', 'FeatureCollection',
'features', jsonb_agg(features.feature)
)
from(
select jsonb_build_object(
'type', 'Feature',
'id', ogc_fid,
'geometry', ST_AsGeoJSON(the_geom)::jsonb,
'properties', to_jsonb(inputs) - 'gid'
// https://projects.propublica.org/voting/static/vtile-bundle.js
import * as VectorTile from '@mapbox/vector-tile';
import * as Protobuf from 'pbf';
import * as Turf from '@turf/turf';
Math.radians = function(degrees) {
return degrees * Math.PI / 180;
};
export const TileQuery = {

Keybase proof

I hereby claim:

  • I am ashaw on github.
  • I am a_l (https://keybase.io/a_l) on keybase.
  • I have a public key ASCC07IPMNPo72sD5dLL3UtrWljymJDP6G2LapRIUeUfggo

To claim this, I am signing this object:

jankycs() {
echo "select st_astext(st_transform(st_setsrid(st_point($2, $1), 4326), 3857));" | psql houston-rain -t | perl -pe 's/[^\d\.\- ]//g' | perl -pe 's/^ //g';
printf '\n'
}
(function() {
var MapCanvas = Landline.Stateline = function(container, locality, opts) {
this.paper = {};
this.events = {};
this.attrs = {};
this.lookup = {};
this.locality = locality;
this.container = $(container);
this.container.css("position", "relative");
var extend = function(obj){
var others = [].slice.call(arguments,1);
others.forEach(function(other){
for(var j in other) obj[j] = other[j];
});
return obj;
}
var Node = function(value){
this.value = value;
def pf(path)
picturefill(path, "AltText") do
b = path.scan(/(^.*)\.(jpg|png|gif)/).flatten
sizes = {
:small => "#{b[0]}_small.#{b[1]}",
:medium => "#{b[0]}_medium.#{b[1]}",
:medium_high_dpi => "#{b[0]}_medium_high_dpi.#{b[1]}",
:large => "#{b[0]}_large.#{b[1]}",
:large_high_dpi => "#{b[0]}_large_high_dpi.#{b[1]}"
}
@ashaw
ashaw / landsat-db.rb
Last active September 19, 2015 02:24
# get the CSV from http://landsat.usgs.gov/metadata_service/bulk_metadata_files/LANDSAT_8.csv
require 'csv'
FILE = File.expand_path("..", __FILE__) + "/initial/LANDSAT_8.csv"
SCHEMA = <<-SQL
DROP TABLE "landsat8";
CREATE TABLE "landsat8" (
"sceneid" varchar(21) not null,
sensor varchar(8) not null,
class TilesController < ApplicationController
around_filter :up_s3
def tile_response(map)
respond_to do |format|
format.png {
send_data map.to_png, :content_type => Mime::Type.lookup_by_extension("png"), :disposition => "inline"
}
end
end
color = Dir["./west bay pass 1 color/*"]
infra = Dir["./west bay pass 1 infra/*"]
color_idx = 0
infra_idx = 0
def mk_filename(idx)
prefix = "IMG_"
no_str = idx < 1000 ? "0#{idx}" : idx
"#{prefix}#{no_str}"