folium 自定义地图瓷砖 [英] folium custom map tiles

查看:13
本文介绍了folium 自定义地图瓷砖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将此地图切片图层添加到我的地图 - 雄蕊碳粉-背景.正如我在文档中阅读的那样,我只需在地图的 tiles 属性中提供自定义 url

I want to add this map tile layer to my map – Stamen toner-background. As I read in documentation I need to simply give custom url in the tiles attribute of map

mapa = folium.Map(width=1000, height=700, zoom_start=5.5,
              location=[52.5, 19], tiles='http://maps.stamen.com/toner-background/embed#6/{x}/{z}', attr="toner-bcg")

它加载但什么都没有显示.

It loads but nothing is displayed.

我真的不知道这个归因是如何工作的,我应该怎么做.我喜欢瓷砖,因为它就像雄蕊调色剂,但没有国名,这让我的地图更漂亮.

I don't really know how this attribution thing works like and what should I do. I like the tile because it's like stamen toner but without country names and that makes my map a lot more beautiful.

推荐答案

这是你的幸运日,Stamen 设计内置在 Folium 中.您应该运行以下代码:

This is your lucky day, Stamen designs are built-in in Folium. You should run the following code:

mapa = folium.Map(width=1000, height=700, zoom_start=5.5,
              location=[52.5, 19], tiles='Stamen Toner')

这应该可以解决问题.

您的代码不起作用的原因是您没有使用正确的 URL 模板.格式是一种指定的这里:

The reason your code was not working is because you were not using the correct URL templates. The format is one specified here:

http://tile.stamen.com/toner/{z}/{x}/{y}.png
http://tile.stamen.com/terrain/{z}/{x}/{y}.jpg
http://tile.stamen.com/watercolor/{z}/{x}/{y}.jpg

http://tile.stamen.com/toner/{z}/{x}/{y}.png
http://tile.stamen.com/terrain/{z}/{x}/{y}.jpg
http://tile.stamen.com/watercolor/{z}/{x}/{y}.jpg

代码如下所示:

mapa = folium.Map(width=1000, height=700, zoom_start=5.5,
              location=[52.5, 19], tiles='http://tile.stamen.com/toner/{z}/{x}/{y}.png ')

这篇关于folium 自定义地图瓷砖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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