I know there are manual ways of doing this (see Point in Polygon), but is there a native way of determining whether a point is inside a polygon, in d3.js?
Update: this is now part of d3-polygon.
d3.polygonContains(polygon, point)
No, there is no function for this. The only very special case when there is support for this would be checking whether the point is the centroid of the polygon (using the polygon.centroid
function), but in general you'll have to provide your own function.
Here's an implementation, in case you'd rather not roll your own. Demo here.