-
-
Save bycoffe/5647635 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ogr2ogr -f 'ESRI Shapefile' -t_srs 'EPSG:4326' drought.shp usdm130521.shp | |
$ topojson --cartesian --width=800 --height=800 -p -o drought.json drought=drought.shp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<meta charset="utf-8"> | |
<html> | |
<head> | |
<style type="text/css"> | |
path { | |
stroke-width: 1; | |
stroke: steelblue; | |
fill: #eee; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script src="d3.v3.js"></script> | |
<script src="topojson.js"></script> | |
<script> | |
;(function() { | |
var width = 800, | |
height = 800; | |
d3.json("drought.json", function(err, data) { | |
var drought = window.drought = topojson.feature(data, data.objects.drought); | |
var map = d3.select('#map').append('svg') | |
.style('width', width) | |
.style('height', height); | |
var path = d3.geo.path().projection(null); | |
map.selectAll('path') | |
.data(drought.features) | |
.enter().append('path') | |
.attr('d', function(d, i) { | |
return path(d); | |
}); | |
}); | |
}()); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment