crisjacome

FeatureLayer with points

Discussion created by crisjacome on Apr 25, 2013
Latest reply on Apr 26, 2013 by JGravois-esristaff
Hello

I have an array of esri.Graphic:
var features = [];

...
//add 6000 points

            var point = new esri.geometry.Point(x, y, new esri.SpatialReference({ wkid: 102100 }));
            var symbol = new esri.symbol.SimpleMarkerSymbol().setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND);
            var graphic = new esri.Graphic(point, symbol);

            features.push(graphic);


Now, I want to draw all that points on a layer, only draw, without events.
How can I do?

I thought add a FeatureLayer, but I get an error:

var featureSet = new esri.tasks.FeatureSet();
featureSet.features = features;
            
            var featureCollection = {
                featureSet: featureSet
            };

            try {

                var layer = new esri.layers.FeatureLayer(featureCollection);

                map.addLayer(layer);
            } catch (err) {
                alert(err.message);
            }



Error: path is not defined.

Thanks

Outcomes