python-visualization / python-visualization/folium

Map output from OSM returns blocked tiles, due to defective request or not following referer-policy

未关闭
#2,236 5 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
7.4k
派生
2.3k
平均合并
17 小时 22 分钟
30 天内合并 PR
11

描述

Bug description
I am plotting a data set to be projected on a map, using Folium. However, the default OSM representation doesn't work properly.

The map renders as this, displaying a lot of warnings on 403 errors:

Image

Reading the OSM wiki page about Blocked tiles, one might assume that Folium currently doesn't comply to OSM's policies?

To Reproduce
Code excerpt:

import folium

# convert to pandas dataframe
import pandas as pd
df = pd.DataFrame(folkegrupper, columns=["Historic name", "Modern name", "English name", "Area", "Longitude", "Latitude"])

# create map
m = folium.Map(location=[30, 70], zoom_start=3)

# add points to map
for index, row in df.iterrows():
    folium.CircleMarker(
        location=[row["Longitude"], row["Latitude"]],
        radius=15,
        color="blue",
        fill=True,
        fill_color="blue",
        fill_opacity=0.6,
        tooltip=f"Modern name: {row['Modern name']}",
        popup=f"Historic name: {row['Historic hame']}<br>Area: {row['Area']}"
    ).add_to(m)

# display map
m

Example data for testing code above (variable must be run before the code)

folkegrupper = [
    ("group1a", "group1b", "group1c", "Sør-Afrika", -30.0550, 23.6235),
    ("group2a", "group2b", "group2c", "Malaysia", 4.2105, 101.6864),
    ("group3a", "group3b", "group3c", "Nord-Russland", 59.4372, 105.3305),
    ("group4a", "group4b", "group4c", "Midtøsten", 27.2750, 49.8718),
    ("group5a", "group5b", "group5c", "India", 20.5937, 78.9629),
    ("group6a", "group6b", "group6c", "Verden", 0, 0),
    ("group7a", "group7b", "group7c", "Sør-Afrika", -25.7302, 28.2092)
]

Expected behavior
GIVEN valid code and a dataset with geodata,
WHEN the code is run,
THEN an interactive map should display without blocked tiles

Environment info

  • Browser: Firefox 151.0.3 (used to display html output)
  • Python version: 3.12.13
  • folium version: 0.20.0

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用提供的 Folium 示例重现该问题,并检查浏览器的瓦片请求和默认的 OSM 瓦片配置。确定请求策略的定义位置,并通过确认生成的交互式地图能够加载瓦片且没有 403 警告来验证修复结果。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。