Skip to content

Commit 0a7dafb

Browse files
committed
Added ability to use remote URL for GeoJSON
1 parent a9e97b0 commit 0a7dafb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

folium/folium.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from .map import LegacyMap, FitBounds
1616
from .features import GeoJson, TopoJson
1717

18+
import requests
1819

1920
class Map(LegacyMap):
2021
"""Create a Map with Folium and Leaflet.js
@@ -251,7 +252,11 @@ def choropleth(self, geo_path=None, geo_str=None, data_out='data.json',
251252

252253
# Create GeoJson object
253254
if geo_path:
254-
geo_data = open(geo_path)
255+
print("Using new folium")
256+
if geo_path.lower().startswith(('http','ftp','https')):
257+
geo_data = requests.get(geo_path).json()
258+
else:
259+
geo_data = open(geo_path)
255260
elif geo_str:
256261
geo_data = geo_str
257262
else:

0 commit comments

Comments
 (0)