// buffer the click point, query the map service with the buffer geometry as the filter and add graphics to the map
        private async void mapView_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            try
            {
                graphicsLayer.Graphics.Add(new Graphic(e.Location));

                var bufferResult = GeometryEngine.Buffer(e.Location, 100);
                bufferLayer.Graphics.Add(new Graphic(bufferResult));

                var queryTask = new QueryTask(
                    new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2"));
                var query = new Query("1=1")
                {
                    ReturnGeometry = true,
                    OutSpatialReference = mapView.SpatialReference,
                    Geometry = bufferResult
                };
                query.OutFields.Add("OWNERNME1");

                var queryResult = await queryTask.ExecuteAsync(query);
                if (queryResult != null && queryResult.FeatureSet != null)
                {
                    parcelLayer.Graphics.AddRange(queryResult.FeatureSet.Features);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Spatial Query Sample");
            }
        }
        private async void MyMapView_Tapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            try
            {
                progress.Visibility = Visibility.Visible;
                resultsGrid.DataContext = null;

				GraphicsOverlay graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
                graphicsOverlay.Graphics.Clear();
                graphicsOverlay.Graphics.Add(new Graphic(e.Location));

                IdentifyParameters identifyParams = new IdentifyParameters(e.Location, MyMapView.Extent, 2, (int)MyMapView.ActualHeight, (int)MyMapView.ActualWidth)
                {
                    LayerOption = LayerOption.Visible,
                    SpatialReference = MyMapView.SpatialReference,
                };

                IdentifyTask identifyTask = new IdentifyTask(
                    new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"));

                var result = await identifyTask.ExecuteAsync(identifyParams);

                resultsGrid.DataContext = result.Results;
                if (result != null && result.Results != null && result.Results.Count > 0)
                    titleComboBox.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
            }
            finally
            {
                progress.Visibility = Visibility.Collapsed;
            }
        }
Beispiel #3
0
    public async IAsyncEnumerable <T> DownloadAsync(string?whereClause = null, string?extraParameters = null, bool keepQuerying = false)
    {
        var featureSet = await Esri.GetFeatureSet(Url, Token, typeof(T).HasGeometry(), LayerInfo.hasZ, whereClause, extraParameters, null);

        foreach (var graphic in featureSet.features)
        {
            yield return(graphic.ToFeature <T>(LayerInfo));
        }

        var objectIds = featureSet.features.Select(g => g.attributes[LayerInfo.GetObjectIdFieldName()].GetInt32()).ToArray();

        if (!keepQuerying || objectIds.Length == 0)
        {
            yield break;
        }

        var oidSet = await Esri.GetOIDSet(Url, Token, whereClause, extraParameters);

        var remainingObjectIds = oidSet.objectIds.Except(objectIds);

        await foreach (var feature in DownloadAsync(remainingObjectIds, whereClause, extraParameters, LayerInfo.maxRecordCount ?? objectIds.Length))
        {
            yield return(feature);
        }
    }
 /// <summary>
 /// Hit tests given point against given layer to get features from that position.
 /// </summary>
 /// <param name="screenPoint">Screen point of that is used in hittest.</param>
 /// <param name="layer">Layer that is hittested against</param>
 /// <returns>Returns feature if there was one in the given location.</returns>
 /// <remarks>Hit test uses 3x3 area around given point.</remarks>
 public async Task<Feature> HitTestAsync(Point screenPoint, Esri.ArcGISRuntime.Layers.Layer layer)
 {
     var mapView = MapView;
     if (mapView != null)
     {
         if (layer is GraphicsLayer)
         {
             Rect rect = new Rect(screenPoint.X - 1, screenPoint.Y - 1, 3, 3);
             var glayer = (GraphicsLayer)layer;
             return await glayer.HitTestAsync(mapView, rect).ContinueWith(t => { return (Feature)t.Result; });
         }
         else if (layer is FeatureLayer)
         {
             var flayer = (FeatureLayer)layer;
             Rect rect = new Rect(screenPoint.X - 1, screenPoint.Y - 1, 3, 3);
             var featureID = await flayer.HitTestAsync(mapView, rect, 1).ContinueWith(t => { return (long)t.Result.FirstOrDefault(); });
             if (featureID > 0)
             {
                 return await flayer.FeatureTable.QueryAsync(new long[] { featureID })
                     .ContinueWith(t => { return (Feature)t.Result.FirstOrDefault(); });
             }
         }
     }
     return null;
 }
        private async void MyMapView_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            MyMapView.Overlays.Items.Clear();

            IEnumerable<KmlFeature> features = await (MyMapView.Map.Layers["kmlLayer"] as KmlLayer).HitTestAsync(MyMapView, e.Position);

            if (features.Count() > 0)
            {
                if (!string.IsNullOrWhiteSpace(features.FirstOrDefault().BalloonStyle.FormattedText))
                {
                    //Create WebBrowser to show the formatted text
                    var browser = new System.Windows.Controls.WebBrowser();
                    browser.NavigateToString(features.FirstOrDefault().BalloonStyle.FormattedText);

                    //Get the KmlPlacemark position
                    var featurePosition = (features.FirstOrDefault() as KmlPlacemark).Extent;
                    
                    //Create ContentControl
                    var cControl = new ContentControl() 
                    {
                        Content = browser,
                        MaxHeight = 500,
                        MaxWidth = 450
                    };

                    //Add the ContentControl to MapView.Overlays
                    MapView.SetViewOverlayAnchor(cControl, featurePosition.GetCenter());
                    MyMapView.Overlays.Items.Add(cControl);
                }
            }
          
        }
		private async void mapView1_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
		{
			var graphicsLayer = mapView1.Map.Layers["MyGraphicsLayer"] as GraphicsLayer;
			var editGraphicsLayer = mapView1.Map.Layers["EditGraphicsLayer"] as GraphicsLayer;
			if (graphicBeingEdited == null)
			{
				var hit = await graphicsLayer.HitTestAsync(sender as Esri.ArcGISRuntime.Controls.ViewBase, e.Position);
				if (hit != null)
				{
					graphicBeingEdited = hit;
					//highlight the active graphic
					graphicBeingEdited.IsSelected = true;
					//Create a temporary we can move around without 'disturbing' the original feature until commit
					Graphic g = new Graphic();
					g.Symbol = hit.Symbol ?? graphicsLayer.Renderer.GetSymbol(hit);
					g.Geometry = hit.Geometry;
					editGraphicsLayer.Graphics.Add(g);
				}
			}
			else //Commit and clean up
			{
				graphicBeingEdited.Geometry = e.Location;
				graphicBeingEdited.IsSelected = false;
				graphicBeingEdited = null;
				editGraphicsLayer.Graphics.Clear();
			}
		}
         private async void mapView1_Tapped_1(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            var mp = e.Location;
            Graphic g = new Graphic() { Geometry = mp };
            var graphicsLayer = mapView1.Map.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.Graphics.Add(g);

            var bufferResult = GeometryEngine.Buffer(mp, 100);
            var bufferLayer = mapView1.Map.Layers["BufferLayer"] as GraphicsLayer;
            bufferLayer.Graphics.Add(new Graphic() { Geometry = bufferResult });


            var queryTask = new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2"));
            var query = new Query("1=1")
            {
                ReturnGeometry = true,
                OutSpatialReference = mapView1.SpatialReference,
                Geometry = bufferResult
            };
            query.OutFields.Add("OWNERNME1");

            try
            {
                var queryResult = await queryTask.ExecuteAsync(query);
                if (queryResult != null && queryResult.FeatureSet != null)
                {
                    var resultLayer = mapView1.Map.Layers["MyResultsGraphicsLayer"] as GraphicsLayer;
                    resultLayer.Graphics.AddRange(queryResult.FeatureSet.Features);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
        // Calculate the route
        private async void MyMapView_MapViewDoubleTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            if (_stopsOverlay.Graphics.Count() < 2)
                return;

            try
            {
                e.Handled = true;

                panelResults.Visibility = Visibility.Collapsed;
                progress.Visibility = Visibility.Visible;

                RouteParameters routeParams = await _routeTask.GetDefaultParametersAsync();
                routeParams.OutSpatialReference = MyMapView.SpatialReference;
                routeParams.ReturnDirections = true;
                routeParams.DirectionsLengthUnit = LinearUnits.Miles;
				routeParams.DirectionsLanguage = new CultureInfo("en-Us"); // CultureInfo.CurrentCulture;
                routeParams.SetStops(_stopsOverlay.Graphics);

                var routeResult = await _routeTask.SolveAsync(routeParams);
                if (routeResult == null || routeResult.Routes == null || routeResult.Routes.Count() == 0)
                    throw new Exception("No route could be calculated");

                var route = routeResult.Routes.First();
                _routesOverlay.Graphics.Add(new Graphic(route.RouteFeature.Geometry));

                _directionsOverlay.GraphicsSource = route.RouteDirections.Select(rd => GraphicFromRouteDirection(rd));
				listDirections.ItemsSource = _directionsOverlay.Graphics;

                var totalTime = route.RouteDirections.Select(rd => rd.Time).Aggregate(TimeSpan.Zero, (p, v) => p.Add(v));
                var totalLength = route.RouteDirections.Select(rd => rd.GetLength(LinearUnits.Miles)).Sum();
                txtRouteTotals.Text = string.Format("Time: {0:h':'mm':'ss} / Length: {1:0.00} mi", totalTime, totalLength);

				if (!route.RouteFeature.Geometry.IsEmpty)
					await MyMapView.SetViewAsync(route.RouteFeature.Geometry.Extent.Expand(1.25));
            }
            catch (AggregateException ex)
            {
                var innermostExceptions = ex.Flatten().InnerExceptions;
                if (innermostExceptions != null && innermostExceptions.Count > 0)
                {
                    MessageBox.Show(innermostExceptions[0].Message, "Sample Error");
                }
                else
                {
                    MessageBox.Show(ex.Message, "Sample Error");
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "Sample Error");
            }
            finally
            {
                progress.Visibility = Visibility.Collapsed;
                if (_directionsOverlay.Graphics.Count() > 0)
                    panelResults.Visibility = Visibility.Visible;
            }
        }
Beispiel #9
0
 }                                //(type: esriFieldTypeDate, alias: EditDate, SQL Type: sqlTypeOther, length: 8, nullable: true, editable: false)
 public DateTime?EditDate_getDT()
 {
     if (EditDate == null)
     {
         return(null);
     }
     return(Esri.getDate(EditDate.Value));
 }
Beispiel #10
0
 public void date1_setDT(DateTime?value)
 {
     if (value == null)
     {
         date1 = null; return;
     }
     date1 = Esri.getEpoch(value.Value);
 }
Beispiel #11
0
 }                                         //(type: esriFieldTypeDate, alias: Date calibrated, SQL Type: sqlTypeOther, length: 8, nullable: true, editable: true)
 public DateTime?purg_meter_cali_d_getDT()
 {
     if (purg_meter_cali_d == null)
     {
         return(null);
     }
     return(Esri.getDate(purg_meter_cali_d.Value));
 }
Beispiel #12
0
 }                                       //(type: esriFieldTypeDate, alias: Time logger replaced, SQL Type: sqlTypeOther, length: 8, nullable: true, editable: true)
 public DateTime?logger_replaced_getDT()
 {
     if (logger_replaced == null)
     {
         return(null);
     }
     return(Esri.getDate(logger_replaced.Value));
 }
Beispiel #13
0
 public void interface_cali_d_setDT(DateTime?value)
 {
     if (value == null)
     {
         interface_cali_d = null; return;
     }
     interface_cali_d = Esri.getEpoch(value.Value);
 }
Beispiel #14
0
 }                                //(type: esriFieldTypeDate, alias: Download time, SQL Type: sqlTypeOther, length: 8, nullable: true, editable: true)
 public DateTime?logger_t_getDT()
 {
     if (logger_t == null)
     {
         return(null);
     }
     return(Esri.getDate(logger_t.Value));
 }
Beispiel #15
0
 public void dip_cali_d_setDT(DateTime?value)
 {
     if (value == null)
     {
         dip_cali_d = null; return;
     }
     dip_cali_d = Esri.getEpoch(value.Value);
 }
Beispiel #16
0
 }                                        //(type: esriFieldTypeDate, alias: Date calibrated, SQL Type: sqlTypeOther, length: 8, nullable: true, editable: true)
 public DateTime?interface_cali_d_getDT()
 {
     if (interface_cali_d == null)
     {
         return(null);
     }
     return(Esri.getDate(interface_cali_d.Value));
 }
Beispiel #17
0
 public void EditDate_setDT(DateTime?value)
 {
     if (value == null)
     {
         EditDate = null; return;
     }
     EditDate = Esri.getEpoch(value.Value);
 }
Beispiel #18
0
 }                              //(type: esriFieldTypeString, alias: Start time, SQL Type: sqlTypeOther, length: 255, nullable: true, editable: true)
 public DateTime?time1_getDT()
 {
     if (date1 == null)
     {
         return(null);
     }
     return(Esri.getDateTimeWithTime(date1_getDT().Value, time1));
 }
Beispiel #19
0
 }                                    //(type: esriFieldTypeDate, alias: CreationDate, SQL Type: sqlTypeOther, length: 8, nullable: true, editable: false)
 public DateTime?CreationDate_getDT()
 {
     if (CreationDate == null)
     {
         return(null);
     }
     return(Esri.getDate(CreationDate.Value));
 }
Beispiel #20
0
 public void CreationDate_setDT(DateTime?value)
 {
     if (value == null)
     {
         CreationDate = null; return;
     }
     CreationDate = Esri.getEpoch(value.Value);
 }
Beispiel #21
0
 public void purg_meter_cali_d_setDT(DateTime?value)
 {
     if (value == null)
     {
         purg_meter_cali_d = null; return;
     }
     purg_meter_cali_d = Esri.getEpoch(value.Value);
 }
Beispiel #22
0
 }                             //(type: esriFieldTypeDate, alias: Date, SQL Type: sqlTypeOther, length: 8, nullable: true, editable: true)
 // public DateTime? date1 {get;set;} //(type: esriFieldTypeDate, alias: Date, SQL Type: sqlTypeOther, length: 8, nullable: true, editable: true)
 public DateTime?date1_getDT()
 {
     if (date1 == null)
     {
         return(null);
     }
     return(Esri.getDate(date1.Value));
 }
Beispiel #23
0
 public void logger_replaced_setDT(DateTime?value)
 {
     if (value == null)
     {
         logger_replaced = null; return;
     }
     logger_replaced = Esri.getEpoch(value.Value);
 }
Beispiel #24
0
 }                                  //(type: esriFieldTypeDate, alias: Date calibrated, SQL Type: sqlTypeOther, length: 8, nullable: true, editable: true)
 public DateTime?dip_cali_d_getDT()
 {
     if (dip_cali_d == null)
     {
         return(null);
     }
     return(Esri.getDate(dip_cali_d.Value));
 }
		private void MySceneView_LayerLoaded(object sender, Esri.ArcGISRuntime.Controls.LayerLoadedEventArgs e)
		{
			if (e.LoadError == null)
			{
				if (e.Layer.ID == "AGOLayer")
					MySceneView.SetView(new Camera(new MapPoint(-106.882128302391, 38.7658957449754, 12994.1727461051), 
						358.607816178049, 70.0562968167998));
			}
		}
Beispiel #26
0
		private void MySceneView_LayerLoaded(object sender, Esri.ArcGISRuntime.Controls.LayerLoadedEventArgs e)
		{
			if (e.LoadError == null && e.Layer.ID == "AGOLayer")
			{
				MySceneView.SetViewAsync(new Camera(new MapPoint(-106.57, 39.01, 14614.24), 281.66, 74.47), new TimeSpan(0, 0, 3), true);
 
				AddGraphics();
			}
		}
        private async void mapView_Tapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {

            var hitGraphic = await _locationGraphicsLayer.HitTestAsync(mapView1, e.Position);
            if (hitGraphic != null)
            {
                if (maptip.Visibility == Windows.UI.Xaml.Visibility.Collapsed)
                {
                    MapTipGraphic = hitGraphic;
                    RenderMapTip();
                }
                else
                {
                    maptip.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    maptip.DataContext = null;
                    MapTipGraphic = null;
                }
            }
            else
            {
				maptip.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
				var mp = mapView1.ScreenToLocation(e.Position);

                Graphic g = new Graphic() { Geometry = mp };

                var layer = mapView1.Map.Layers.OfType<GraphicsLayer>().First();
                layer.Graphics.Add(g);

                var token = "";
                var locatorTask =
                    new OnlineLocatorTask(new Uri("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer", UriKind.Absolute), token);

                try
                {
                    var result = await locatorTask.ReverseGeocodeAsync(mp, 30, mapView1.SpatialReference, CancellationToken.None);

                    Graphic graphic = new Graphic() { Geometry = mp };

                    string latlon = String.Format("{0}, {1}", result.Location.X, result.Location.Y);
                    string address1 = result.AddressFields["Address"].ToString();
                    string address2 = String.Format("{0}, {1} {2}", result.AddressFields["City"], result.AddressFields["Region"], result.AddressFields["Postal"]);

                    graphic.Attributes.Add("LatLon", latlon);
                    graphic.Attributes.Add("Address1", address1);
                    graphic.Attributes.Add("Address2", address2);

                    _locationGraphicsLayer.Graphics.Add(graphic);
					MapTipGraphic = graphic;
					RenderMapTip();

                }
                catch (Exception)
                {
                }
            }
        }
        // Calculate the route
        private async void mapView_MapViewDoubleTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            if (!_isMapReady || stopsLayer.Graphics.Count() < 2)
                return;

            try
            {
                e.Handled = true;

                panelResults.Visibility = Visibility.Collapsed;
                progress.Visibility = Visibility.Visible;

                if (_routeTask == null)
                    _routeTask = await Task.Run<LocalRouteTask>(() => new LocalRouteTask(_localRoutingDatabase, _networkName));

                RouteParameters routeParams = await _routeTask.GetDefaultParametersAsync();
                routeParams.OutSpatialReference = mapView.SpatialReference;
                routeParams.ReturnDirections = true;
                routeParams.DirectionsLengthUnit = LinearUnits.Miles;
                routeParams.DirectionsLanguage = new CultureInfo("en");
                routeParams.Stops = new FeaturesAsFeature(stopsLayer.Graphics) { SpatialReference = mapView.SpatialReference };

                var routeResult = await _routeTask.SolveAsync(routeParams);
                if (routeResult == null || routeResult.Routes == null || routeResult.Routes.Count() == 0)
                    throw new ApplicationException("No route could be calculated");

                var route = routeResult.Routes.First();
                routesLayer.Graphics.Add(new Graphic(route.RouteGraphic.Geometry));

                directionsLayer.GraphicsSource = route.RouteDirections.Select(rd => GraphicFromRouteDirection(rd));

                var totalTime = route.RouteDirections.Select(rd => rd.Time).Aggregate(TimeSpan.Zero, (p, v) => p.Add(v));
                var totalLength = route.RouteDirections.Select(rd => rd.GetLength(LinearUnits.Miles)).Sum();
                txtRouteTotals.Text = string.Format("Time: {0:h':'mm':'ss} / Length: {1:0.00} mi", totalTime, totalLength);

                await mapView.SetViewAsync(route.RouteGraphic.Geometry.Extent.Expand(1.2));
            }
            catch (AggregateException ex)
            {
                var innermostExceptions = ex.Flatten().InnerExceptions;
                if (innermostExceptions != null && innermostExceptions.Count > 0)
                    MessageBox.Show(innermostExceptions[0].Message, "Sample Error");
                else
                    MessageBox.Show(ex.Message, "Sample Error");
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "Sample Error");
            }
            finally
            {
                progress.Visibility = Visibility.Collapsed;
                if (directionsLayer.Graphics.Count() > 0)
                    panelResults.Visibility = Visibility.Visible;
            }
        }
		private void LocationProvider_LocationChanged(object sender, Esri.ArcGISRuntime.Location.LocationInfo e)
		{
			Dispatcher.BeginInvoke((Action)delegate()
			{
				//Zoom in on first location fix
				mapView.LocationDisplay.LocationProvider.LocationChanged -= LocationProvider_LocationChanged;
				mapView.SetView(e.Location, 5000);
				mapView.LocationDisplay.AutoPanMode = Esri.ArcGISRuntime.Location.AutoPanMode.Navigation;
			});
		}
 private void mapView1_LayerLoaded(object sender, Esri.ArcGISRuntime.Controls.LayerLoadedEventArgs e)
 {
     if (e.Layer.ID == "MyImageLayer")
     {
         ArcGISImageServiceLayer imageLayer = e.Layer as ArcGISImageServiceLayer;
         if (e.LoadError == null)
         {
             RasterFunctionsComboBox.ItemsSource = imageLayer.ServiceInfo.RasterFunctionInfos;
             RasterFunctionsComboBox.SelectedIndex = 0;
         }
     }
 }
        private void mapView1_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            // Convert screen point to map point
            var mapPoint = mapView1.ScreenToLocation(e.Position);

            // Create graphic
            Graphic g = new Graphic() { Geometry = mapPoint };

            // Get layer and add point to it
            var graphicsLayer = mapView1.Map.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.Graphics.Add(g);
        }
Beispiel #32
0
    private IEnumerable <T> Download(IEnumerable <int> objectIds, string?whereClause, string?extraParameters, int batchSize, int degreeOfParallelism, CancellationToken?cancellationToken)
    {
        var returnGeometry = typeof(T).HasGeometry();

        return(objectIds.Chunk(batchSize)
               .AsParallel()
               .AsOrdered()
               .WithDegreeOfParallelism(degreeOfParallelism < 1 ? 1 : degreeOfParallelism)
               .WithCancellation(cancellationToken ?? CancellationToken.None)
               .SelectMany(ids => Esri.GetFeatureSet(Url, Token, returnGeometry, LayerInfo.hasZ, whereClause, extraParameters, ids).Result.features
                           .Select(g => g.ToFeature <T>(LayerInfo))));
    }
Beispiel #33
0
    private async IAsyncEnumerable <T> DownloadAsync(IEnumerable <int> objectIds, string?whereClause, string?extraParameters, int batchSize)
    {
        var returnGeometry = typeof(T).HasGeometry();

        foreach (var ids in objectIds.Chunk(batchSize))
        {
            var featureSet = await Esri.GetFeatureSet(Url, Token, returnGeometry, LayerInfo.hasZ, whereClause, extraParameters, ids);

            foreach (var graphic in featureSet.features)
            {
                yield return(graphic.ToFeature <T>(LayerInfo));
            }
        }
    }
        private async void mapView1_Tapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            var mp = e.Location;
            Graphic stop = new Graphic() { Geometry = mp };
            var stopsGraphicsLayer = mapView1.Map.Layers["MyStopsGraphicsLayer"] as GraphicsLayer;
            stopsGraphicsLayer.Graphics.Add(stop);

            if (stopsGraphicsLayer.Graphics.Count > 1)
            {
                try
                {
                    var routeTask = new OnlineRouteTask(new Uri("http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route"));
                    var routeParams = await routeTask.GetDefaultParametersAsync();

                    FeaturesAsFeature stopsFeatures = new FeaturesAsFeature();
                    stopsFeatures.Features = stopsGraphicsLayer.Graphics;
                    routeParams.Stops = stopsFeatures;
                    routeParams.UseTimeWindows = false;
                    routeParams.OutSpatialReference = mapView1.SpatialReference;
                    routeParams.DirectionsLengthUnit = LinearUnits.Miles;
                    var result = await routeTask.SolveAsync(routeParams);
                    if (result != null)
                    {
                        if (result.Routes != null && result.Routes.Count > 0)
                        {
                            var firstRoute = result.Routes.FirstOrDefault();
                            var direction = firstRoute.RouteDirections.FirstOrDefault();

                            if (direction != null)
                            {
                                int totalMins = 0;
                                foreach (RouteDirection dir in firstRoute.RouteDirections)
                                    totalMins = totalMins + dir.Time.Minutes;

                                await new MessageDialog(string.Format("{0:N2} minutes", totalMins)).ShowAsync();

                            }

                            var routeLayer = mapView1.Map.Layers["MyRouteGraphicsLayer"] as GraphicsLayer;
                            routeLayer.Graphics.Add(firstRoute.RouteGraphic);
                        }
                    }

                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
            }
        }
		private async void MyTemplatePicker_TemplatePicked(object sender,  Esri.ArcGISRuntime.Toolkit.Controls.TemplatePicker.TemplatePickedEventArgs e)
		{
			try
			{
				TemplateName.Text = e.FeatureTemplate.Name;
				TargetedLayer.Text = e.Layer.DisplayName;
				TemplateDescription.Text = e.FeatureTemplate.Description;

				GeometryType geometryType = GeometryType.Unknown;
				var gdbFeatureTable = e.Layer.FeatureTable as ServiceFeatureTable;
				if (gdbFeatureTable != null && gdbFeatureTable.ServiceInfo != null)
					geometryType = gdbFeatureTable.ServiceInfo.GeometryType;

				Esri.ArcGISRuntime.Symbology.Symbol symbol = null;

				// Get symbol from the renderer if that is defined
				if (e.Layer.Renderer != null)
				{
					var g = new Graphic(e.FeatureTemplate.Prototype.Attributes ??
						Enumerable.Empty<KeyValuePair<string, object>>());

					symbol = e.Layer.Renderer.GetSymbol(g);
					SelectedSymbol.Source = await symbol.CreateSwatchAsync(32, 32, 96, Colors.Transparent, geometryType);
				}

				// Define what we shape we request from the editor
				DrawShape requestedShape = DrawShape.Point;
				if (e.FeatureTemplate.DrawingTool == FeatureEditTool.Polygon)
					requestedShape = DrawShape.Polygon;
				if (e.FeatureTemplate.DrawingTool == FeatureEditTool.Line)
					requestedShape = DrawShape.Polyline;

				Selection.Visibility = Visibility.Collapsed;
				SelectedInfo.Visibility = Visibility.Visible;

				// Request location for the new feature
				var addedGeometry = await MyMapView.Editor.RequestShapeAsync(requestedShape, symbol);
		
						// Add new feature to the MapView. Note that this doesn't commit changes automatically to the service
				var id = await gdbFeatureTable.AddAsync(e.FeatureTemplate.Prototype.Attributes, addedGeometry);
			}
			catch (TaskCanceledException) { } // Editing canceled
			catch (Exception exception)
			{
				var _x = new MessageDialog(string.Format("Error occured : {0}", exception.ToString()), "Sample error").ShowAsync();
			}

			Selection.Visibility = Visibility.Visible;
			SelectedInfo.Visibility = Visibility.Collapsed;
		}
 private void mapView1_Tapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
 {
     var mp = mapView1.ScreenToLocation(e.Position);
     Graphic g = new Graphic() { Geometry = mp };
     var stopsLayer = mapView1.Map.Layers["MyStopsGraphicsLayer"] as GraphicsLayer;
     var barriersLayer = mapView1.Map.Layers["MyBarriersGraphicsLayer"] as GraphicsLayer;
     if (StopsRadioButton.IsChecked.Value)
     {
         stopsLayer.Graphics.Add(g);
     }
     else if (BarriersRadioButton.IsChecked.Value)
     {
         barriersLayer.Graphics.Add(g);
     }
 }
        private async void mapView1_Tapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            // Convert screen point to map point
            var mapPoint = mapView1.ScreenToLocation(e.Position);
            var l = mapView1.Map.Layers["InputLayer"] as GraphicsLayer;
            l.Graphics.Clear();
            l.Graphics.Add(new Graphic() { Geometry = mapPoint });

            string error = null;
            Geoprocessor task = new Geoprocessor(new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Network/ESRI_DriveTime_US/GPServer/CreateDriveTimePolygons"));

            var parameter = new GPInputParameter();

            parameter.GPParameters.Add(new GPFeatureRecordSetLayer("Input_Location", mapPoint));
            parameter.GPParameters.Add(new GPString("Drive_Times", "1 2 3"));

            try
            {
                var result = await task.ExecuteAsync(parameter);
                var r = mapView1.Map.Layers["ResultLayer"] as GraphicsLayer;
                r.Graphics.Clear();
                foreach (GPParameter gpParameter in result.OutParameters)
                {
                    if (gpParameter is GPFeatureRecordSetLayer)
                    {
                        GPFeatureRecordSetLayer gpLayer = gpParameter as GPFeatureRecordSetLayer;
                        List<Esri.ArcGISRuntime.Symbology.Symbol> bufferSymbols = new List<Esri.ArcGISRuntime.Symbology.Symbol>(
                              new Esri.ArcGISRuntime.Symbology.Symbol[] { LayoutRoot.Resources["FillSymbol1"] as Esri.ArcGISRuntime.Symbology.Symbol, LayoutRoot.Resources["FillSymbol2"] as Esri.ArcGISRuntime.Symbology.Symbol, LayoutRoot.Resources["FillSymbol3"] as Esri.ArcGISRuntime.Symbology.Symbol });

                        int count = 0;
                        foreach (Graphic graphic in gpLayer.FeatureSet.Features)
                        {
                            graphic.Symbol = bufferSymbols[count];
                            graphic.Attributes.Add("Info", String.Format("{0} minute buffer ", 3 - count));
                            r.Graphics.Add(graphic);
                            count++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                error = "Geoprocessor service failed: " + ex.Message;
            }
            if (error != null)
                await new MessageDialog(error).ShowAsync();
        }
		private async void MyMapView_Tapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
		{
			_routeGraphicsOverlay = MyMapView.GraphicsOverlays["RouteGraphicsOverlay"];
			_stopsGraphicsOverlay = MyMapView.GraphicsOverlays["StopsGraphicsOverlay"];

			var graphicIdx = _stopsGraphicsOverlay.Graphics.Count + 1;
			_stopsGraphicsOverlay.Graphics.Add(CreateStopGraphic(e.Location, graphicIdx));

			if (_stopsGraphicsOverlay.Graphics.Count > 1)
			{
				try
				{
					progress.Visibility = Visibility.Visible;

					var routeTask = new OnlineRouteTask(
						new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/Route"));
					var routeParams = await routeTask.GetDefaultParametersAsync();

					routeParams.SetStops(_stopsGraphicsOverlay.Graphics);
					routeParams.UseTimeWindows = false;
					routeParams.OutSpatialReference = MyMapView.SpatialReference;
					routeParams.DirectionsLanguage = new CultureInfo("en-Us"); // CultureInfo.CurrentCulture;

					var result = await routeTask.SolveAsync(routeParams);
					if (result.Routes.Count > 0)
					{
						_routeGraphicsOverlay.Graphics.Clear();

						var route = result.Routes.First().RouteFeature;
						_routeGraphicsOverlay.Graphics.Add(new Graphic(route.Geometry));

						var meters = GeometryEngine.GeodesicLength(route.Geometry, GeodeticCurveType.Geodesic);
						txtDistance.Text = string.Format("{0:0.00} miles", LinearUnits.Miles.ConvertFromMeters(meters));

						panelRouteInfo.Visibility = Visibility.Visible;
					}
				}
				catch (Exception ex)
				{
					var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
				}
				finally
				{
					progress.Visibility = Visibility.Collapsed;
				}
			}
		}
        private async void MyMapView_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            try
            {
                var graphicIdx = _stopsGraphicsOverlay.Graphics.Count + 1;
                _stopsGraphicsOverlay.Graphics.Add(CreateStopGraphic(e.Location, graphicIdx));

                if (graphicIdx > 1)
                {
                    await CalculateRoute();
                }
            }
            catch (Exception ex)
            {
                var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
            }
        }
        private async void OnLoadedPopulateData(object sender, Esri.ArcGISRuntime.LoadStatusEventArgs e)
        {
            // If layer isn't loaded, do nothing
            if (e.Status != Esri.ArcGISRuntime.LoadStatus.Loaded)
                return;

            // Create new query object that contains parameters to query specific request types
            QueryParameters queryParameters = new QueryParameters()
            {
                WhereClause = "req_Type = 'Tree Maintenance or Damage'"
            };

            // Create list of the fields that are returned from the service
            var outputFields = new string[] { "*" };

            // Populate feature table with the data based on query
            await _incidentsFeatureTable.PopulateFromServiceAsync(queryParameters, true, outputFields);
        }
		private async void MyMapView_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
		{
			try
			{
				if (MyDataForm.ResetCommand.CanExecute(null))
					MyDataForm.ResetCommand.Execute(null);

				MyDataForm.GeodatabaseFeature = null;

				if (_editedLayer != null)
					_editedLayer.ClearSelection();

				foreach (var layer in MyMapView.Map.Layers.OfType<FeatureLayer>().Reverse())
				{
					// Get possible features and if none found, move to next layer
					var foundFeatures = await layer.HitTestAsync(MyMapView, new Rect(e.Position, new Size(10, 10)), 1);
					if (foundFeatures.Count() == 0)
						continue;

					// Get feature from table
					var feature = await layer.FeatureTable.QueryAsync(foundFeatures[0]);

					// Change UI
					DescriptionTextArea.Visibility = Visibility.Collapsed;
					DataFormArea.Visibility = Visibility.Visible;

					_editedFeature = feature as GeodatabaseFeature;
					_editedLayer = layer;
					_editedLayer.SelectFeatures(new long[] { foundFeatures[0] });

					// Set feature that is being edited to data form
					MyDataForm.GeodatabaseFeature = _editedFeature;
					return;
				}

				// No features found
				DescriptionTextArea.Visibility = Visibility.Visible;
				DataFormArea.Visibility = Visibility.Collapsed;
			}
			catch (Exception ex)
			{
				var _x = new MessageDialog(string.Format("Error occured : {0}", ex.ToString()), "Sample error").ShowAsync();
			}
		}
		private async void MySceneView_LayerLoaded(object sender, Esri.ArcGISRuntime.Controls.LayerLoadedEventArgs e)
		{
			if (e.LoadError == null && e.Layer.ID == "AGOLayer")
			{
				var camera = new Esri.ArcGISRuntime.Controls.Camera(new MapPoint(2.2950, 48.8738, 3000000), 0, 0);
				MySceneView.SetViewAsync(camera);
				
				// Find the overlay element from the MapView using its name
				var triompheTip = this.MySceneView.FindName("triompheOverlay") as FrameworkElement;

				// If the overlay element is found, set its position and make it visible
				if (triompheTip != null)
				{
					var overlayLocation = new MapPoint(2.2950, 48.8738, SpatialReferences.Wgs84);
					MapView.SetViewOverlayAnchor(triompheTip, overlayLocation);
					triompheTip.Visibility = Visibility.Visible;
				}
			}
		}
 /// <summary>
 /// On each mouse click:
 /// - HitTest the feature layer
 /// - Query the feature table for the returned row
 /// - Set the result feature for the UI
 /// </summary>
 private async void mapView_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
 {
     try
     {
         var rows = await cities.HitTestAsync(mapView, e.Position);
         if (rows != null && rows.Length > 0)
         {
             var features = await cities.FeatureTable.QueryAsync(rows);
             ResultFeature = features.FirstOrDefault();
         }
         else
             ResultFeature = null;
     }
     catch (Exception ex)
     {
         ResultFeature = null;
         MessageBox.Show("HitTest Error: " + ex.Message, "Feature Layer Hit Testing Sample");
     }
 }
		private async void MyMapView_Tapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
		{
			try
			{
				var graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
				if (!(graphicsOverlay.Graphics.Count == 0))
					graphicsOverlay.Graphics.Clear();

				graphicsOverlay.Graphics.Add(new Graphic() { Geometry = e.Location });

				var bufferOverlay = MyMapView.GraphicsOverlays["bufferOverlay"];
				if (!(bufferOverlay.Graphics.Count == 0))
					bufferOverlay.Graphics.Clear();

				var bufferResult = GeometryEngine.Buffer(e.Location, 100);
				bufferOverlay.Graphics.Add(new Graphic() { Geometry = bufferResult });

				var queryTask = new QueryTask(
					new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2"));
				var query = new Query("1=1")
				{
					ReturnGeometry = true,
					OutSpatialReference = MyMapView.SpatialReference,
					Geometry = bufferResult
				};
				query.OutFields.Add("OWNERNME1");

				var queryResult = await queryTask.ExecuteAsync(query);
				if (queryResult != null && queryResult.FeatureSet != null)
				{
					var resultOverlay = MyMapView.GraphicsOverlays["parcelOverlay"];
					if (!(resultOverlay.Graphics.Count == 0))
						resultOverlay.Graphics.Clear();

					resultOverlay.Graphics.AddRange(queryResult.FeatureSet.Features.OfType<Graphic>());
				}
			}
			catch (Exception ex)
			{
				var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
			}
		}
        private async void OnMapViewTapped(object sender, Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs e)
        {
            var tolerance = 10d; // Use larger tolerance for touch
            var maximumResults = 1; // Only return one graphic  

            // Use the following method to identify graphics in a specific graphics overlay
            IReadOnlyList<Graphic> identifyResults = await MyMapView.IdentifyGraphicsOverlayAsync(
                _polygonOverlay, 
                e.Position, 
                tolerance, maximumResults);
           
            // Check if we got results
            if (identifyResults.Count > 0)
            {
                // Make sure that the UI changes are done in the UI thread
                Device.BeginInvokeOnMainThread(async () => {
                    await DisplayAlert("", "Tapped on graphic", "OK");
                });
            }
        }
		private async void MyMapView_LayerLoaded(object sender, Esri.ArcGISRuntime.Controls.LayerLoadedEventArgs e)
		{
			try
			{
				//Add kml layer to the treeView
				if (e.Layer is KmlLayer)
				{
					ObservableCollection<KmlFeature> kmlFeatureList = new ObservableCollection<KmlFeature>();
					kmlFeatureList.Add((e.Layer as KmlLayer).RootFeature);

					treeView.ItemsSource = kmlFeatureList;

					await MyMapView.SetViewAsync(new MapPoint(570546.04, 6867036.46), 1000000);
				}
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message, "Sample Error");
			}
		}
       private async void MyMapView_Tapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
       {
           try
           {
               Progress.Visibility = Visibility.Visible;

               
               _inputOverlay.Graphics.Clear();
               _inputOverlay.Graphics.Add(new Graphic() { Geometry = e.Location });

               Geoprocessor geoprocessorTask = new Geoprocessor(new Uri(MessageInABottleServiceUrl));

               var parameter = new GPInputParameter() { OutSpatialReference = MyMapView.SpatialReference };
			   var ptNorm = GeometryEngine.NormalizeCentralMeridian(e.Location);
               var ptGeographic = GeometryEngine.Project(ptNorm, SpatialReferences.Wgs84) as MapPoint;

               parameter.GPParameters.Add(new GPFeatureRecordSetLayer("Input_Point", ptGeographic));
               parameter.GPParameters.Add(new GPDouble("Days", Convert.ToDouble(DaysTextBox.Text)));

               var result = await geoprocessorTask.ExecuteAsync(parameter);

               _resultsOverlay.Graphics.Clear();

               foreach (GPParameter gpParameter in result.OutParameters)
               {
                   if (gpParameter is GPFeatureRecordSetLayer)
                   {
                       GPFeatureRecordSetLayer gpLayer = gpParameter as GPFeatureRecordSetLayer;
                       _resultsOverlay.Graphics.AddRange(gpLayer.FeatureSet.Features.OfType<Graphic>());
                   }
               }
           }
           catch (Exception ex)
           {
               var _x = new MessageDialog("Geoprocessor service failed: " + ex.Message, "Sample Error").ShowAsync();
           }
           finally
           {
               Progress.Visibility = Visibility.Collapsed;
           }
       }
		private async void MyMapView_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
		{
			try
			{
				if (rbStops.IsChecked == true)
				{
					var graphicIdx = _stopGraphicsOverlay.Graphics.Count + 1;
					_stopGraphicsOverlay.Graphics.Add(CreateStopGraphic(e.Location, graphicIdx));
				}
				else
				{
					_barrierGraphicsOverlay.Graphics.Add(new Graphic(e.Location));
				}

				await SolveRoute();
			}
			catch (Exception ex)
			{
				var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
			}
		}
        // Begin geoprocessing with a user tap on the map
        private async void mapView_MapViewTapped(object sender, Esri.ArcGISRuntime.Controls.MapViewInputEventArgs e)
        {
            try
            {
                Progress.Visibility = Visibility.Visible;

                InputLayer.Graphics.Clear();
                InputLayer.Graphics.Add(new Graphic() { Geometry = e.Location });

                Geoprocessor geoprocessorTask = new Geoprocessor(
                    new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_Currents_World/GPServer/MessageInABottle"));

                var parameter = new GPInputParameter() { OutSpatialReference = mapView.SpatialReference };
                var ptNorm = GeometryEngine.NormalizeCentralMeridianOfGeometry(e.Location);
                var ptGeographic = GeometryEngine.Project(ptNorm, SpatialReferences.Wgs84) as MapPoint;

                parameter.GPParameters.Add(new GPFeatureRecordSetLayer("Input_Point", ptGeographic));
                parameter.GPParameters.Add(new GPDouble("Days", Convert.ToDouble(DaysTextBox.Text)));

                var result = await geoprocessorTask.ExecuteAsync(parameter);

                ResultLayer.Graphics.Clear();
                foreach (GPParameter gpParameter in result.OutParameters)
                {
                    if (gpParameter is GPFeatureRecordSetLayer)
                    {
                        GPFeatureRecordSetLayer gpLayer = gpParameter as GPFeatureRecordSetLayer;
                        ResultLayer.Graphics.AddRange(gpLayer.FeatureSet.Features);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Geoprocessor service failed: " + ex.Message, "Sample Error");
            }
            finally
            {
                Progress.Visibility = Visibility.Collapsed;
            }
        }
Beispiel #50
0
    public IEnumerable <T> Download(string?whereClause = null, string?extraParameters = null, bool keepQuerying = false, int degreeOfParallelism = 1, CancellationToken?cancellationToken = null)
    {
        var featureSet = Esri.GetFeatureSet(Url, Token, typeof(T).HasGeometry(), LayerInfo.hasZ, whereClause, extraParameters, null).Result;

        foreach (var g in featureSet.features)
        {
            yield return(g.ToFeature <T>(LayerInfo));
        }

        var objectIds = featureSet.features.Select(g => g.attributes[LayerInfo.GetObjectIdFieldName()].GetInt32()).ToArray();

        if (!keepQuerying || objectIds.Length == 0)
        {
            yield break;
        }

        var remainingObjectIds = Esri.GetOIDSet(Url, Token, whereClause, extraParameters).Result.objectIds.Except(objectIds);

        foreach (var f in Download(remainingObjectIds, whereClause, extraParameters, LayerInfo.maxRecordCount ?? objectIds.Length, degreeOfParallelism, cancellationToken))
        {
            yield return(f);
        }
    }
Beispiel #51
0
    private static async Task <EditResult <T> > ApplyEdits <T>(this ILayer <T> layer, T[]?featuresToAdd = null, T[]?featuresToUpdate = null, T[]?featuresToDelete = null) where T : Feature
    {
        var adds    = featuresToAdd?.Select(f => f.ToGraphic(layer.LayerInfo, false)).ToArray();
        var updates = featuresToUpdate?.Select(f => f.ToGraphic(layer.LayerInfo, true)).Where(o => o is not null).ToArray();
        var deletes = featuresToDelete?.Select(f => f.OID).ToArray();

        var editResultSet = await Esri.ApplyEdits(layer.Url, layer.Token, adds, updates, deletes);

        if (editResultSet.error is null)
        {
            foreach (var f in featuresToUpdate ?? Array.Empty <T>())
            {
                f.IsDirty = false;
            }

            foreach (var f in featuresToDelete ?? Array.Empty <T>())
            {
                f.OID     = -1;
                f.IsDirty = false;
            }
        }

        return(new EditResult <T>(editResultSet, layer));
    }
Beispiel #52
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Layer{T}"/> class.
 /// </summary>
 /// <param name="url">Layer url (ends with the layer id).</param>
 /// <param name="user">User name.</param>
 /// <param name="password">Password.</param>
 /// <param name="tokenUrl">Generate token url (defaults to ArcGIS Online).</param>
 public Layer(string url, string user, string password, string tokenUrl = "https://www.arcgis.com/sharing/rest/generateToken")
 {
     this.token = string.IsNullOrEmpty(user) || string.IsNullOrEmpty(password) ? null : new Token(tokenUrl, user, password);
     Url        = url;
     LayerInfo  = Esri.GetLayer(url, Token).Result;
 }
Beispiel #53
0
    public static async Task <Token> GenerateToken(string tokenUrl, string user, string password, int expiration = 60)
    {
        var token = await Esri.GetTokenInfo(tokenUrl, user, password, expiration);

        return(new Token(token.token, Esri.BaseTime.AddMilliseconds(token.expires)));
    }
Beispiel #54
0
    public static async Task <EditResult <T> > DeleteAsync <T>(this IDelete <T> layer, string whereClause) where T : Feature
    {
        var editResultSet = await Esri.Delete(layer.Url, layer.Token, whereClause);

        return(new EditResult <T>(editResultSet, layer));
    }
Beispiel #55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Layer{T}"/> class.
 /// </summary>
 /// <param name="url">Layer url (ends with the layer id).</param>
 /// <param name="token">Token.</param>
 public Layer(string url, string?token = null)
 {
     this.token = token is null ? null : new Token(token);
     Url        = url;
     LayerInfo  = Esri.GetLayer(url, Token).Result;
 }