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.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
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; _graphicsLayer.Graphics.Add(aGraphic);