May 2019
Beginner to intermediate
650 pages
14h 50m
English
The merge() function takes an array of geometries as the second argument, returning a single GeoJSON MultiPolygon with the union of all the objects in a geometry collection:
const polygon = topojson.merge(data, object.geometries)
Since a single object is returned, you can bind it to a path using selection.datum():
svg.append("path").datum(polygon).attr("d", geoPath);
The result is a map with a single shape created from all shapes combined, and no internal divisions. In this example you will see the entire continent of Africa, without any country borders. The full code is available in TopoJSON/4-merge-africa.html. See also 5-merge-shapes.html that contains the same code using another TopoJSON file containing simple shapes. ...
Read now
Unlock full access