-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Hi,
I'm just trying out PyMove because it seems like it could bring a lot to my current project.
But I can't get any folium functionality to work, though.
Here's an extract of what I'm doing:
df.head()
absolute_time | lat | lng | id |
---|---|---|---|
2021-09-09 10:32:27.000 | 45.818459 | 3.139887 | 54 |
2021-09-09 10:32:28.000 | 45.818459 | 3.139887 | 54 |
2021-09-09 10:32:29.044 | 45.818459 | 3.139887 | 54 |
2021-09-09 10:32:30.000 | 45.818459 | 3.139887 | 54 |
2021-09-09 10:32:31.000 | 45.818459 | 3.139887 | 54 |
move_df = MoveDataFrame(data=df, latitude='lat', longitude='lng', datetime='absolute_time')
from pymove import folium as f
f.plot_trajectories(move_df)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-159-487305dba7d4> in <module>()
1 from pymove import folium as f
----> 2 f.plot_trajectories(move_df)
2 frames
/usr/local/lib/python3.7/dist-packages/pymove/visualization/folium.py in plot_trajectories(move_data, n_rows, lat_origin, lon_origin, zoom_start, legend, base_map, tile, save_as_html, color, color_by_id, filename)
993
994 _add_trajectories_to_map(
--> 995 mv_df, items, base_map, legend, save_as_html, filename
996 )
997
/usr/local/lib/python3.7/dist-packages/pymove/visualization/folium.py in _add_trajectories_to_map(move_data, items, base_map, legend, save_as_html, filename)
896 mv = move_data[move_data[TRAJ_ID] == _id]
897
--> 898 _add_begin_end_markers_to_map(mv, base_map, color, _id)
899
900 folium.PolyLine(
/usr/local/lib/python3.7/dist-packages/pymove/visualization/folium.py in _add_begin_end_markers_to_map(move_data, base_map, color, _id)
837 popup='Início',
838 icon=plugins.BeautifyIcon(
--> 839 icon='play', icon_shape='marker', background_color=color or 'green'
840 )
841 ).add_to(points)
TypeError: __init__() got an unexpected keyword argument 'color'
Or if I just try to plot the bounding box, I get a different error.
f.plot_bbox(move_df.get_bbox(), color='blue')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-161-03377951b622> in <module>()
----> 1 f.plot_bbox(move_df.get_bbox(), color='blue')
6 frames
/usr/local/lib/python3.7/dist-packages/pymove/visualization/folium.py in plot_bbox(bbox_tuple, base_map, tiles, color, save_as_html, filename)
1688 base_map = folium.Map(tiles=tiles)
1689 base_map.fit_bounds(
-> 1690 [[bbox_tuple[0], bbox_tuple[1]], [bbox_tuple[2], bbox_tuple[3]]]
1691 )
1692 points_ = [
/usr/local/lib/python3.7/dist-packages/folium/folium.py in fit_bounds(self, bounds, padding_top_left, padding_bottom_right, padding, max_zoom)
411 'Choropleth class, which has the same arguments. See the example '
412 'notebook \'GeoJSON_and_choropleth\' for how to do this.',
--> 413 FutureWarning
414 )
415 from folium.features import Choropleth
/usr/local/lib/python3.7/dist-packages/folium/map.py in __init__(self, bounds, padding_top_left, padding_bottom_right, padding, max_zoom)
456 Bounding box specified as two points [southwest, northeast]
457 padding_top_left: (x, y) point, default None
--> 458 Padding in the top left corner. Useful if some elements in
459 the corner, such as controls, might obscure objects you're zooming
460 to.
/usr/lib/python3.7/json/__init__.py in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
229 cls is None and indent is None and separators is None and
230 default is None and not sort_keys and not kw):
--> 231 return _default_encoder.encode(obj)
232 if cls is None:
233 cls = JSONEncoder
/usr/lib/python3.7/json/encoder.py in encode(self, o)
197 # exceptions aren't as detailed. The list call should be roughly
198 # equivalent to the PySequence_Fast that ''.join() would do.
--> 199 chunks = self.iterencode(o, _one_shot=True)
200 if not isinstance(chunks, (list, tuple)):
201 chunks = list(chunks)
/usr/lib/python3.7/json/encoder.py in iterencode(self, o, _one_shot)
255 self.key_separator, self.item_separator, self.sort_keys,
256 self.skipkeys, _one_shot)
--> 257 return _iterencode(o, 0)
258
259 def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
/usr/lib/python3.7/json/encoder.py in default(self, o)
177
178 """
--> 179 raise TypeError(f'Object of type {o.__class__.__name__} '
180 f'is not JSON serializable')
181
TypeError: Object of type float16 is not JSON serializable
I'm using python version 3.7, PyMove
version 3.0.0, and folium
version 0.8.3
Metadata
Metadata
Assignees
Labels
No labels