Skip to content

Instantly share code, notes, and snippets.

View timwaters's full-sized avatar
💭
Set your status

Tim Waters timwaters

💭
Set your status
View GitHub Profile
@timwaters
timwaters / ES facets
Created May 8, 2013 16:51
facets all up in the place
{
"facets": {
"feature_code": {
"_type": "terms",
"total": 5529,
"terms": [
{
"count": 5220,
"term": "HSTS"
},
@timwaters
timwaters / gist:5477222
Last active December 16, 2015 18:20
leeds data hack bdw13 Tims One Hour Data Challenge
Tims One Hour Data Challenge
leeds data hack bdw13
http://i.imgur.com/AfNJhRX.png
Dr G Lees & Partners
Highfield Surgery
The Surgery at Nursery Lane and Adel
@timwaters
timwaters / gist:4336435
Created December 19, 2012 12:48
elasticsearch combining AND and OR - possible?
// (name.second == ba || name.second == po) && postdate ...
filter': {
'and': [
{
'or':[
{
"prefix" : { "name.second" : "ba" }
},
{
"address":{
"type": "object",
"properties": {
"number": {
"type": "string",
"index": "not_analyzed",
"store": "no"
},
"street": {
"type": "string",
@timwaters
timwaters / hot_osm_links.txt
Created November 13, 2012 14:46
plan workshop HOT osm useful links
{
"NAME": "Navajo",
"county_sta": "NavajoArizona",
"County_B": "NavajoCounty",
"x": -110.314143272,
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
@timwaters
timwaters / simple_sinatra_oauth_app_geoiq.rb
Created November 8, 2011 12:04
Simple GeoCommons and GeoIQ OAuth Sinatra App
require "rubygems"
require "sinatra"
require "oauth"
require "oauth/consumer"
require 'haml'
enable :sessions
# Simple Ruby Sinatra application for interacting with GeoIQ server
# You would need to either supply environment variables for key, secret and site or change them in this file.
@timwaters
timwaters / geoiq_leaflet.htm
Created October 31, 2011 11:34
geoiq geocommons and leaflet
<html><head><title>Geocommons and Leaflet JS</title>
<!-- Leaflet CSS -->
<link rel="stylesheet" href="CloudMade-Leaflet-404b097/dist/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="CloudMade-Leaflet-404b097/dist>/leaflet.ie.css" /><![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<!-- Leaflet JavaScript -->
<script type="text/javascript" src="CloudMade-Leaflet-404b097/dist/leaflet.js"></script>
@timwaters
timwaters / geocder.patch
Created October 11, 2011 19:58
patch for old dbs geocommons geocoder
# Unpack an array of little-endian 4-byte ints, and convert them into
# signed floats by dividing by 10^6, inverting the process used by the
# compress_wkb_line() function in the SQLite helper extension.
def unpack_geometry (geom)
points = []
if !geom.nil?
# Pete - The database format is completely different to the one
# expected by the code, so I've done some detective work to
# figure out what it should be. It looks like the format is
# | 1 byte Type | 4 byte SRID | 4 byte element count| 8 byte double coordinates *
@timwaters
timwaters / gist:1248798
Created September 28, 2011 18:33
ruby mapnik displaying a raster?
CURRENT_PATH = File.expand_path(File.dirname(__FILE__))
require File.join(CURRENT_PATH, '..', 'lib', 'ruby_mapnik')
map = Mapnik::Map.new do |m|
m.width = 2024
m.height = 1768
m.background = Mapnik::Color.new("#fff")
m.srs = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"