Skip to content

Remote GeoJSON URLs in Folium (https? http?) #584

@jreades

Description

@jreades

Using release 0.2.1 there seems to be either a documentation clarity issue or an actual support issue. As I understand it from reading the docs, the following code should work:

import folium  
json_url = "https://raw.githubusercontent.com/datasets/geo-boundaries-world-110m/master/countries.geojson"
m = folium.Map(location=(0,0), zoom_start=2)
m.choropleth(geo_path=json_url)
m

Note: I've stripped out the choropleth styling parameters for simplicity's sake.

Instead, I get the following error:

IOError: [Errno 2] No such file or directory: 'https://raw.githubusercontent.com/datasets/geo-boundaries-world-110m/master/countries.geojson'

This error implies that only locally-accessible files are supported, but the documentation states only that:

Parameters
    ----------
    geo_path: string, default None
        URL or File path to your GeoJSON data

I can obviously get around this using the requests library and passing r.json() to the geo_str parameter, but it would be more elegant and useful (as well as being consistent with the documentation) if that weren't actually necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue describing unexpected or malicious behaviour

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions