Skip to content

Instantly share code, notes, and snippets.

@leenoah1
Last active May 18, 2017 19:55
Show Gist options
  • Save leenoah1/359654d649597d241ac5d13ba6e02291 to your computer and use it in GitHub Desktop.
Save leenoah1/359654d649597d241ac5d13ba6e02291 to your computer and use it in GitHub Desktop.
watershed gist
license: mit
<!DOCTYPE html>
<meta charset="utf-8">
<title>watershed</title>
<body>
<script src="//d3js.org/d3.v4.min.js"></script>
<script src="//d3js.org/topojson.v2.min.js"></script>
<script>
var width = 960, height = 500;
var svg = d3.select('body').append('svg')
.attr('width', width)
.attr('height', height);
// For d3 representation of various stateplanes, see: d3-stateplane
// We'll set the scale and translate later, based on the data
var projection = d3.geoConicConformal()
.parallels([38 + 18 / 60, 39 + 27 / 60])
.rotate([77, -37 - 40 / 60]);
var path = d3.geoPath()
d3.json("https://raw.githubusercontent.com/leenoah1/class_project/master/watershed.json", function(json) {
svg.selectAll("path")
.data(json.features)
.enter()
.append("path")
.attr("d", path);
d3.json("watershed.json", function(json) {
//Put things here that depend on the JSON loading
svg.selectAll("path")
.data(json.features)
.enter()
.append("path")
.attr("d", path);
});
//Only put things here that can operate independently of the JSON
console.log("I like cats.");
});
</script>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment