python-visualization / python-visualization/folium

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

Offen
#2,236 5 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
7.4k
Forks
2.3k
Ø Merge
17 Std. 22 Min.
Gemergte PRs (30 T.)
11

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduzieren Sie das Problem mit dem bereitgestellten Folium-Beispiel und untersuchen Sie die Kachel-Anfragen des Browsers sowie die standardmäßige OSM-Kachelkonfiguration. Ermitteln Sie, wo die Anfrage-Richtlinie definiert ist, und überprüfen Sie die Behebung, indem Sie bestätigen, dass die generierte interaktive Karte Kacheln ohne 403-Warnungen lädt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.