socib / Leaflet.TimeDimension

Add time dimension capabilities on a Leaflet map.
MIT License
435 stars 139 forks source link

Additional info example 16 #127

Closed guiguitcho closed 7 years ago

guiguitcho commented 7 years ago

Hi, It is not really an issue but I can not figure out how to make example 16 (portus) work for my own case. I have a tiled layer located in foo folder : 'foo/yyyymmdd.hhmm/z/x/y.png' There are tile layers for every 15min. I had no luck in modifying the portus example, with the source url: L.tileLayer('foo/Europe/{d}.{h}/{z}/{x}/{y}.png'} The minutes are not defined and L.tileLayer('foo/Europe/{d}.{h}{m}/{z}/{x}/{y}.png'} throw me an error... where are {d} and {h} defined ? How can I modify them to add minutes ?

Thanks in advance !

guiguitcho commented 7 years ago

I solved my problem: {d} and 'h} are defined in _createLayerForTime method. To get minutes in the url I added the following lines:

var min = new Date(time).getUTCMinutes();
if (min == '0'){min = '00'};
url = url.replace('{m}', min);

with the url defined by L.tileLayer('foo/Europe/{d}.{h}{m}/{z}/{x}/{y}.png'}