Skip to content

Instantly share code, notes, and snippets.

View awoodruff's full-sized avatar

Andy Woodruff awoodruff

View GitHub Profile
@awoodruff
awoodruff / election.geojson
Last active July 28, 2018 15:04
Value-by-alpha map example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@awoodruff
awoodruff / grid.js
Created January 15, 2015 21:00
Square grid (Mercator) for Turfjs
// creates GeoJSON features (using Turfjs) for square grid cells in the Mercator projection
function grid(minX,minY,maxX,maxY,size){ // arguments are in projected mercator units; conversion functions below
var x = minX,
y = minY,
cells = [],
x0,
y0,
x1,
y1;
@awoodruff
awoodruff / README.md
Last active September 26, 2021 21:50
Dot density map

This is an attempt at a slightly D3-ish way of drawing a dot density map on a canvas element. In short, each polygon is drawn (invisibly) with a unique color, then random points are thrown at polygon bounding boxes and the pixel color is used for a point-in-polygon test. This example draws one dot for every 2 people in central Boston census blocks, for a total of approximately 132,000 dots.

@awoodruff
awoodruff / MarkerCluster.css
Last active May 1, 2020 19:10
Leaflet cluster map + choropleth
.marker-cluster-small {
background-color: rgba(181, 226, 140, 0.6);
}
.marker-cluster-small div {
background-color: rgba(110, 204, 57, 0.6);
}
.marker-cluster-medium {
background-color: rgba(241, 211, 87, 0.6);
}
@awoodruff
awoodruff / index.html
Last active September 13, 2019 11:04
Leaflet map with markers and choropleth
<html>
<head>
<title>A Leaflet map!</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<style>
#map{ height: 100% }
</style>
</head>
@awoodruff
awoodruff / index.html
Last active September 4, 2020 14:03
Leaflet map with markers and polygons
<html>
<head>
<title>A Leaflet map!</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<style>
#map{ height: 100% }
</style>
</head>
@awoodruff
awoodruff / index.html
Last active August 29, 2015 14:06
Leaflet map with popups
<html>
<head>
<title>A Leaflet map!</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<style>
#map{ height: 100% }
</style>
</head>
@awoodruff
awoodruff / index.html
Last active May 24, 2017 03:04
Leaflet: styled #ratmap
<html>
<head>
<title>A Leaflet map!</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<style>
#map{ height: 100% }
</style>
</head>
@awoodruff
awoodruff / index.html
Last active April 18, 2018 04:40
Leaflet: basic #ratmap
<html>
<head>
<title>A Leaflet map!</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<style>
#map{ height: 100% }
</style>
</head>
@awoodruff
awoodruff / index.html
Created September 16, 2014 01:25
Leaflet map with two tile layers
<html>
<head>
<title>A Leaflet map!</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
#map{ height: 100% }
</style>
</head>
<body>