private async void Initialize() { _markerSymbol = layoutGrid.Resources["markerSymbol"] as Symbol; _pointFeatureOverlay = MyMapView.GraphicsOverlays["pointFeatureOverlay"]; // City Layer FeatureLayer cityLayer = new FeatureLayer(new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0")); // State Layer FeatureLayer stateLayer = new FeatureLayer(new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2")); MyMap.OperationalLayers.Add(cityLayer); MyMap.OperationalLayers.Add(stateLayer); // State Query QueryParameters stateQueryParameters = new QueryParameters(); // only select one polygon from State layer stateQueryParameters.WhereClause = "state_name = 'California'"; // Query the State feature table FeatureQueryResult stateQueryResult = await stateLayer.FeatureTable.QueryFeaturesAsync(stateQueryParameters); var stateResult = stateQueryResult.ToList(); // City Query QueryParameters cityQueryParameter = new QueryParameters(); cityQueryParameter.WhereClause = "1=1"; // Query the City feature table FeatureQueryResult cityQueryResult = await cityLayer.FeatureTable.QueryFeaturesAsync(cityQueryParameter); var cities = cityQueryResult.Select(feature => feature.Geometry); var city_name = cityQueryResult.Select(feature => feature.Attributes); var citiesWithinState = cities .Select(city => GeometryEngine.Intersection(city, stateResult[0].Geometry)) .Select(city => new Graphic(city, _markerSymbol)); foreach (Graphic g in citiesWithinState) { _pointFeatureOverlay.Graphics.Add(g); } }
private async Task <List <Geometry> > QueryLineGeometry(string lineKey) { string transmissionDataMapServer = LightningDataSettings.TransmissionDataMapServer; QueryParameters lineQuery = new QueryParameters(); lineQuery.ReturnGeometry = true; lineQuery.WhereClause = $"UPPER(LINENAME) LIKE '%{lineKey.ToUpper()}%'"; ServiceFeatureTable featureTable = new ServiceFeatureTable(new Uri(transmissionDataMapServer)); FeatureQueryResult result = await featureTable.QueryFeaturesAsync(lineQuery); return(result .Select(feature => feature.Geometry) .ToList()); }