Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

An extension of GeoJSON that encodes topology! 🌐

License

NotificationsYou must be signed in to change notification settings

topojson/topojson

Repository files navigation

TopoJSON is an extension of GeoJSON that encodes topology. Rather than representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments calledarcs. This technique is similar toMatt Bloch’s MapShaper and theArc/Info Export format, .e00.

TopoJSON eliminates redundancy, allowing related geometries to be stored efficiently in the same file. For example, the shared boundary between California and Nevada is represented only once, rather than being duplicated for both states. A single TopoJSON file can contain multiple feature collections without duplication, such as states and counties. Or, a TopoJSON file can efficiently represent both polygons (for fill) and boundaries (for stroke) as two feature collections that share the same arc mesh. SeeHow To Infer Topology for a visual explanation of how TopoJSON works. SeeCommand-Line Cartography for an introduction to TopoJSON and related tools. SeeTopoJSON Format Specification for the format specification.

To further reduce file size, TopoJSON can use quantized delta-encoding for integer coordinates. This is similar to rounding coordinate values (e.g.,LilJSON), but with greater efficiency and control over loss of information. And like GeoJSON, TopoJSON files are easily modified in a text editor and amenable to gzip compression.

As a result, TopoJSON is substantially more compact than GeoJSON, frequently offering a reduction of 80% or more even without simplification. Yet encoding topology also has numerous useful applications for maps and visualization above! It allowstopology-preserving shape simplification, which ensures that adjacent features remain connected after simplification; this applies even across feature collections, such as simultaneous consistent simplification of state and county boundaries. Topology can also be used forDorling orhexagonal cartograms, as well as other techniques that need shared boundary information such asautomatic map coloring.

Installing

If you use NPM,npm install topojson. Otherwise, download thelatest release. You can also load directly fromd3js.org as astandalone library. AMD, CommonJS, and vanilla environments are supported. In vanilla, atopojson global is exported:

<scriptsrc="https://unpkg.com/topojson@3"></script><script>vartopology=topojson.topology({foo:geojson});</script>

Try topojson in your browser.

API Reference


[8]ページ先頭

©2009-2025 Movatter.jp