TopoJSON 📊

TopoJSON (Topology-Aware JSON)

Open Beta
.topojson · application/json

TopoJSON 是 GeoJSON 的拓扑扩展。采用共享弧段编码(多边形之间的边界仅存储一次)和坐标的整数量化——生成的文件比等效的 GeoJSON 小 60-80%。是 D3.js、Mapshaper 和 Observable 的标准输入;非常适合交互式分级统计图和 Web 地图集。

立即导出 TopoJSON ✨ Open Beta — 免费无限制

主要特点

共享弧段编码(比 GeoJSON 小 60-80%)
坐标整数量化
保留拓扑的简化
保留要素属性

关于 TopoJSON 格式

TopoJSON was invented by Mike Bostock, the author of D3.js, to solve a simple problem: in GeoJSON neighboring polygons store their shared border twice. TopoJSON moves all the lines into a common array of arcs that the objects then refer to. On top of that, coordinates are rounded to an integer grid and written as increments — the file gets sharply lighter.

The format is taken for web graphics and analytics: choropleths in D3, interactive atlases, boundary maps in Observable, lightweight layers for offline applications. The second motive is simplification: during generalization the shared borders move together, and no gaps appear between neighboring districts.

The output is a single document: every layer becomes a separate object inside it — roads, buildings, water and so on — and object attributes are preserved. Coordinates are in WGS84, up to 100,000 objects per layer. The topology is built by our own code, with no external dependencies.

The price of compactness is the rounding of coordinates. The grid step depends on the size of the area: for a district it is on the order of a meter, for a country hundreds of meters. For a web map that is invisible; for precise measurements take GeoJSON or GeoPackage.

打开 TopoJSON 文件的程序

以下程序可以打开、编辑和处理从 OSM2CDR 导出的 TopoJSON (Topology-Aware JSON)(.topojson)文件:

💻D3.js 💻Mapshaper 💻topojson-server 💻topojson-client 💻Observable 💻ndjson-cli

格式规格

谁在使用 TopoJSON 地图

🏗
D3.js 交互式分级统计地图
A choropleth in D3.js draws fast: shared district borders are stored and rendered once.
💻
网页地图集与地图类出版物
A web atlas and cartographic publications where page weight matters.
📊
轻量级行政边界地图
Administrative boundary layers that can be simplified without gaps between neighbors.
🎨
离线网页应用(PWA)
An offline application or a PWA: the map takes several times less space than in GeoJSON.
🗺
数据分析与可视化(Observable)
Exploratory analysis in Observable and notebooks — the data loads as a single small file.

如何导出 TopoJSON

1
选择区域
在 osm2cdr 的交互式地图上绘制矩形或多边形
2
选择 TopoJSON
从 127 种可用导出格式中选择 TopoJSON (Topology-Aware JSON)
3
导出
点击导出,1–5 分钟内收到您的 .topojson 文件
4
下载
下载完成的 TopoJSON 文件并在 D3.js 中打开

导出后如何打开

TopoJSON 格式的热门地图

Free

导出 TopoJSON (Topology-Aware JSON) 地图

从 OpenStreetMap 下载专业的 TopoJSON 地图。即时生成,任意区域。

免费 / 导出
立即导出 TopoJSON →

常见问题

TopoJSON 与 GeoJSON 有何区别?
我能把 TopoJSON 转回 GeoJSON 吗?
D3.js 为什么偏爱 TopoJSON?
TopoJSON 支持 3D 吗?
How are the layers arranged inside the file?
What is quantization and what does it affect?

相关格式

经常一起导出

Related Articles