d3-geo icon indicating copy to clipboard operation
d3-geo copied to clipboard

projection.prepreclip?

Open mbostock opened this issue 6 years ago • 3 comments

It’d be nice to be able to use d3.geoClipPolygon prior to rotation for clipping in geographic coordinates (as opposed to using rotated coordinates with projection.preclip, as is suitable for the outline of an interrupted projection).

mbostock avatar Aug 09 '19 21:08 mbostock

If what we want is to clip a geojson with a polygon, this is a geometric operation that should happen on the sphere. It’s not clear to me why this would be tied to the projection.

Related:

  • https://github.com/d3/d3-geo-polygon/issues/22 (almost a solution)
  • https://observablehq.com/@d3/spherical-clipping (a use case)

Fil avatar Aug 10 '19 11:08 Fil

Also that particular use case is arguably better served by planar post-clipping projection.clipExtent https://observablehq.com/d/c613d80805786986

but of course this currently allows only rectangle extents. It would be cool to allow arbitrary geometry planar post-clipping.

Fil avatar Aug 10 '19 12:08 Fil

See also https://github.com/d3/d3-polygon/issues/4

Fil avatar Jul 23 '20 22:07 Fil