public GraphicMapPoint(LocationTask task) { var merc = new ESRI.ArcGIS.Client.Projection.WebMercator(); //for esri Lat = Y Long = X var extent = merc.FromGeographic(new MapPoint(task.Location.Longtitude, task.Location.Latitude, new SpatialReference(4326))); //mapPoint = new MapPoint(extent.Extent.XMax, extent.Extent.YMax, new SpatialReference(102100)); this.Geometry = extent; simpleMarkerSymbol = new SimpleMarkerSymbol(); simpleMarkerSymbol.Color = ShapeColor; simpleMarkerSymbol.Size = ShapeSize; simpleMarkerSymbol.Style = ShapeStyle; this.Symbol = simpleMarkerSymbol; this.Attributes.Add("MapPointContent", MapPointContent); this.MapPointContent = new MapPointContent(extent.Extent.XMax, extent.Extent.YMax); this.MapPointContent.Address = task.Location.Address; this.MapPointContent.Id = task.DatabaseId; this.MapPointContent.Latitude = task.Location.Latitude; this.MapPointContent.Longtitude = task.Location.Longtitude; this.MapPointContent.Name = task.Name; this.MapPointContent.UserName = task.UserEmail; this.MapPointContent.PublishedDate = task.LastTimeModified; this.MapPointContent.Info = task.Info; this.MapPointContent.Info = task.Info; this.MapPointContent.Label = task.Label; if (string.IsNullOrWhiteSpace(MapPointContent.Address)) { ReverseGeocode(); } }
public GraphicMapPoint(double X, double Y, SpatialReference spatialReference) { var merc = new ESRI.ArcGIS.Client.Projection.WebMercator(); var longLat = merc.ToGeographic(new MapPoint(X, Y)); mapPoint = new MapPoint(X, Y, spatialReference); this.Geometry = mapPoint; simpleMarkerSymbol = new SimpleMarkerSymbol(); simpleMarkerSymbol.Color = ShapeColor; simpleMarkerSymbol.Size = ShapeSize; simpleMarkerSymbol.Style = ShapeStyle; this.Symbol = simpleMarkerSymbol; this.MapPointContent = new MapPointContent(longLat.Extent.XMax, longLat.Extent.YMax); this.Attributes.Add("MapPointContent", MapPointContent); if (MapPointContent.Address == null) { ReverseGeocode(); } }