Skip to content

Commit 967dc75

Browse files
author
Martin Journois
committed
Fix bound undefinedness
1 parent f0e6cdb commit 967dc75

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

folium/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def __init__(self, image, bounds, opacity=1., attribution=None, origin='upper',
567567
super(ImageOverlay, self).__init__()
568568
self._name = 'ImageOverlay'
569569

570-
self.url = image_to_url(image, origin=origin, mercator_project=mercator_project)
570+
self.url = image_to_url(image, origin=origin, mercator_project=mercator_project, bounds=bounds)
571571

572572
self.bounds = json.loads(json.dumps(bounds))
573573
options = {

folium/utilities.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def mercator_transform(data, lat_bounds, origin='upper', height_out=None):
365365

366366
return out
367367

368-
def image_to_url(image, mercator_project=False, colormap=None, origin='upper'):
368+
def image_to_url(image, mercator_project=False, colormap=None, origin='upper', bounds=((-90,-180),(90,180))):
369369
"""Infers the type of an image argument and transforms it into a url.
370370
371371
Parameters
@@ -384,6 +384,9 @@ def image_to_url(image, mercator_project=False, colormap=None, origin='upper'):
384384
Hint : you can use colormaps from `matplotlib.cm`.
385385
mercator_project : bool, default False, used only for array-like image.
386386
Transforms the data to project (longitude,latitude) coordinates to the Mercator projection.
387+
bounds: list-like, default ((-90,-180),(90,180))
388+
Image bounds on the map in the form [[lat_min, lon_min], [lat_max, lon_max]].
389+
Only used if mercator_project is True.
387390
"""
388391
if hasattr(image,'read'):
389392
# We got an image file.

0 commit comments

Comments
 (0)