Having troubles finding information to draw a circular sector on a given map projection in D3.js. I have been using d3.svg.arc, but now I need to transform it to given d3.geo projections.
Note, this is not for drawing arcs between two points, but circular sectors (think pie wedges).
You can create a function that calculates the coordinates along the desired arc in spherical coordinates (making use of the
d3.geo.rotation
function to save yourself the headache of figuring out the correct equations) and returns aLineString
object:This can then be used to create the desired arc like this:
This generates an arc centered at 20°E, 40°N with a radius of 30°, running from -20° to 230°:
Fiddle