Skip to content

Commit fcf254f

Browse files
authored
Merge pull request #1294 from Conengmo/remove-iter-points-utility
Remove iter_points utility function
2 parents 4d04460 + 065e0b6 commit fcf254f

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

folium/plugins/timestamped_geo_json.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from branca.element import CssLink, Figure, JavascriptLink, MacroElement
66

77
from folium.folium import Map
8-
from folium.utilities import iter_points, none_max, none_min, parse_options
8+
from folium.utilities import parse_options, get_bounds
99

1010
from jinja2 import Template
1111

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

230-
bounds = [[None, None], [None, None]]
231-
for feature in data['features']:
232-
for point in iter_points(feature.get('geometry', {}).get('coordinates', {})): # noqa
233-
bounds = [
234-
[
235-
none_min(bounds[0][0], point[1]),
236-
none_min(bounds[0][1], point[0]),
237-
],
238-
[
239-
none_max(bounds[1][0], point[1]),
240-
none_max(bounds[1][1], point[0]),
241-
],
242-
]
243-
return bounds
230+
return get_bounds(data, lonlat=True)

folium/utilities.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -410,24 +410,6 @@ def _parse_size(value):
410410
return value, value_type
411411

412412

413-
def iter_points(x):
414-
"""Iterates over a list representing a feature, and returns a list of points,
415-
whatever the shape of the array (Point, MultiPolyline, etc).
416-
"""
417-
if not isinstance(x, (list, tuple)):
418-
raise ValueError('List/tuple type expected. Got {!r}.'.format(x))
419-
if len(x):
420-
if isinstance(x[0], (list, tuple)):
421-
out = []
422-
for y in x:
423-
out += iter_points(y)
424-
return out
425-
else:
426-
return [x]
427-
else:
428-
return []
429-
430-
431413
def compare_rendered(obj1, obj2):
432414
"""
433415
Return True/False if the normalized rendered version of

0 commit comments

Comments
 (0)