Skip to content

Commit 2ed45a3

Browse files
authored
Merge pull request #657 from ocefpaf/expand_float_check
Minor fixes to the float check...
2 parents 4a15a4c + e8000f6 commit 2ed45a3

2 files changed

Lines changed: 29 additions & 13 deletions

File tree

CHANGES.txt

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,43 @@
55
- Updated to leaflet 1.1.0 (ocefpaf #639)
66
- Added `FastMarkerCluster` (James Gardiner #585 (proposed by @ruoyu0088))
77

8+
Bug Fixes
9+
10+
- Checking if the lat, lon locations are floats to avoid empty maps
11+
(radumas #626)
12+
13+
814
0.3.0
915
~~~~~
1016

1117
- Added `FastMarkerCluster` (James Gardiner #585 (proposed by @ruoyu0088))
1218
- Added style option to 'Timestamped geojson' plugin (soymsk #627)
1319
- Switched to `leaflet 1.0.1` (juoceano #531 and ocefpaf #535)
14-
- Added `continuous_world`, `world_copy_jump`, and `no_wrap` options (ocefpaf #508)
20+
- Added `continuous_world`, `world_copy_jump`, and `no_wrap` options
21+
(ocefpaf #508)
1522
- Update font-awesome to 4.6.3 (ocefpaf #478)
1623
- Added text path (talespaiva #451 and ocefpaf #474)
1724
- More options added to `LayerControl` (qingkaikong #473)
1825
- More options added to `fullscreen` plugin (qingkaikong #468)
1926
- Added `ColorLine` object (bibmartin #449)
2027
- Added highlight function to `GeoJSON`, and `Chrorpleth` (JoshuaCano #341)
2128
- Added `fullscreen` plugin (sanga #437)
22-
- Added `smooth_factor `option to `GeoJSON`, `TopoJSON` and `Choropleth` (JamesGardiner #428)
29+
- Added `smooth_factor `option to `GeoJSON`, `TopoJSON` and `Choropleth`
30+
(JamesGardiner #428)
2331
- `Map` object now accepts Leaflet global switches (sgvandijk #424)
2432
- Added weight option to CircleMarker (palewire #581)
25-
- Added requests support to enable http(s) and ftp for geo_path parameter (jreades #602)
33+
- Added requests support to enable http(s) and ftp for geo_path parameter
34+
(jreades #602)
2635

2736
Bug Fixes
2837

2938
- Fixed image order (juoceano #536)
3039
- Fixed Icon rotation (juoceano #530 and sseemayer #527)
3140
- Fixed MIME type (text/plain) is not executable (talespaiva #440)
32-
- Update Travis-CI testing to incorporate branca and fix notebook tests (ocefpaf #436)
33-
- Removed MultiPolyLine and MultiPolygon, both are handled by PolyLine and PolyLine in leaflet 1.0.* (ocefpaf #554)
41+
- Update Travis-CI testing to incorporate branca and fix notebook tests
42+
(ocefpaf #436)
43+
- Removed MultiPolyLine and MultiPolygon, both are handled by PolyLine and
44+
PolyLine in leaflet 1.0.* (ocefpaf #554)
3445
- Removed deprecated MapQuest tiles (HashCode55 #562)
3546

3647
0.2.1

folium/map.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,23 @@
6060
'https://rawgit.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css'), # noqa
6161
]
6262

63-
def _validate_location(values):
63+
64+
def _validate_location(location):
6465
"""Validates and formats location values before setting"""
65-
if type(values) not in [list, tuple]:
66-
raise TypeError("Location is not a list, expecting ex: location=[45.523, -122.675]")
66+
if type(location) not in [list, tuple]:
67+
raise TypeError('Expected tuple/list for location, got '
68+
'{!r}'.format(location))
6769

68-
if len(values) != 2:
69-
raise ValueError("Location should have two values, [lat, lon]")
70+
if len(location) != 2:
71+
raise ValueError('Expected two values for location [lat, lon], '
72+
'got {}'.format(len(location)))
7073

7174
try:
72-
values = [float(val) for val in values]
75+
location = [float(val) for val in location]
7376
except:
74-
raise ValueError("Location values should be numeric, {} is not a number".format(val))
75-
return values
77+
raise ValueError('Location values must be valid numeric values, '
78+
'got {!r}'.format(location))
79+
return location
7680

7781

7882
class LegacyMap(MacroElement):
@@ -351,6 +355,7 @@ def render(self, **kwargs):
351355

352356
super(LegacyMap, self).render(**kwargs)
353357

358+
354359
class GlobalSwitches(Element):
355360
def __init__(self, prefer_canvas=False, no_touch=False, disable_3d=False):
356361
super(GlobalSwitches, self).__init__()

0 commit comments

Comments
 (0)