I'm drawing a free hand polygon on my map. Now I want to calculate the number of points found in that polygon.
I have done this code, which my now is giving me the number of points found in the map extent rather than the polygon. Now I'm stuck how I'm going to do it since I am new to JavaScript.
function computeZonalStats(evtObj) {
var geometry = evtObj.geometry;
map.showZoomSlider();
map.graphics.clear();
var symbol = new SimpleFillSymbol("none", new SimpleLineSymbol("dashdot", new Color([255, 0, 0]), 2), new Color([255, 255, 0, 0.25]));
var graphic = new Graphic(geometry, symbol);
map.graphics.add(graphic);
toolbar.deactivate();
var features = [];
features.push(graphic);
var featureSet = new FeatureSet();
featureSet.features = features;
var count = 0;
dojo.forEach(featureLayer.graphics, function (feature) {
count++;
});
alert(count);
}
Any idea how I could do this please?