AnsweredAssumed Answered

CSV Layers hanging on update

Question asked by chagan02 on Jul 10, 2014

I have a series of layers that are loaded via CSV on my local server.  The code below is repeated for each layer.  However, for whatever the reason the layer graphics get hung up on the screen and cannot be cleared until the whole page is refreshed.  I have tried building a function to clear or remove the layers before the refresh but that does not seem to work either.  It seems to be tied to the CSV data being updated, which is done via a local CRON every five minutes.  For testing, I have opened the CSV and changed on points' value, and it seems to hang for sure at that point.  Thoughts?

 

   function csv60minfunc () {
   csv60min = new CSVLayer("symGSPHydroViewer/data/60query.csv",{id:"csv60min"});
   csv60min.refreshInterval = 0.1;
   csv60min.on("update-end", function(results){
   csv60mintextLayer = new GraphicsLayer();              
   arrayUtils.forEach(results.target.graphics, function(feature, index){
   var lid =  feature.attributes.lid;
   var name =  feature.attributes.name;
   var value = feature.attributes.value;
   var ffg = feature.attributes.ffg;
   var ratio = feature.attributes.ratio;
   var validtime = feature.attributes.obstime;
   var attr = {"Location ID":lid,"Location Name":name,"Obs Value":value,"FFG":ffg,"Ratio of FFG":ratio,"Obs Valid Time":validtime};                                                                         
   var geom = feature.geometry;
   var displayText = feature.attributes.value;
   var font = new Font("12pt",Font.STYLE_NORMAL, Font.VARIANT_NORMAL,Font.WEIGHT_BOLD,"Helvetica");
   var textSymbol = new TextSymbol(displayText,font,new Color("#FF0000"));  
   csv60mintextLayer.add(new Graphic(geom, textSymbol, attr));});                  
   var infoTemplate = new InfoTemplate("Attributes", "${*}");  
   csv60mintextLayer.setInfoTemplate(infoTemplate);
   map.addLayer(csv60mintextLayer);
   csv60mintextLayer.hide();
   });                          
   var blank = new Color([0, 0, 0, 0]); // hex is #ff4500
   var marker = new SimpleMarkerSymbol("solid", 0, null, blank);
   var renderer = new SimpleRenderer(marker);
   csv60min.setRenderer(renderer);
   map.addLayer(csv60min);
   csv60min.hide();
   }

Outcomes