叶片定制地图瓷砖 [英] folium custom map tiles

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

问题描述

我想将此地图图块图层添加到我的地图– 雄蕊碳粉-背景. 正如我在文档中阅读的那样,我只需要在map的tile属性中提供自定义网址

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.

推荐答案

这是您的幸运日,雄蕊设计内置在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 ')

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

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