AnsweredAssumed Answered

Layer Refresh Behavior

Question asked by chagan02 on Jul 9, 2014

Specifically with CSV Layers, how does the API handle refreshing CSV Layers when the map is open?  I have been trying to make this work for sometime now and I cant pin down why I have been unsuccessful.  I have a series of CSV Layers that I create upon initialization of the map.  Those layers obviously reference CSV files on my local server.  Those CSV files update every five minutes with new data.  Thus, I need the map to update all the CSV layers (visible or not) at that time.  I have tried using the refreshInterval option, but with no luck.  Sample code is below.


//Add Observed Precip CSV Layers

function csv30min () {

csv30min = new CSVLayer("symGSPHydroViewer/data/30query.csv",{id:"csv30min"});

csv30min.refreshInterval = 0.1;

csv30min.on("update-end", function(results){

    csv30mintextLayer = new GraphicsLayer();                   

    arrayUtils.forEach(, function(feature, index){

        var lid =  feature.attributes.lid;

        var 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"));                       

        csv30mintextLayer.add(new Graphic(geom, textSymbol, attr));});                       

    var infoTemplate = new InfoTemplate("Attributes", "${*}");       





var blank = new Color([0, 0, 0, 0]); // hex is #ff4500

var marker = new SimpleMarkerSymbol("solid", 0, null, blank);

var renderer = new SimpleRenderer(marker);