May 2019
Beginner to intermediate
650 pages
14h 50m
English
The topojson.mesh() function returns a mesh of the entire topology, which includes outlines and borders between shapes.
const geomesh = topojson.mesh(data);
A mesh is a LineString rendered as a single path. It should not have any fill style, only stroke.
You can also filter the objects you want to mesh based on whether they share or not the same arcs. This can be used to separate the outline of a topology (for example the coastlines of the continent) from the internal borders. The filter takes two arguments that will be identical if an arc is used by a single geometry, and different if they are shared.
const borders = topojson.mesh(data, data.objects['africa'], (a,b) => a !== bconst outline = topojson.mesh(data, data.objects['africa'], ...
Read now
Unlock full access