perliedman / leaflet-realtime

Put realtime data on a Leaflet map
ISC License
737 stars 169 forks source link

setUrl() problems #160

Closed wolkenloseswetter closed 4 years ago

wolkenloseswetter commented 4 years ago

Hi,

I'm referring to issue #15.

I would like to change the source-url dynamically depending on the input of the user during the update loop (I receive data from my server with "get_JSON.php?scanback=24" [or 48, 12, or 6 hours]).

I tried setUrl(), but something goes wrong, or I don't understand the function.

realtime.setUrl("get_JSON.php?scanback=48");

I made a plunk with a modified earthquake example, here you can see the behavior.

https://next.plnkr.co/edit/weeikt129ADzHFrh

Maybe for you a bagatelle.

Thanks a lot!

wolkenloseswetter commented 4 years ago

After a sleepless night, I think a have solved my problem. I have used leaftlet.js < vers. 1.0 and newest leaflet-realtime.js. OmG. Readme, first paragraph.

Now, setUrl() is running.

I have updated the code:

https://next.plnkr.co/edit/weeikt129ADzHFrh