Please elaborate on what you've tried and what, specifically, is failing.
Please elaborate on what you've tried and what, specifically, is failing.
mike, a couple of issues in your function requestPolygon(itemInfo). 1. features is undefined. 2. the attributes of the feature you added to your featureLayerPolygon are missing. Try this:
function requestPolygon(itemInfo) {
var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DOT, new dojo.Color([151, 249, 0, .80]), 3), new dojo.Color([151, 249, 0, 0.45]));
var polygon = new esri.geometry.Polygon({
"rings": [
[
[-4226661.916056009, 8496372.808143634],
[-3835304.3312360067, 8731187.359035634],
[-2269873.991956003, 9005137.668409634],
[-4304933.433020009, 7635386.121539632],
[-4304933.433020009, 7674521.880021632],
[-4226661.916056009, 8496372.808143634]
]
],
"spatialReference": {
"wkid": 102100
}
});
var attr = {};
attr["description"] = your description string;
attr["title"] = your title string;
featureLayerPolygon.applyEdits([new esri.Graphic(polygon, polygonSymbol, attr)], null, null);
}
Hi hzhu,
Thanks a lot for your code.
But it still doesn't work.
Thanks again.
Mike, since i don't have your complete code, i modified the ESRI sample (http://help.arcgis.com/en/webapi/javascript/arcgis/demos/fl/fl_featureCollection.html) a little bit to include your posted code. It worked. Maybe there are something else in your code (webmap?) that you need look into.
Hi hzhu,
Thank you very very much for your code. it work now. 🙂
Another question, after i added that featurelayer, how could i retrieve it? i don't know which object should be used, "map" or "esri". i mean i want to get that polygon in a event.
thanks again,
Mike