Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I can't seem to access my feature layer properties in an array. I am adding my feature layers to an array as such:

dojo.forEach(globals.layers, function (addit, i) {
                globals.featureLayers[i] = new FeatureLayer(addit.url, {
                    mode: addit.mode,
                    id: addit.id,                    
                    outFields: addit.outFields,
                    infoTemplate: addit.infoTemplate
                });
                if (addit.type == "poly") {
                    globals.featureLayers[i].setRenderer(renderer)
                }
                map.addLayer(globals.featureLayers[i]);
            });

This adds the layer to the map and displays the layers in the browser fine. However, when I try to access the graphics object in a feature layer it displays an empty array.

                var graphicstmp = globals.featureLayers[i].graphics;
                console.log("Features Layer Properties in base ", graphicstmp)
                console.log("Layer " + addit.name + " ", globals.featureLayers[i]);

When I use the dev tools to look at the globals.featureLayers[i] object I can see the feature and I can expand the graphics array in the feature layer and it is there. However, my graphicstmp variable is an empty object in the dev tools. It doesn't get the graphics. How can I get the graphics array in a variable so I can modify certain properties as needed?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.