socib / Leaflet.TimeDimension

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

is it possible to change timeinterval after creating map object? #205

Open tekija opened 3 years ago

tekija commented 3 years ago

after creating map:

     map =  L.map('map', {

        timeDimension: true,
            timeDimensionOptions: {
            timeInterval: "2021-02-25T00:00:00.000Z"+"/"+"2021-02-26T23:00:00.000Z",
            period: "PT1H",
            currentTime: Date.parse("2021-02-25T00:00:00.000Z")
        }
    });

I am later in code trying to change timeInterval range via L.timeDimension:

   tds= L.timeDimension({
        timeInterval: "2021-02-25T00:30:00.000Z"+"/"+"2021-02-26T23:30:00.000Z",
        period: "PT1H",
        currentTime: Date.parse("2021-02-25T00:30:00.000Z")

    })
tds.addTo(map)

But I get error: Uncaught TypeError: this.onAdd is not a function Is it even possible to change timeInterval after creating map? I guess I am not casting something properly, any help is appreceated. Thanks in advance.