Create contour map

Wex picture Wex · Aug 15, 2012 · Viewed 9.8k times · Source

Given a set of (x, y, z) coordinates, how would I go about creating a contour map?

Would be nice to know how to implement in but wouldn't mind trying to implement it myself if I had some direction.


For users, can I create a contour map using d3.geom.contour() and jasondavies' conrec.js:

https://github.com/jasondavies/conrec.js

Essentially, I'd like to replicate this contour map using d3.js: http://beaugunderson.com/routes/

Answer

Lars Kotthoff picture Lars Kotthoff · Aug 15, 2012

It looks like this would be very easy with conrec.js. If you pass the data in the form that you have it, you can get a list of paths by calling .contourList() on the result. That you should be able to pass without modification to a d3 .data() call. All you should need to do is supply a path generator that maps the coordinates in the data to screen coordinates.