GeoJSON和TopoJSON之间的区别 [英] Difference between GeoJSON and TopoJSON

查看:709
本文介绍了GeoJSON和TopoJSON之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GeoJSON和TopoJSON之间有什么区别,我什么时候使用其中一个?

What is the difference between GeoJSON and TopoJSON and when would I use one over the other?

描述TopoJSON on GitHub 意味着TopoJSON文件小了80%。那么为什么不是一直使用TopoJSON?

The description of TopoJSON on GitHub implies the TopoJSON files are 80% smaller. So why not just use TopoJSON all the time?

推荐答案

如果你关心文件大小或拓扑,如果你不在乎,那么为了简单起见,使用GeoJSON。

If you care about file size or topology, then use TopoJSON. If you don’t care about either, then use GeoJSON for simplicity’s sake.

TopoJSON的主要优点是大小。通过消除冗余并使用更有效的坐标的固定精度整数编码,TopoJSON文件通常比GeoJSON文件小一个数量级。 TopoJSON文件的第二个优点是编码拓扑具有有用的应用程序,例如拓扑保存简化(类似于 MapShaper )和自动网格生成(如此示例choropleth 中的状态边界)。

The primary advantage of TopoJSON is size. By eliminating redundancy and using a more efficent fixed-precision integer encoding of coordinates, TopoJSON files are often an order of magnitude smaller than GeoJSON files. The secondary advantage of TopoJSON files is that encoding the topology has useful applications, such as topology-preserving simplification (similar to MapShaper) and automatic mesh generation (as in the state-state boundaries in this example choropleth).

这些优点是成本:更复杂的文件格式。例如,在JavaScript中,您通常使用 TopoJSON客户端库将TopoJSON转换为GeoJSON以便与标准工具(如 d3.geo.path )配合使用。 (在Python中,您可以使用 topojson.py 。)此外,TopoJSON的整数格式需要量化坐标,这意味着如果你不小心,它可能引入舍入误差。 (请参阅 topojson -q 的文档。)

These advantages come at a cost: a more complex file format. In JavaScript, for example, you’d typically use the TopoJSON client library to convert TopoJSON to GeoJSON for use with standard tools such as d3.geo.path. (In Python, you can use topojson.py.) Also, TopoJSON’s integer format requires quantizing coordinates, which means that it can introduce rounding error if you’re not careful. (See the documentation for topojson -q.)

对不需要拓扑的几何的服务器端操作,那么GeoJSON可能是更简单的选择。否则,如果您需要拓扑或想通过线将几何发送到客户端,则使用TopoJSON。

For server-side manipulation of geometries that does not require topology, then GeoJSON is probably the simpler choice. Otherwise, if you need topology or want to send the geometry over the wire to a client, then use TopoJSON.

这篇关于GeoJSON和TopoJSON之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆