Skip to content

Instantly share code, notes, and snippets.

@jhnklly
jhnklly / index.html
Created September 18, 2016 20:40 — forked from mapsense-examples/index.html
Label Me
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://d3js.org/topojson.v1.min.js" charset="utf-8"></script>
<script src="https://developer.mapsense.co/mapsense.js" charset="utf-8"></script>
<link type="text/css" href="https://developer.mapsense.co/mapsense.css" rel="stylesheet"/>
@jhnklly
jhnklly / d3.v3.min.js
Last active December 1, 2015 00:00
Tracking NBA scoring leaders
!function(){function n(n){return n&&(n.ownerDocument||n.document||n).documentElement}function t(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function e(n,t){return t>n?-1:n>t?1:n>=t?0:NaN}function r(n){return null===n?NaN:+n}function u(n){return!isNaN(n)}function i(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function a(n){return n.length}function o(n){for(var t=1;n*t%1;)t*=10;return t}function l(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function c(){this._=Object.create(null)}function s(n){return(n+="")===xa||n[0]===ba?ba+n:n}function f(n){return(n+="")[0]===ba?n.slice(1):n}function h(n){return s(n)in this._}function g(n){return(n=s(n))in this._&&delete this._[n]}function p(){var n=[]
@jhnklly
jhnklly / postgis_cheatbook.sql
Last active December 10, 2017 11:05
PostGIS cheatsheet / recipe book
/*TODO: much.*/
/*Get info*/
\d table_name
/*Set timing*/
\t
/*Reproject*/
ST_Transform(geom, int)
@jhnklly
jhnklly / bounds.js
Last active March 22, 2016 22:17
Drag & drop csv to map
// Hat tip Mike Bostock: https://github.com/mbostock/polymaps/blob/master/examples/bounds/bounds.js
function bounds(features) {
var i = -1,
n = features.length,
geometry,
bounds = [{lon: Infinity, lat: Infinity}, {lon: -Infinity, lat: -Infinity}];
while (++i < n) {
//geometry = features[i].data.geometry;
geometry = features[i].geometry;
@jhnklly
jhnklly / bayareaPts.json
Last active October 22, 2017 02:37
Paste addresses to (batch) geocode
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhnklly
jhnklly / index.html
Created October 15, 2015 19:33
leaflet + esri tiles
<!doctype html>
<html>
<head>
<!--
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://d3js.org/topojson.v1.min.js" charset="utf-8"></script>
-->
<script src="http://leafletjs.com/dist/leaflet.js" charset="utf-8"></script>
<script src="http://mlevans.github.io/leaflet-hash/javascripts/leaflet-hash.js" charset="utf-8"></script>
<link type="text/css" href="http://leafletjs.com/dist/leaflet.css" rel="stylesheet"/>
@jhnklly
jhnklly / heritage.json
Last active April 12, 2016 19:01
Random map/image, world heritage sites
[
{
"unique_number":230,
"id_no":208,
"name_en":"Cultural Landscape and Archaeological Remains of the Bamiyan Valley",
"longitude":67.8253,
"latitude":34.8469,
"area_hectares":158.9265
},
{
@jhnklly
jhnklly / index.html
Last active August 29, 2015 14:26 — forked from mapsense-examples/index.html
simple query
<!doctype html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://d3js.org/topojson.v1.min.js" charset="utf-8"></script>
<script src="https://developer.mapsense.co/mapsense.js" charset="utf-8"></script>
<link type="text/css" href="https://developer.mapsense.co/mapsense.css" rel="stylesheet"/>
<style>
/* Sets the map to be full screen with no margin */
body, html, #myMap{
@jhnklly
jhnklly / basemap-natural.css
Last active August 29, 2015 14:26
albers mapsense.js
svg.mapsense-map {
width: 100%;
height: 100%;
}
.mapsense-attribution {
background-color: rgba(0, 0, 0, 0.5);
color: #ccc;
position: absolute;
bottom: 0;
right: 0;
@jhnklly
jhnklly / index.html
Created July 29, 2015 06:15
albers from sphericalmercator.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://d3js.org/topojson.v1.min.js" charset="utf-8"></script>
<script src="https://developer.mapsense.co/mapsense.js" charset="utf-8"></script>
<link type="text/css" href="https://developer.mapsense.co/mapsense.css" rel="stylesheet"/>