Skip to content

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

Description

@joncto

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions