Polygon Clipping I
✓ Published0🌍 Public
Mmbostock
Last edited Jan 23, 2017
Created on Jan 23, 2017
This example shows the United States rendered twice using a red fill, with a black-and-white clipped version superimposed on top. A blue rectangle marks the clipping boundary, and a white-stroked path displays the nation clipped to that rectangular extent. The visualization uses TopoJSON data from `us-10m.v1.json` and renders with `d3.geoPath`. The clipping is performed by `d3.geoIdentity().clipExtent`, which restricts the geographic projection to pixel coordinates between [100, 100] and [860, 500], demonstrating how to constrain a polygon’s visible area in an SVG context.
AI-generated descriptionThis example demonstrates how to use d3.geoIdentity to clip a polygon to an extent while rendering. You can save the resulting clipped polygon using d3.geoProject.
gpl-3.0 Licensed