Skip to content

Commit 3061dbc

Browse files
committed
always embed data
1 parent 3446344 commit 3061dbc

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

folium/features.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,22 +468,18 @@ def __init__(self, data, style_function=None, name=None,
468468
super(GeoJson, self).__init__(name=name, overlay=overlay,
469469
control=control)
470470
self._name = 'GeoJson'
471-
if hasattr(data, 'read'):
472-
self.embed = True
473-
self.data = json.load(data)
474-
elif isinstance(data, dict):
471+
if isinstance(data, dict):
475472
self.embed = True
476473
self.data = data
477474
elif isinstance(data, text_type) or isinstance(data, binary_type):
478475
self.embed = True
479476
if data.lower().startswith(('http:', 'ftp:', 'https:')):
480477
self.data = requests.get(data).json()
481-
print(data)
482478
elif data.lstrip()[0] in '[{': # This is a GeoJSON inline string
483479
self.data = json.loads(data)
484480
else: # This is a filename
485-
self.embed = False
486-
self.data = data
481+
with open(data) as f:
482+
self.data = json.loads(f.read())
487483
elif data.__class__.__name__ in ['GeoDataFrame', 'GeoSeries']:
488484
self.embed = True
489485
if hasattr(data, '__geo_interface__'):

0 commit comments

Comments
 (0)