Dear all. I am new to developing with Arcgis, even a new to developing in GIS. I need to draw a symbol in a GraphicsOverlay with additional information like a ID and Name. I know that one way is to use a database, but, my question is, Is there a easier way to do it?
This is the code, and I want to add additional information to the new symbolGraphic. And after, click on it a get the information.
try
{
// Create a graphic with the map point geometry.
MapPoint pointGeometry = new MapPoint(x: Longitude, y: Latitude, SpatialReferences.Wgs84);
// Create a simple marker symbol.
SimpleMarkerSymbol pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Diamond, Color.Red, _sizeicon);
// Create and assign a simple renderer to the graphics overlay.
_targets.Renderer = new SimpleRenderer(pointSymbol);
// Create the graphic
Graphic symbolGraphic = new Graphic(pointGeometry, pointSymbol);
// Add the graphic to the graphics overlay
_targets.Graphics.Add(symbolGraphic);
return true;
}
catch (Exception ex)
{
return false;
}
I resolved it, I did not notice about the Attributes methot. Now It's working
Graphic symbolGraphic = new Graphic(pointGeometry, pointSymbol);
symbolGraphic.Attributes["ID"] = "01";
symbolGraphic.Attributes["NAME"] = "Target 1";
Very easy.