# Geometry Conversion Problem

How do I convert from an ESRI.ArcGIS.Geometry.IPoint to an ESRI.ArcGIS.Client.Graphic point object?

In other words, I'm wanting to convert from an IGeometry to a runtime geometry, I guess.

• Are you working in SilverLight? Have you looked at the sample given here: help.arcgis.com/en/webapi/silverlight/apiref/… Commented Jan 15, 2013 at 16:45
• Yes, actually I've been looking at this link this morning, but couldn't really pin-point my answer. I'll take another look at it. Maybe I'm just missing something. Thanks! Commented Jan 15, 2013 at 18:47
• If you are working in the Silverlight API, you won't have an IPoint. That exists only in the ArcObjects API. In silverlight, you will have a MapPoint. The linked page, shows how you can make a graphic from a MapPoint. Commented Jan 16, 2013 at 3:13

I was able to do this with the following code snippit . . .

``````       //  *********************   Convert from IGeometry to runtime geometry    *********************
// Create a new instance of one Graphic.
ESRI.ArcGIS.Client.Graphic aGraphic = new ESRI.ArcGIS.Client.Graphic();

// Create a SpatialReference for the Graphic. Point Graphics are known as MapPoint objects
ESRI.ArcGIS.Client.Geometry.SpatialReference aSpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(4326);
// Create a MapPoint object and set its SpatialReference and coordinate (X,Y,Z) information.
ESRI.ArcGIS.Client.Geometry.MapPoint aMapPoint = new ESRI.ArcGIS.Client.Geometry.MapPoint();
aMapPoint.SpatialReference = aSpatialReference;
aMapPoint.X = Point.X;// Point is an IPoint object
aMapPoint.Y = Point.Y;
aMapPoint.Z = Point.Z;

// Create a new instance of a SimpleMarkerSymbol and set its Style, and Size Properties.
ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol aSimpleMarkerSymbol = new ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol();
aSimpleMarkerSymbol.Style = ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol.SimpleMarkerStyle.Circle;
aSimpleMarkerSymbol.Size = 10;

// Apply the Graphic's Geometry and Symbol Properties.
aGraphic.Geometry = (ESRI.ArcGIS.Client.Geometry.Geometry)aMapPoint;
aGraphic.Symbol = (ESRI.ArcGIS.Client.Symbols.Symbol)aSimpleMarkerSymbol;