socib / Leaflet.TimeDimension

Add time dimension capabilities on a Leaflet map.
MIT License
433 stars 138 forks source link

i need to represent geo data in miliseconds #232

Open NataliaCampos-Pietanesi opened 2 months ago

NataliaCampos-Pietanesi commented 2 months ago

Hi i need to represent data that has different long lat per 100 miliseconds more or less, and the period parameter only gives me the option to put in seconds, so i have in every second all the data represent at the same time, and i need to see it indepently in every milisecond that it occurrs. Thanks a lot Here is some example data: start_geojson1 = [{'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614925534909888, 43.10203250378655]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:3.8228061569467195 car_1', 'popup': '2024-06-26 14:31:43.267000 index:0', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614968685776747, 43.10199635105799]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:3.755628040062408 car_2', 'popup': '2024-06-26 14:31:43.270000 index:1', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614891111184642, 43.10244942928305]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:5.16605026190332 car_3', 'popup': '2024-06-26 14:31:43.271000 index:2', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.61492451843729, 43.102037380768955]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.20118531187136 car_1', 'popup': '2024-06-26 14:31:43.387000 index:3', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614970578353914, 43.10200140790472]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.248070150077562 car_2', 'popup': '2024-06-26 14:31:43.388000 index:4', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614891549233812, 43.10245277741873]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:5.19298446504455 car_3', 'popup': '2024-06-26 14:31:43.390000 index:5', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614928061166649, 43.10204264310815]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.0658772761462565 car_1', 'popup': '2024-06-26 14:31:43.507000 index:6', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614973151404881, 43.10200792929416]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.413139751821108 car_2', 'popup': '2024-06-26 14:31:43.511000 index:7', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614891213230031, 43.10245830955441]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.990936229239516 car_3', 'popup': '2024-06-26 14:31:43.512000 index:8', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614927687956056, 43.10204600310815]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.198088924412573 car_1', 'popup': '2024-06-26 14:31:43.627000 index:9', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614975323613487, 43.10201191881929]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.371417404392921 car_2', 'popup': '2024-06-26 14:31:43.628000 index:10', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614889021862622, 43.10246148969008]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.434245241769539 car_3', 'popup': '2024-06-26 14:31:43.631000 index:11', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614925897431769, 43.102051042158415]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.4653150248980396 car_1', 'popup': '2024-06-26 14:31:43.747000 index:12', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614976442139994, 43.10201677800522]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.561479346344191 car_2', 'popup': '2024-06-26 14:31:43.751000 index:13', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614887426965831, 43.10246730941873]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.498987677624135 car_3', 'popup': '2024-06-26 14:31:43.754000 index:14', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614928265269068, 43.10205507510815]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:3.9404707683912834 car_1', 'popup': '2024-06-26 14:31:43.867000 index:15', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614978567560829, 43.1020218901409]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:3.9644439773284845 car_2', 'popup': '2024-06-26 14:31:43.868000 index:16', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.61488790222532, 43.10247038182577]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.242221785690102 car_3', 'popup': '2024-06-26 14:31:43.871000 index:17', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614930073844766, 43.10205840544736]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:3.9404707683912834 car_1', 'popup': '2024-06-26 14:31:43.987000 index:18', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614980012508479, 43.10202629966602]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.096482381412314 car_2', 'popup': '2024-06-26 14:31:43.989000 index:19', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.6148869229605864, 43.10247362223281]}, 'properties': {'time': '2024-04-08 14:31:43', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:3.9644439773284845 car_3', 'popup': '2024-06-26 14:31:43.990000 index:20', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614927024427077, 43.102065855819205]}, 'properties': {'time': '2024-04-08 14:31:44', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:5.02303938779022 car_1', 'popup': '2024-06-26 14:31:44.107000 index:21', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614980599405726, 43.10203312051275]}, 'properties': {'time': '2024-04-08 14:31:44', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.406371509134906 car_2', 'popup': '2024-06-26 14:31:44.111000 index:22', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614885206853245, 43.102479723622245]}, 'properties': {'time': '2024-04-08 14:31:44', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.241556463675996 car_3', 'popup': '2024-06-26 14:31:44.112000 index:23', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614928385371943, 43.102068826429765]}, 'properties': {'time': '2024-04-08 14:31:44', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.03158915455294 car_1', 'popup': '2024-06-26 14:31:44.227000 index:24', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.6149815967226875, 43.10203744010572]}, 'properties': {'time': '2024-04-08 14:31:44', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.532173190327658 car_2', 'popup': '2024-06-26 14:31:44.230000 index:25', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614884143588295, 43.10248395328306]}, 'properties': {'time': '2024-04-08 14:31:44', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.323618883168866 car_3', 'popup': '2024-06-26 14:31:44.231000 index:26', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614933018997091, 43.102072252633285]}, 'properties': {'time': '2024-04-08 14:31:44', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.122139711660844 car_1', 'popup': '2024-06-26 14:31:44.348000 index:27', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=218.0&g=112.0&b=214.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.6149815031463834, 43.10204212535949]}, 'properties': {'time': '2024-04-08 14:31:44', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.471314469637775 car_2', 'popup': '2024-06-26 14:31:44.350000 index:28', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=255.0&g=99.0&b=71.0', 'iconSize': [15, 15]}}}, {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-7.614879555641897, 43.102489509147375]}, 'properties': {'time': '2024-04-08 14:31:44', 'style': {'color': '', 'weight': 1}, 'icon': 'marker', 'tooltip': 'speed:4.445353934718092 car_3', 'popup': '2024-06-26 14:31:44.354000 index:29', 'iconstyle': {'iconUrl': 'https://iconmonstr.com/wp-content/g/gd/makefg.php?i=../releases/preview/2016/png/iconmonstr-car-3.png&r=0.0&g=128.0&b=128.0', 'iconSize': [15, 15]}}}] And this is the way that i made the map: m = folium.Map(location=[42.10258,-8.61437], zoom_start=18,

max_zoom=25, control_scale=True) # pista ctag

basemaps['Google Satellite'].add_to(m) folium.plugins.TimestampedGeoJson(start_geojson1, period="PT1S", date_options='HH:mm:ss', transition_time= 100, duration= "PT0S", add_last_point=True, time_slider_drag_update=True ).add_to(m) folium.LayerControl('topright', collapsed=True).add_to(m) m image

r1m commented 1 month ago

Your time property is set to the second only. 'properties': {'time': '2024-04-08 14:31:43',

NataliaCampos-Pietanesi commented 1 month ago

Yes this is the only Way that works but i need to set it using the miliseconds that are in the pop up, and when I do that and try to use the slider to represent it it doesn’t work…so that’s the question I have 2 problems one to set to miliseconds and the map work with it and 2 that the slider shows every point separately.

r1m commented 1 month ago

You need to change the timedimension times sandbox

NataliaCampos-Pietanesi commented 4 weeks ago

You need to change the timedimension times sandbox

ok, great that was what i want! but how can i do it for python?could you help me please? thanks a lot Natalia