A simple option that does not require any of the following elements:
- ocean polygon
- redrawing landfills / merging landfills
- clip paths
- use the svg template. This may seem a little strange, and I'm not sure what the performance implications are, but you can use the voronoi diagram template to fill in your countries / functions (saving borders and the ability to select objects once and only once).
This requires that the polygon fill does not depend on geographic function, but depends on voronoi - your image uses the same fill for each polygon, but your question text may suggest that it is not.
To use such a template, create a template that will have the same width and height as your map. In the template, place the paths of the voronoi diagram. Finally, set the fill of each function to the template:
var svg = d3.select("svg"), width = +svg.attr("width"), height = +svg.attr("height"); var projection = d3.geoMercator() .scale((width - 3) / (2 * Math.PI)) .translate([width / 2, height / 2]); var path = d3.geoPath() .projection(projection); var graticule = d3.geoGraticule(); d3.json("https://unpkg.com/ world-atlas@1 /world/50m.json", function(error, world) { if (error) throw error;
.boundary { stroke: black; stroke-width: 1px; }
<script src="https://d3js.org/d3.v4.min.js"></script> <script src="https://unpkg.com/ topojson-client@3 "></script> <svg width="600" height="400"></svg>
source share