Example of how to
.geoPolygon()
and .polygonPoints()
to filter out point locations beyond the desired geography.More examples... Farmers Markets I: SVG • Farmers Markets II: SVG and interaction • Military disputes: SVG with clipping • Number of cities: Canvas • all examples on Observable
xxxxxxxxxx
<html lang="en">
<head>
<meta charset="utf-8">
<title>Post boxes</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- d3-hexgrid script comes first. -->
<script src="//unpkg.com/d3-hexgrid"></script>
<script src="//unpkg.com/d3"></script>
<script src="//unpkg.com/d3-geo-projection"></script>
<script src='//unpkg.com/simple-statistics'></script>
<script src='//unpkg.com/topojson'></script>
</head>
<body>
<div id="container">
<canvas></canvas>
</div>
<script src="app.js"></script>
</body>
</html>
https://unpkg.com/d3-hexgrid
https://unpkg.com/d3
https://unpkg.com/d3-geo-projection
https://unpkg.com/simple-statistics
https://unpkg.com/topojson