cnmaps icon indicating copy to clipboard operation
cnmaps copied to clipboard

考虑使用 topojson 格式来降低数据大小

Open Clarmy opened this issue 2 years ago • 2 comments

经过比对,同为山西省的矢量数据,用 geojson 存储的文件大小是 360kb ,而用 topojson 存储的文件大小仅为 85kb,在QGIS中检查二者在精确程度上没有任何区别。

但 topojson 是一个小众的格式,对应的 python sdk 功能并不完善,如果使用 topojson 来存储的话,对于格式的各种转换会产生额外的开销,但同时 topojson 有另一个好处是它可以很方便对矢量数据进行精细度调整并不破坏其拓扑关系。

参考资料:

  • https://mattijn.github.io/topojson/
  • https://zhuanlan.zhihu.com/p/361132666

Clarmy avatar Aug 11 '22 17:08 Clarmy

@ZhaJiMan

Clarmy avatar Aug 11 '22 17:08 Clarmy

https://github.com/ringsaturn/cnmaps-compress

测试多边形文件用有损压缩并处理成 probuf 全国数据约 20MB

ringsaturn avatar Sep 12 '22 09:09 ringsaturn