Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var time=0;
- // display weather data
- jetscope.timeline.addHandler('precipitation', function (event) {
- //layers['Precipitation'].clearLayers();
- //var features = [];
- console.log(time);
- console.log(event.time);
- if(event.time!=time)
- {
- layers['Precipitation'].clearLayers();
- time = event.time;
- }
- else
- {
- console.log(event);
- console.log(event.time);
- switch (event.action) {
- case 'update': {
- //features.append(event.features);
- //console.log(event);
- L.geoJSON(event.features, {
- style: function(feature) {
- // console.log("-----");
- // console.log(feature.geometry.level);
- // console.log(feature.geometries);
- switch (feature.geometry.level) {
- case 1:
- {
- console.log("1");
- return {
- color: "#0000FF",
- fillColor: "#0000FF",
- fillOpacity: 1,
- weight: 1
- }
- }
- case 2:
- {
- console.log("2");
- return {
- color: "#000FF0",
- fillColor: "#000FF0",
- fillOpacity: 1,
- weight: 1
- };
- }
- case 3:
- {
- console.log("3");
- return {
- color: "#00FF00",
- fillColor: "#00FF00",
- fillOpacity: 1,
- weight: 1
- };
- }
- case 4:
- {
- console.log("4");
- return {
- color: "#0FF000",
- fillColor: "#0FF000",
- fillOpacity: 1,
- weight: 1
- };
- }
- default:
- {
- console.log("5");
- return {
- color: "#FF0000",
- fillColor: "#FF0000",
- fillOpacity: 1,
- weight: 1
- };
- }
- }
- }
- }).addTo(layers['Precipitation']);
- //L.geoJSON(event.features).addTo(layers['Precipitation']);
- //console.log(event.features.type);
- //for (var i=0; i< event.features.coordinates.length;i++)
- //{
- // console.log(event.features.coordinates[i].latLng);
- //}
- }
- case 'remove': {
- // TBD
- //layers['Precipitation'].clearLayers();
- break;
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement