How to control features of timeslider in folium map?

Viewed 3220

I have a map rendered from folium. I am using python. How can I remove elements of folim time slider? For example: I want to remove speed slider. I can see methods on leaflet.js but I am not sure how to do it.Please help

2 Answers

If you need to locate markers without time slider, get rid of using folium.plugins.TimestampedGeoJson as in your previous questions in such a way that

import folium

m = folium.Map(location=[40.0001,32.4589], zoom_start = 13)

folium.Marker([40.0001,32.4789],
              popup='<strong>My First Point</strong>',
              tooltip='First Point',
              icon=folium.Icon(color='purple',icon='leaf')).add_to(m)

folium.Marker([40.0001,32.4989],
              popup='<strong>My Second Point</strong>',
              tooltip='Second Point',
              icon=folium.Icon(color='beige',icon='leaf')).add_to(m)

m.save('map.html')

since TimestampedGeoJson basically contains features which have a times property with the same length as the coordinates array and this needs a time slider.

Apparently, folium only gives options to add few elements of timeslider. Here is a portion of code from time_stamped_jeojson.py from their repository.

self.options = parse_options(
            position='bottomleft',
            min_speed=min_speed,
            max_speed=max_speed,
            auto_play=auto_play,
            loop_button=loop_button,
            time_slider_drag_update=time_slider_drag_update,
            player_options={
                'transitionTime': int(transition_time),
                'loop': loop,
                'startOver': True
            }

We can remove loop_button and change other portion. One way to deal it with could be changing parameters based on requirement on the function. Look at leaflet.timedimension.control.js. You can get idea of what to change and where to look at.

Related