def __init__(self, data, transition_time=200, loop=True, auto_play=True,
                 period="P1D"):
        """Creates a TimestampedGeoJson plugin to append into a map with
        Map.add_children.

        Parameters
        ----------
        data: file, dict or str.
           The timestamped geo-json data you want to plot.

           * If file, then data will be read in the file and fully
             embedded in Leaflet's javascript.
           * If dict, then data will be converted to json and embedded in
             the javascript.
           * If str, then data will be passed to the javascript as-is.

           A geo-json is timestamped if:
               * it contains only features of types LineString,
                 MultiPoint, MultiLineString and MultiPolygon.
               * each feature has a "times" property with the same length
                 as the coordinates array.
               * each element of each "times" property is a timestamp in
                 ms since epoch, or in ISO string.
               Eventually, you may have Point features with a "times"
               property being an array of length 1.

           examples :
              # providing file
              TimestampedGeoJson(open('foo.json'))

              # providing dict
              TimestampedGeoJson({
                "type": "FeatureCollection",
                   "features": [
                     {
                       "type": "Feature",
                       "geometry": {
                         "type": "LineString",
                         "coordinates": [[-70,-25],[-70,35],[70,35]],
                         },
                       "properties": {
                         "times": [1435708800000, 1435795200000, 1435881600000]
                         }
                       }
                     ]
                   })

              # providing string
              TimestampedGeoJson(open('foo.json').read())
        transition_time : int, default 200.
            The duration in ms of a transition from between timestamps.
        loop : bool, default True
            Whether the animation shall loop.
        auto_play : bool, default True
            Whether the animation shall start automatically at startup.
        period : str, default "P1D"
            Used to construct the array of available times starting
            from the first available time. Format: ISO8601 Duration
            ex: "P1M" -> 1/month
                "P1D"  -> 1/day
                "PT1H"  -> 1/hour
                "PT1M"  -> 1/minute
        """
        super(TimestampedGeoJson, self).__init__()
        self._name = 'TimestampedGeoJson'

        # self.template = self.env.get_template('timestamped_geo_json.tpl')
        if 'read' in dir(data):
            self.embed = True
            self.data = data.read()
        elif type(data) is dict:
            self.embed = True
            self.data = json.dumps(data)
        else:
            self.embed = False
            self.data = data
        self.transition_time = int(transition_time)
        self.loop = bool(loop)
        self.auto_play = bool(auto_play)
        self.period = period

        self._template = Template("""
        {% macro script(this, kwargs) %}
            {{this._parent.get_name()}}.timeDimension = L.timeDimension({period:"{{this.period}}"});
            {{this._parent.get_name()}}.timeDimensionControl = L.control.timeDimension({
                position: 'bottomleft',
                autoPlay: {{'true' if this.auto_play else 'false'}},
                playerOptions: {
                    transitionTime: {{this.transition_time}},
                    loop: {{'true' if this.loop else 'false'}}}
                    });
            {{this._parent.get_name()}}.addControl({{this._parent.get_name()}}.timeDimensionControl);

            var {{this.get_name()}} = L.timeDimension.layer.geoJson(
                L.geoJson({{this.data}}),
                {updateTimeDimension: true,addlastPoint: true}
                ).addTo({{this._parent.get_name()}});
        {% endmacro %}
        """)  # noqa
dataset/ETHPy150Open python-visualization/folium/folium/plugins/timestamped_geo_json.py/TimestampedGeoJson.__init__/original