Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions folium/plugins/timestamped_geo_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from branca.element import CssLink, Figure, JavascriptLink, MacroElement

from folium.folium import Map
from folium.utilities import iter_points, none_max, none_min, parse_options
from folium.utilities import parse_options, get_bounds

from jinja2 import Template

Expand Down Expand Up @@ -227,17 +227,4 @@ def _get_self_bounds(self):
data = {'type': 'Feature', 'geometry': data}
data = {'type': 'FeatureCollection', 'features': [data]}

bounds = [[None, None], [None, None]]
for feature in data['features']:
for point in iter_points(feature.get('geometry', {}).get('coordinates', {})): # noqa
bounds = [
[
none_min(bounds[0][0], point[1]),
none_min(bounds[0][1], point[0]),
],
[
none_max(bounds[1][0], point[1]),
none_max(bounds[1][1], point[0]),
],
]
return bounds
return get_bounds(data, lonlat=True)
18 changes: 0 additions & 18 deletions folium/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,24 +410,6 @@ def _parse_size(value):
return value, value_type


def iter_points(x):
"""Iterates over a list representing a feature, and returns a list of points,
whatever the shape of the array (Point, MultiPolyline, etc).
"""
if not isinstance(x, (list, tuple)):
raise ValueError('List/tuple type expected. Got {!r}.'.format(x))
if len(x):
if isinstance(x[0], (list, tuple)):
out = []
for y in x:
out += iter_points(y)
return out
else:
return [x]
else:
return []


def compare_rendered(obj1, obj2):
"""
Return True/False if the normalized rendered version of
Expand Down