folium 使用本地瓦片_使用Folium的基于TopoJSON的Choropleth可视化

folium 使用本地瓦片

简介(我们将创建的内容): (Introduction (what we’ll create):)

As the title suggests, we will be creating a Choropleth visualization using a TopoJSON file in this tutorial. We will use Folium for that purpose. Folium is a library based on Leaflet.js (unlike Plotly, which is based on D3.js). The following image gives an idea of what we will be creating at the end of this tutorial:

如标题所示,在本教程中,我们将使用TopoJSON文件创建一个Choropleth可视化文件。 我们将为此目的使用Folium。 Folium是一个基于Leaflet.js的库(与基于D3.js的Plotly不同)。 下图给出了在本教程结尾处将要创建的内容的想法:

This is very similar to the visualization created in the Plotly tutorial. The same data set has been used for creating both the Plotly and the Folium visualizations. However, this visualization has been created using a TopoJSON file. The TopoJSON file, in turn, was created from the same GeoJSON that was used for the Plotly tutorial, using the conversion available on mapshaper.org. As you can see, while the GeoJSON file is 800 KB large, the corresponding TopoJSON is about one third the size, at 269 KB.

这与Plotly教程中创建的可视化非常相似。 相同的数据集已用于创建Plotly和Folium可视化图。 但是,此可视化是使用TopoJSON文件创建的。 该TopoJSON文件,反过来,是从被用于Plotly教程,利用系统提供的转换相同GeoJSON的创建mapshaper.org 。 如您所见,虽然GeoJSON文件的大小为800 KB,但相应的TopoJSON的大小约为269 KB,约为其三分之一。

The resulting difference can also be seen in the file sizes. The Jupyter Notebook for the Plotly visualization is more than 8 MB in size, while the Folium notebook is just about 1 MB in size. Folium also has a base map incorporated in the visualization (just like in the Plotly + Mapbox tutorial). However, Folium doesn’t have the level of interactivity of Plotly. You can zoom into the map, or pan the map, but hovering on any state will have no effect here, whereas Plotly displayed the count on hover. Here, the count has to be inferred manually using the color bar.

所产生的差异也可以在文件大小中看到。 用于Plotly可视化的Jupyter笔记本的大小超过8 MB,而Folium笔记本的大小仅为1 MB。 Folium在可视化中还包含一个基础地图(就像在Plotly + Mapbox教程中一样 )。 但是,大叶草不具有Plotly的交互性。 您可以放大地图或平移地图,但是将鼠标悬停在任何状态都不会产生任何影响,而“绘制”则会显示悬停时的计数。 在此,必须使用颜色条手动推断计数。

本教程的结构: (Structure of the tutorial:)

The tutorial is structured into the following sections:

本教程分为以下几节:

  1. Pre-requisites

    先决条件

  2. Installing Folium

    安装大叶草

  3. TopoJSON vs GeoJSON

    TopoJSON与GeoJSON

  4. Getting started with the tutorial

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值