What do i put in the attribute section for new graphic

462
1
08-04-2012 03:15 PM
David_KurtTracy
New Contributor
I am new and piecing together samples to get this to work.  What do i put in the attribute section for new graphic.  Here is the function in question.  Let me know if you need the entire script.

function onGeocodesuccess(results)
{
console.log(results);
//alert(results.score.toString);

   var geoPoint = new esri.geometry.Point(results.utm_x, results.utm_y, map.spatialReference);
         var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 15, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0,0,255]), 2), new dojo.Color([0,0,255]));
   var infoTemplate = new esri.InfoTemplate("Attributes", "${*}");
            var graphic = new esri.Graphic(geoPoint, symbol, attr, infoTemplate);
            map.graphics.add(graphic);
            map.infoWindow.setTitle(graphic.getTitle());
            map.infoWindow.setContent(graphic.getContent());
            var screenPnt = map.toScreen(geoPoint);
            map.infoWindow.show(screenPnt,map.getInfoWindowAnchor(screenPnt));


}

Thanks so much for your time and help.
0 Kudos
1 Reply
StephenLead
Regular Contributor III
What do i put in the attribute section for new graphic.

var graphic = new esri.Graphic(geoPoint, symbol, attr, infoTemplate);



It doesn't look as though you've actually set attr (the list of attributes) so this will probably fail.

See the graphic help entry for an example of how to specify the attributes:

var attr = {"Xcoord":evt.mapPoint.x,"Ycoord":evt.mapPoint.y,"Plant":"Mesa Mint"};


You can also use "*" if you wish to use all attributes.

Cheers,
Steve
0 Kudos