Skip to content

Instantly share code, notes, and snippets.

@milafrerichs
Created August 8, 2017 17:37
Show Gist options
  • Save milafrerichs/b767d031c50da9b8b93c09d570800b6a to your computer and use it in GitHub Desktop.
Save milafrerichs/b767d031c50da9b8b93c09d570800b6a to your computer and use it in GitHub Desktop.
JS Bin Just the base map with parking meters data // source http://jsbin.com/cuzocob
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Just the base map with parking meters data">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.3/d3.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
path
fill: #ccc
</style>
</head>
<body>
<div id="map" style="width: 600px; height: 600px;">
<svg width="600" height="600">
<g class="background"></g>
<g class="overlay"></g>
</svg>
</div>
<script id="jsbin-javascript">
var projection = d3.geoAlbers();
var geoGenerator = d3.geoPath()
.projection(projection);
var map = d3.select('#map g.background');
var overlay = d3.select('#map g.overlay');
var q = d3.queue();
q.defer(d3.json,'https://raw.githubusercontent.com/codeforamerica/click_that_hood/master/public/data/boston.geojson');
q.defer(d3.json,'https://gist.githubusercontent.com/milafrerichs/12fbfb500be19a41f39a581c8285ecb0/raw/a0734d28b47d48a06ca917529369cb35d232602b/Parking_Meters.geojson')
.awaitAll(function(error, results) {
boston = results[0];
points = results[1];
projection
.fitExtent([[20, 20], [600, 600]], boston)
u = map.selectAll('path')
.data(boston.features);
u.enter()
.append('path')
.attr('d', geoGenerator)
.attr('fill', '#ccc')
.attr('stroke', '#ccc')
;
})
</script>
<script id="jsbin-source-css" type="text/css">path
fill: #ccc</script>
<script id="jsbin-source-javascript" type="text/javascript">var projection = d3.geoAlbers();
var geoGenerator = d3.geoPath()
.projection(projection);
var map = d3.select('#map g.background');
var overlay = d3.select('#map g.overlay');
var q = d3.queue();
q.defer(d3.json,'https://raw.githubusercontent.com/codeforamerica/click_that_hood/master/public/data/boston.geojson');
q.defer(d3.json,'https://gist.githubusercontent.com/milafrerichs/12fbfb500be19a41f39a581c8285ecb0/raw/a0734d28b47d48a06ca917529369cb35d232602b/Parking_Meters.geojson')
.awaitAll(function(error, results) {
boston = results[0];
points = results[1];
projection
.fitExtent([[20, 20], [600, 600]], boston)
u = map.selectAll('path')
.data(boston.features);
u.enter()
.append('path')
.attr('d', geoGenerator)
.attr('fill', '#ccc')
.attr('stroke', '#ccc')
;
})</script></body>
</html>
var projection = d3.geoAlbers();
var geoGenerator = d3.geoPath()
.projection(projection);
var map = d3.select('#map g.background');
var overlay = d3.select('#map g.overlay');
var q = d3.queue();
q.defer(d3.json,'https://raw.githubusercontent.com/codeforamerica/click_that_hood/master/public/data/boston.geojson');
q.defer(d3.json,'https://gist.githubusercontent.com/milafrerichs/12fbfb500be19a41f39a581c8285ecb0/raw/a0734d28b47d48a06ca917529369cb35d232602b/Parking_Meters.geojson')
.awaitAll(function(error, results) {
boston = results[0];
points = results[1];
projection
.fitExtent([[20, 20], [600, 600]], boston)
u = map.selectAll('path')
.data(boston.features);
u.enter()
.append('path')
.attr('d', geoGenerator)
.attr('fill', '#ccc')
.attr('stroke', '#ccc')
;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment