Skip to content

Instantly share code, notes, and snippets.

Nick Bumbarger nbumbarger

Block or report user

Report or block nbumbarger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View projection.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #222;
}
</style>
<body>
<script src="//d3js.org/d3.v3.min.js"></script>
<script src="//d3js.org/d3.geo.projection.v0.min.js"></script>
View convex_hull_example.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Convex Hull</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
View original_example.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Original</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
View 100m_buffer_example.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>100m buffer</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@nbumbarger
nbumbarger / index.html
Created Nov 12, 2015
Gara Djebilet PCA (Mapbox slider, image processing example)
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Gara Djebilet PCA</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@nbumbarger
nbumbarger / index.html
Last active Nov 12, 2015
Gara Djebilet Band Ratio (Mapbox slider, image processing example)
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Gara Djebilet Band Ratio</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
View scatterplot.html
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="http://d3js.org/d3.v3.js"></script>
<script src="http://labratrevenge.com/d3-tip/javascripts/d3.tip.v0.6.3.js"></script>
@nbumbarger
nbumbarger / gist:a152517c2c7a9680f026
Last active Aug 29, 2015
Convert addresses to KML (geocoding API)
View gist:a152517c2c7a9680f026
# From: http://www.nickbumbarger.com/2015/05/31/spatial_data_production.html
require "HTTParty"
def geocode(address)
results = HTTParty.get("https://maps.googleapis.com/maps/api/geocode/json?address="+address)["results"]
location = results.first["geometry"]["location"]
end
def placemark_template(name, lat, lng)
placemark = "<Placemark>\n<name>#{name}</name>\n<Point>\n<coordinates>\n#{lng},#{lat},0\n</coordinates>\n</Point>\n</Placemark>\n"
end
#Start with the address data
@nbumbarger
nbumbarger / gist:0a9615cca929e0a31029
Created Jun 1, 2015
Geocode a list of addresses
View gist:0a9615cca929e0a31029
# From: http://www.nickbumbarger.com/2015/05/31/spatial_data_production.html
require "HTTParty"
def geocode(address)
results = HTTParty.get("https://maps.googleapis.com/maps/api/geocode/json?address="+address)["results"]
location = results.first["geometry"]["location"]
end
#Start with the original address data
data = "GA Washington DC\t1133 15th Street NW, 8th Floor Washington, DC 20005\nGA New York\t902 Broadway, 4th Floor New York, NY 10010\nGA Chicago\t444 N Wabash Ave, 5th Floor Chicago, IL 60611\n"
#Split into names and addresses, and send the address to the geocoder
#Reform the original text with coordinates in the place of addresses
@nbumbarger
nbumbarger / gist:53ef6f4d7576a2f4efb1
Created Jun 1, 2015
Convert a list of coordinates to KML
View gist:53ef6f4d7576a2f4efb1
# From: http://www.nickbumbarger.com/2015/05/31/spatial_data_production.html
def placemark_template(name, lat, lng)
placemark = "<Placemark>\n<name>#{name}</name>\n<Point>\n<coordinates>\n#{lng},#{lat},0\n</coordinates>\n</Point>\n</Placemark>\n"
end
#Start with the raw text
data = "GA Washington DC\t38.90485\t-77.03394\nGA New York\t40.73930\t-73.98942\nGA Chicago\t41.89061\t-87.62688"
#Define an empty body and split the text into attributes
#Insert attributes into the placemark template and append result to the body
body = String.new
raw_data.split("\n").each do |line|
You can’t perform that action at this time.