public SpatialReference SpatialReference {get;}
Public ReadOnly Property SpatialReference As SpatialReference
public SpatialReference SpatialReference {get;}
Public ReadOnly Property SpatialReference As SpatialReference
public Task<bool> ZoomToPoint(double x, double y, ArcGIS.Core.Geometry.SpatialReference spatialReference) { //Get the active map view. var mapView = MapView.Active; if (mapView == null) return Task.FromResult(false); return QueuedTask.Run(() => { //Note: Run within QueuedTask //Create a point var pt = MapPointBuilderEx.CreateMapPoint(x, y, spatialReference); //Buffer it - for purpose of zoom var poly = GeometryEngine.Instance.Buffer(pt, buffer_size); //do we need to project the buffer polygon? if (!MapView.Active.Map.SpatialReference.IsEqual(poly.SpatialReference)) { //project the polygon poly = GeometryEngine.Instance.Project(poly, MapView.Active.Map.SpatialReference); } //Zoom - add in a delay for animation effect return mapView.ZoomTo(poly, new TimeSpan(0, 0, 0, 3)); }); }
Target Platforms: Windows 11, Windows 10, Windows 8.1