Skip to main content
100%

turf: measurement

✓ Published0🌍 Public
AAlan McConchie
Last edited Nov 10, 2016
Created on Nov 10, 2016

This visualization measures the lengths of California streams using Turf.js, coloring each stream according to its distance in miles. A threshold color scale maps shorter streams to darker reds and greens, with longer streams shown in blue. The map renders on a Canvas element using d3.geo.path with a Mercator projection, drawing TopoJSON data loaded from a remote file. Turf.js’s `lineDistance` function calculates each feature’s length, while D3’s `d3.scale.threshold` assigns the stroke colors.

AI-generated description

Using turf.js to measure features

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/4122298'>U.S. Counties TopoJSON</a>

forked from <a href='http://bl.ocks.org/enjalot/'>enjalot</a>'s block: <a href='http://bl.ocks.org/enjalot/4a449bee40e7b74108de89e303a2a284'>WWSD #12: d3 + TopoJSON</a>

forked from <a href='http://bl.ocks.org/enjalot/'>enjalot</a>'s block: <a href='http://bl.ocks.org/enjalot/f6ac38e86de3e7d4cbe109ed601fa6d7'>WWSD #13: d3 + Canvas</a>

forked from <a href='http://bl.ocks.org/enjalot/'>enjalot</a>'s block: <a href='http://bl.ocks.org/enjalot/7e1c6eda09fb3c8cb64453a79e760f25'>WWSD #16: turf: measurement</a>

gpl-3.0 Licensed

Similar vizzes