private void AndroidMap_MapSingleTap(object sender, Android.Views.MotionEvent e) { PointF location = new PointF(e.GetX(), e.GetY()); PointShape position = ExtentHelper.ToWorldCoordinate(androidMap.CurrentExtent, location.X, location.Y, androidMap.Width, androidMap.Height); LayerOverlay worldOverlay = (LayerOverlay)androidMap.Overlays["WorldOverlay"]; FeatureLayer worldLayer = (FeatureLayer)worldOverlay.Layers["WorldLayer"]; LayerOverlay highlightOverlay = (LayerOverlay)androidMap.Overlays["HighlightOverlay"]; InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)highlightOverlay.Layers["HighlightLayer"]; worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesContaining(position, new string[1] { "CNTRY_NAME" }); worldLayer.Close(); highlightLayer.Open(); highlightLayer.InternalFeatures.Clear(); if (selectedFeatures.Count > 0) { AreaBaseShape areaShape = (AreaBaseShape)selectedFeatures[0].GetShape(); double area = areaShape.GetArea(GeographyUnit.DecimalDegree, AreaUnit.SquareKilometers); messageTextView.Text = string.Format(CultureInfo.InvariantCulture, "{0} has an area of {1:N0} square kilometers.", selectedFeatures[0].ColumnValues["CNTRY_NAME"].Trim(), area); highlightLayer.InternalFeatures.Add(selectedFeatures[0]); } highlightLayer.Close(); highlightOverlay.Refresh(); }
public string GetLengthOfFeature(Map map, GeoCollection <object> args) { PointShape point = new PointShape(Convert.ToDouble(args[0]), Convert.ToDouble(args[1])); FeatureLayer worldLayer = (FeatureLayer)map.StaticOverlay.Layers["RoadLayer"]; InMemoryFeatureLayer streetLayer = (InMemoryFeatureLayer)map.DynamicOverlay.Layers["StreetLayer"]; streetLayer.InternalFeatures.Clear(); worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesNearestTo(point, GeographyUnit.DecimalDegree, 1, new string[1] { "FENAME" }); worldLayer.Close(); string popupContentHtml = string.Empty; if (selectedFeatures.Count > 0) { LineBaseShape lineShape = (LineBaseShape)selectedFeatures[0].GetShape(); double length = lineShape.GetLength(GeographyUnit.DecimalDegree, DistanceUnit.Meter); string contentHtml = "<span style='color:red'>{0}</span> has a length of <span style='color:red'>{1:N0}</span> meters."; string information = string.Format(contentHtml, selectedFeatures[0].ColumnValues["FENAME"].Trim(), length); popupContentHtml = "<div style='font-size:10px; font-family:verdana; padding:4px;'>" + information + "</div>"; streetLayer.InternalFeatures.Add("Street", new Feature(lineShape)); } return(popupContentHtml); }
public void Commit() { try { if (!featureLayer.IsOpen) { featureLayer.Open(); } if (featureLayer.EditTools.IsInTransaction) { currentAddedCount = 0; featureLayer.EditTools.CommitTransaction(); } } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } finally { if (featureLayer.IsOpen) { featureLayer.Close(); } } }
private void AndroidMapMapSingleTap(object sender, Android.Views.MotionEvent e) { PointF location = new PointF(e.GetX(), e.GetY()); PointShape position = ExtentHelper.ToWorldCoordinate(androidMap.CurrentExtent, location.X, location.Y, androidMap.Width, androidMap.Height); LayerOverlay overlay = androidMap.Overlays["RoadOverlay"] as LayerOverlay; FeatureLayer roadLayer = overlay.Layers["TXlkaA40"] as FeatureLayer; LayerOverlay highlightOverlay = androidMap.Overlays["HighlightOverlay"] as LayerOverlay; InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)highlightOverlay.Layers["HighlightLayer"]; roadLayer.Open(); Collection <Feature> selectedFeatures = roadLayer.QueryTools.GetFeaturesNearestTo(position, GeographyUnit.DecimalDegree, 1, new string[1] { "fename" }); roadLayer.Close(); if (selectedFeatures.Count > 0) { LineBaseShape lineShape = (LineBaseShape)selectedFeatures[0].GetShape(); highlightLayer.Open(); highlightLayer.InternalFeatures.Clear(); highlightLayer.InternalFeatures.Add(new Feature(lineShape)); highlightLayer.Close(); double length = lineShape.GetLength(GeographyUnit.DecimalDegree, DistanceUnit.Meter); string lengthMessage = string.Format(CultureInfo.InvariantCulture, "{0} has a length of {1:F2} meters.", selectedFeatures[0].ColumnValues["fename"].Trim(), length); messageLabel.Text = lengthMessage; highlightOverlay.Refresh(); } }
private void SelectInformation(PointShape worldPoint) { try { Collection <Feature> selectedFeatures = new Collection <Feature>(); foreach (Layer layer in ((LayerOverlay)winformsMap1.Overlays[0]).Layers) { FeatureLayer featureLayer = layer as FeatureLayer; if (featureLayer != null) { featureLayer.Open(); Collection <Feature> nearestFeatures = featureLayer.QueryTools.GetFeaturesNearestTo(worldPoint, winformsMap1.MapUnit, 1, ReturningColumnsType.AllColumns); double radius = 10.0 / winformsMap1.Width * winformsMap1.CurrentExtent.Width; EllipseShape searchingEllipse = new EllipseShape(worldPoint, radius, radius); foreach (Feature feature in nearestFeatures) { Feature selectedFeature = feature; selectedFeature.Tag = featureLayer.Name; BaseShape currentShape = feature.GetShape(); if (currentShape is AreaBaseShape) { if (currentShape.Contains(worldPoint)) { selectedFeatures.Add(selectedFeature); } } else if (currentShape is LineBaseShape) { if (currentShape.Intersects(searchingEllipse)) { selectedFeatures.Add(selectedFeature); } } else if (currentShape is PointBaseShape) { if (searchingEllipse.Contains(currentShape)) { selectedFeatures.Add(selectedFeature); } } } featureLayer.Close(); } } if (selectedFeatures.Count > 0) { FormInformation frmInformation = new FormInformation(selectedFeatures); frmInformation.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } }
private void mapView_MapClick(object sender, MapClickMapViewEventArgs e) { FeatureLayer worldLayer = mapView.FindFeatureLayer("WorldLayer"); worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesContaining(e.WorldLocation, new string[2] { "CNTRY_NAME", "POP_CNTRY" }); worldLayer.Close(); if (selectedFeatures.Count > 0) { StringBuilder info = new StringBuilder(); info.AppendLine(String.Format(CultureInfo.InvariantCulture, "CNTRY_NAME:\t{0}", selectedFeatures[0].ColumnValues["CNTRY_NAME"])); info.AppendLine(String.Format(CultureInfo.InvariantCulture, "POP_CNTRY:\t{0}", double.Parse(selectedFeatures[0].ColumnValues["POP_CNTRY"]).ToString("n0"))); TBInfo.Text = info.ToString(); PopupOverlay popupOverlay = (PopupOverlay)mapView.Overlays["PopupOverlay"]; Popup popup = new Popup(e.WorldLocation); popup.Content = info.ToString(); popup.FontSize = 10d; popup.FontFamily = new System.Windows.Media.FontFamily("Verdana"); popupOverlay.Popups.Clear(); popupOverlay.Popups.Add(popup); popupOverlay.Refresh(); } }
private void AndroidMap_MapSingleTap(object sender, Android.Views.MotionEvent e) { PointF location = new PointF(e.GetX(), e.GetY()); PointShape position = ExtentHelper.ToWorldCoordinate(androidMap.CurrentExtent, location.X, location.Y, androidMap.Width, androidMap.Height); LayerOverlay worldOverlay = (LayerOverlay)androidMap.Overlays["WorldOverlay"]; LayerOverlay highlightOverlay = (LayerOverlay)androidMap.Overlays["HighlightOverlay"]; FeatureLayer worldLayer = (FeatureLayer)worldOverlay.Layers["WorldLayer"]; InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)highlightOverlay.Layers["HighlightLayer"]; worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesContaining(position, new string[1] { "CNTRY_NAME" }); worldLayer.Close(); highlightLayer.Open(); highlightLayer.InternalFeatures.Clear(); if (selectedFeatures.Count > 0) { highlightLayer.InternalFeatures.Add(selectedFeatures[0]); } highlightLayer.Close(); highlightOverlay.Refresh(); }
public string GetData(Map map, GeoCollection <object> args) { double clickX = Convert.ToDouble(args[0].ToString(), CultureInfo.InvariantCulture); double clickY = Convert.ToDouble(args[1].ToString(), CultureInfo.InvariantCulture); PointShape pointShape = new PointShape(clickX, clickY); LayerOverlay staticOverlay = (LayerOverlay)map.CustomOverlays["StaticOverlay"]; FeatureLayer worldLayer = (FeatureLayer)staticOverlay.Layers["WorldLayer"]; worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesContaining(pointShape, new string[2] { "CNTRY_NAME", "POP_CNTRY" }); worldLayer.Close(); Country country = new Country(); if (selectedFeatures.Count > 0) { country.CountryName = selectedFeatures[0].ColumnValues["CNTRY_NAME"]; country.Population = selectedFeatures[0].ColumnValues["POP_CNTRY"]; } return(country.CountryName + "|" + country.Population); }
public void FindQueriedFeatures(Map map, GeoCollection <object> args) { double distance = Convert.ToDouble(args[0].ToString(), CultureInfo.InvariantCulture); double clickX = Convert.ToDouble(args[1].ToString(), CultureInfo.InvariantCulture); double clickY = Convert.ToDouble(args[2].ToString(), CultureInfo.InvariantCulture); PointShape pointShape = new PointShape(clickX, clickY); LayerOverlay staticOverlay = (LayerOverlay)map.CustomOverlays["StaticOverlay"]; LayerOverlay dynamicOverlay = (LayerOverlay)map.CustomOverlays["DynamicOverlay"]; FeatureLayer worldLayer = (FeatureLayer)staticOverlay.Layers["WorldLayer"]; InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)dynamicOverlay.Layers["HighlightLayer"]; worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesWithinDistanceOf(pointShape, GeographyUnit.DecimalDegree, DistanceUnit.Kilometer, distance, new string[0]); worldLayer.Close(); if (highlightLayer.InternalFeatures.Count > 0) { highlightLayer.InternalFeatures.Clear(); } highlightLayer.InternalFeatures.Add("Point", new Feature(pointShape)); foreach (Feature feature in selectedFeatures) { highlightLayer.InternalFeatures.Add(feature.Id, feature); } dynamicOverlay.Redraw(); }
private void FindWithinDistanceFeatures() { if (mapView.Overlays.Count > 0) { FeatureLayer worldLayer = mapView.FindFeatureLayer("WorldLayer"); InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)mapView.FindFeatureLayer("HighlightLayer"); // Find the countries within special distance. double distance = Convert.ToDouble(cmbDistance.SelectedItem.ToString().Split(':')[1], CultureInfo.InvariantCulture); worldLayer.Open(); worldLayer.FeatureSource.ProjectionConverter = project; Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesWithinDistanceOf((PointShape)project.ConvertToExternalProjection(pointShape), GeographyUnit.DecimalDegree, DistanceUnit.Kilometer, distance, new string[0]); worldLayer.FeatureSource.ProjectionConverter = null; worldLayer.Close(); if (highlightLayer.InternalFeatures.Count > 0) { highlightLayer.InternalFeatures.Clear(); } highlightLayer.InternalFeatures.Add("Point", new Feature(pointShape)); foreach (Feature feature in selectedFeatures) { highlightLayer.InternalFeatures.Add(feature.Id, project.ConvertToInternalProjection(feature)); } mapView.Overlays["HighlightOverlay"].Refresh(); } }
private void AndroidMap_MapSingleTap(object sender, MotionEvent e) { LayerOverlay worldOverlay = (LayerOverlay)androidMap.Overlays["WorldOverlay"]; FeatureLayer worldLayer = (FeatureLayer)worldOverlay.Layers["WorldLayer"]; LayerOverlay highlightOverlay = (LayerOverlay)androidMap.Overlays["HighlightOverlay"]; InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)highlightOverlay.Layers["HighlightLayer"]; PointF location = new PointF(e.GetX(), e.GetY()); var worldLocation = ExtentHelper.ToWorldCoordinate(androidMap.CurrentExtent, location.X, location.Y, androidMap.Width, androidMap.Height); worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesContaining(worldLocation, ReturningColumnsType.NoColumns); worldLayer.Close(); highlightLayer.Open(); highlightLayer.InternalFeatures.Clear(); if (selectedFeatures.Count > 0) { androidMap.ZoomTo(selectedFeatures[0].GetBoundingBox()); highlightLayer.InternalFeatures.Add(selectedFeatures[0]); } highlightLayer.Close(); highlightOverlay.Refresh(); }
protected override DataTable GetDataTableCore(DataTable currentDataTable, int length) { try { Monitor.Enter(featureLayer); featureLayer.Open(); Collection <Feature> features = new Collection <Feature>(); featureLayer.FeatureSource.SafeProcess(() => { features = featureLayer.FeatureSource.GetAllFeatures(featureLayer.FeatureSource.GetColumns().Select(c => c.ColumnName).ToArray(), currentDataTable.Rows.Count, length); }); FillFeaturesToDataTable(features, currentDataTable); return(currentDataTable); } catch (Exception e) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, e.Message, new ExceptionInfo(e)); return(currentDataTable); } finally { featureLayer.Close(); Monitor.Exit(featureLayer); } }
private void mapView_MapClick(object sender, MapClickMapViewEventArgs e) { LayerOverlay worldOverlay = (LayerOverlay)mapView.Overlays["WorldOverlay"]; FeatureLayer worldLayer = (FeatureLayer)worldOverlay.Layers["WorldLayer"]; LayerOverlay highlightOverlay = (LayerOverlay)mapView.Overlays["HighlightOverlay"]; InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)highlightOverlay.Layers["HighlightLayer"]; worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesContaining(e.WorldLocation, new string[1] { "CNTRY_NAME" }); worldLayer.Close(); highlightLayer.Open(); highlightLayer.InternalFeatures.Clear(); if (selectedFeatures.Count > 0) { highlightLayer.InternalFeatures.Add(selectedFeatures[0]); } highlightLayer.Close(); // Call Refresh method to refresh the highlightOverlay only highlightOverlay.Refresh(); }
private void mapView_MapClick(object sender, MapClickMapViewEventArgs e) { FeatureLayer worldLayer = mapView.FindFeatureLayer("WorldLayer"); // Find the country the user clicked on. worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesContaining(e.WorldLocation, new string[1] { "CNTRY_NAME" }); worldLayer.Close(); // Determine the area of the country. if (selectedFeatures.Count > 0) { ProjectionConverter project = new ProjectionConverter(3857, 4326); project.Open(); AreaBaseShape areaShape = (AreaBaseShape)project.ConvertToExternalProjection(selectedFeatures[0].GetShape()); project.Close(); double area = areaShape.GetArea(GeographyUnit.DecimalDegree, AreaUnit.SquareKilometers); string areaMessage = string.Format(CultureInfo.InvariantCulture, "{0} has an area of \r{1:N0} square kilometers.", selectedFeatures[0].ColumnValues["CNTRY_NAME"].Trim(), area); Popup popup = new Popup(e.WorldLocation); popup.Content = areaMessage; PopupOverlay popupOverlay = (PopupOverlay)mapView.Overlays["PopupOverlay"]; popupOverlay.Popups.Clear(); popupOverlay.Popups.Add(popup); popupOverlay.Refresh(); } }
private void FindButtonClick(object sender, EventArgs e) { LayerOverlay worldOverlay = (LayerOverlay)androidMap.Overlays["WorldOverlay"]; FeatureLayer worldLayer = (FeatureLayer)worldOverlay.Layers["WorldLayer"]; LayerOverlay highlightOverlay = (LayerOverlay)androidMap.Overlays["HighlightOverlay"]; InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)highlightOverlay.Layers["HighlightLayer"]; worldLayer.Open(); string[] returnColumnNames = new string[] { "LONG_NAME" }; Feature feature = worldLayer.FeatureSource.GetFeatureById("137", returnColumnNames); worldLayer.Close(); if (feature != null) { highlightLayer.Open(); highlightLayer.InternalFeatures.Clear(); highlightLayer.InternalFeatures.Add(feature); highlightLayer.Close(); highlightOverlay.Refresh(); androidMap.ZoomTo(feature.GetBoundingBox()); } }
private void FindWithinDistanceFeatures() { FeatureLayer worldLayer = winformsMap1.FindFeatureLayer("WorldLayer"); InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("HighlightLayer"); // Find the countries within special distance. double distance = Convert.ToDouble(cmbDistance.SelectedItem.ToString(), CultureInfo.InvariantCulture); worldLayer.Open(); Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesWithinDistanceOf(pointShape, GeographyUnit.DecimalDegree, DistanceUnit.Kilometer, distance, new string[0]); worldLayer.Close(); if (highlightLayer.InternalFeatures.Count > 0) { highlightLayer.InternalFeatures.Clear(); } highlightLayer.InternalFeatures.Add("Point", new Feature(pointShape)); foreach (Feature feature in selectedFeatures) { highlightLayer.InternalFeatures.Add(feature.Id, feature); } winformsMap1.Refresh(winformsMap1.Overlays["HighlightOverlay"]); }
private void btnGetCount_Click(object sender, EventArgs e) { FeatureLayer worldLayer = winformsMap1.FindFeatureLayer("WorldLayer"); worldLayer.Open(); txtCount.Text = worldLayer.QueryTools.GetCount().ToString(CultureInfo.InvariantCulture); worldLayer.Close(); }
private void btnGetCount_Click(object sender, RoutedEventArgs e) { FeatureLayer worldLayer = mapView.FindFeatureLayer("WorldLayer"); worldLayer.Open(); txtCount.Content = worldLayer.QueryTools.GetCount().ToString(CultureInfo.InvariantCulture); worldLayer.Close(); }
private DataTable PopulateTable(FeatureLayer featureLayer) { featureLayer.Open(); Collection <FeatureSourceColumn> allColumns = featureLayer.QueryTools.GetColumns(); featureLayer.Close(); return(GetDataTableFromFeatureSourceColumns(allColumns)); }
private void btnOneFeature_Click(object sender, EventArgs e) { FeatureLayer worldLayer = winformsMap1.FindFeatureLayer("WorldLayer"); worldLayer.Open(); winformsMap1.CurrentExtent = worldLayer.FeatureSource.GetBoundingBoxById("137"); worldLayer.Close(); winformsMap1.Refresh(); }
private DataTable BindAllFeaturesToGridView(FeatureLayer featureLayer) { string[] returningColumns = new string[] { "CNTRY_NAME", "CURR_TYPE", "RECID" }; featureLayer.Open(); Collection <Feature> allFeaturs = featureLayer.FeatureSource.GetAllFeatures(returningColumns); featureLayer.Close(); return(GetDataTableFromFeatures(allFeaturs, returningColumns)); }
private Collection <Feature> FilterEarthquakePoints(Map Map1, Collection <EarthquakeQueryConfiguration> queryConfigurations) { IEnumerable <Feature> allFeatures = new Collection <Feature>(); if (Map1.EditOverlay.Features.Count > 0) { Feature queryFeature = Feature.Union(Map1.EditOverlay.Features); BaseShape queryShape = queryFeature.GetShape(); FeatureLayer currentEarthquakeLayer = (Map1.CustomOverlays["EarthquakeOverlay"] as LayerOverlay).Layers[0] as FeatureLayer; currentEarthquakeLayer.Open(); allFeatures = currentEarthquakeLayer.FeatureSource.GetFeaturesWithinDistanceOf(queryShape, Map1.MapUnit, DistanceUnit.Meter, 1, ReturningColumnsType.AllColumns); currentEarthquakeLayer.Close(); } // filter the feature based on the query configuration. allFeatures = allFeatures.Where((f) => { bool isIncluded = true; foreach (EarthquakeQueryConfiguration item in queryConfigurations) { double columnValue = double.Parse(f.ColumnValues[item.Parameter]); if ((columnValue > item.Maximum || columnValue < item.Minimum) && columnValue > 0) // nagetive means no record. { isIncluded = false; break; } } return(isIncluded); }).ToList(); // clear the original markers and add new markers. LayerOverlay queryResultMarkerOverlay = Map1.CustomOverlays["QueryResultMarkerOverlay"] as LayerOverlay; InMemoryFeatureLayer markerMemoryLayer = queryResultMarkerOverlay.Layers["MarkerMemoryLayer"] as InMemoryFeatureLayer; markerMemoryLayer.InternalFeatures.Clear(); foreach (Feature item in allFeatures) { markerMemoryLayer.InternalFeatures.Add(item); } queryResultMarkerOverlay.Redraw(); LayerOverlay trackShapeOverlay = Map1.CustomOverlays["TrackShapeOverlay"] as LayerOverlay; // clear the original track shapes and add the new shapes. InMemoryFeatureLayer trackShapeLayer = trackShapeOverlay.Layers["TrackShapeLayer"] as InMemoryFeatureLayer; trackShapeLayer.InternalFeatures.Clear(); foreach (Feature item in Map1.EditOverlay.Features) { trackShapeLayer.InternalFeatures.Add(item); } trackShapeOverlay.Redraw(); return(new Collection <Feature>(allFeatures.ToList())); }
private void PopulateTable() { FeatureLayer worldLayer = winformsMap1.FindFeatureLayer("WorldLayer"); worldLayer.Open(); Collection <FeatureSourceColumn> allColumns = worldLayer.QueryTools.GetColumns(); worldLayer.Close(); dgridFeatures.DataSource = GetDataTableFromFeatureSourceColumns(allColumns); }
/// <summary> /// Perform the 'Get Features Within Distance' spatial query using the layer's QueryTools /// </summary> private Collection <Feature> PerformSpatialQuery(BaseShape shape, FeatureLayer layer) { Collection <Feature> features = new Collection <Feature>(); // Perform the spatial query on features in the specified layer layer.Open(); features = layer.QueryTools.GetFeaturesWithinDistanceOf(shape, GeographyUnit.Meter, DistanceUnit.Meter, (int)searchRadius.Value, ReturningColumnsType.NoColumns); layer.Close(); return(features); }
public string GetCount(Map map, GeoCollection <object> args) { LayerOverlay staticOverlay = (LayerOverlay)map.CustomOverlays["StaticOverlay"]; FeatureLayer worldLayer = (FeatureLayer)staticOverlay.Layers["WorldLayer"]; worldLayer.Open(); string result = string.Format("There are <span style='color:red;font-size:15;font-weight:bolder;'>{0}</span> records in this vector layer.", worldLayer.QueryTools.GetCount()); worldLayer.Close(); return(result); }
private void btnColumns_Click(object sender, RoutedEventArgs e) { FeatureLayer worldLayer = mapView.FindFeatureLayer("WorldLayer"); worldLayer.Open(); Collection <FeatureSourceColumn> allColumns = worldLayer.QueryTools.GetColumns(); worldLayer.Close(); dgridFeatures.DataContext = GetDataTableFromFeatureSourceColumns(allColumns); dgridFeatures.SetBinding(ListView.ItemsSourceProperty, new Binding()); }
/// <summary> /// Get a feature based on a location /// </summary> private Feature GetFeatureFromLocation(PointShape location) { // Get the parks layer from the MapView FeatureLayer parksLayer = mapView.FindFeatureLayer("Frisco Parks"); // Find the feature that was tapped on by querying the layer for features containing the tapped coordinates parksLayer.Open(); Feature selectedFeature = parksLayer.QueryTools.GetFeaturesContaining(location, ReturningColumnsType.AllColumns).FirstOrDefault(); parksLayer.Close(); return(selectedFeature); }