Creating the graphic
Once you've defined the geometry, symbology and attributes for your graphic, a new Graphic
object can be created by passing this information to its constructor. Notice how in the following code example we create variables for the geometry (pointESRI
), symbology (markerSymbol
), and point attributes (pointAttributes
) and then pass these as parameters to the constructor for our new graphic called pointGraphic
. Then we apply the InfoTemplate
by calling the new Graphic
object's setInfoTemplate()
method. Finally, we add the graphic to the map's GraphicsLayer
:
var pointESRI = new Point(Number(theX), Number(theY, msr); var markerSymbol = new SimpleMarkerSymbol(); markerSymbol.setStyle(SimpleMarkerSymbol.STYLE_SQUARE); markerSymbol.setSize(12); markerSymbol.setColor(new Color([255,0,0])); var pointAttributes = {address:"101 Main Street", city:"Portland", state:"Oregon"}; var pointInfoTemplate = new InfoTemplate("Geocoding Results"); //create the point graphic using point...