topomerge - Man Page

merges the source TopoJSON geometry collection, assigning to the target


topomerge [options] <target=source> [file]


Merges polygons (or meshes lines) from the specified source TopoJSON geometry collection object, assigning to the target object.


-h,  --help

Output usage information.


Output the version number.

-o--out file

Specify the output TopoJSON file name. Defaults to - for stdout.

-k--key expression

Specify a JavaScript expression, given a TopoJSON geometry object d and its zero-based index i in its parent collection, that determines how geometry objects are grouped before merging; each group is merged separately. For example, given a topology of U.S. counties, where the id of each county is its five-digit FIPS code, the county boundaries can be merged into state boundaries by using the first two digits of the county FIPS code, which represents the state FIPS code:

topomerge states=counties -k ', 2)' < us-counties.json > us-states.json

If a key is not specified, all input geometry objects will be merged together. For example, this can be used to merge the state boundaries into a single nation boundary:

topomerge nation=states < us-states.json > us.json
-f--filter expression

Specify a JavaScript expression that filters the input geometries before merging or meshing. In conjunction with --mesh, the expression is given two TopoJSON geometry objects a and b that represent the adjacent features for a given arc segment; if the expression evaluates truthily, the associated arc segment is retained in mesh. Otherwise, the expression is given an input TopoJSON geometry object d and its zero-based index i in its parent collection; if the expression evaluates truthily, the geometry object is retained in the merged polygon.


Generate a geometry collection of lines rather than polygons.

See Also

geo2topo(1), topo2geo(1), topoquantize(1), toposimplify(1)

Referenced By

geo2topo(1), topo2geo(1), topoquantize(1), toposimplify(1).

January 2021