Exemplo n.º 1
0
        public async void SearchByMeterID(string searchString)
        {
            SimpleLineSymbol sls = new SimpleLineSymbol()
            {
                Color = System.Windows.Media.Colors.Red,
                Style = SimpleLineStyle.Solid,
                Width = 2
            };

            // get the layer and table
            FeatureLayer            featureLayer = this.mapView.Map.Layers[1] as FeatureLayer;
            GeodatabaseFeatureTable table        = featureLayer.FeatureTable as GeodatabaseFeatureTable;

            // Define an attribute query
            var filter = new Esri.ArcGISRuntime.Data.QueryFilter();

            filter.WhereClause = "POST_ID = '" + searchString + "'";     // 666-13080

            // Execute the query and await results
            IEnumerable <Feature> features = await table.QueryAsync(filter);

            // iterate the feature. Should be one in this case.
            foreach (Feature feature in features)
            {
                // Get the MapPoint, Project to Mercator so that we are working in meters
                MapPoint mapPoint      = feature.Geometry as MapPoint;
                MapPoint pointMercator = GeometryEngine.Project(mapPoint, SpatialReferences.WebMercator) as MapPoint;
                Geometry polygon       = GeometryEngine.Buffer(pointMercator, 200);

                // Re-project the polygon to WGS84 so that we can query against the layer which is in WGS84
                Polygon polygonWgs84 = GeometryEngine.Project(polygon, SpatialReferences.Wgs84) as Polygon;

                // add the circle (buffer)
                Graphic graphic = new Graphic();
                graphic.Symbol   = sls;
                graphic.Geometry = polygonWgs84;
                this.graphicsLayer.Graphics.Add(graphic);

                // Make sure the table supports querying
                if (table.SupportsQuery)
                {
                    // setup the query to use the polygon that's in WGS84
                    var query = new Esri.ArcGISRuntime.Data.SpatialQueryFilter();
                    query.Geometry            = polygonWgs84 as Geometry;
                    query.SpatialRelationship = SpatialRelationship.Intersects;

                    var result = await table.QueryAsync(query);

                    int i = 1;
                    // Loop through query results
                    foreach (Esri.ArcGISRuntime.Data.Feature f in result)
                    {
                        // do something with results
                        System.Diagnostics.Debug.WriteLine(i.ToString());
                        i++;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public async void Search(string searchString)
        {
            FeatureLayer            featureLayer = this.mapView.Map.Layers[1] as FeatureLayer;
            GeodatabaseFeatureTable table        = featureLayer.FeatureTable as GeodatabaseFeatureTable;

            // Define an attribute query
            var filter = new Esri.ArcGISRuntime.Data.QueryFilter();

            filter.WhereClause = "POST_ID = '" + searchString + "'";     // 666-13080

            // Execute the query and await results
            IEnumerable <Feature> features = await table.QueryAsync(filter);

            foreach (Feature feature in features)
            {
                string address = feature.Attributes["STREETNAME"] as string;
                System.Diagnostics.Debug.WriteLine("Address: " + address);
            }
        }
Exemplo n.º 3
0
            public async void Search(string searchString)
            {
                FeatureLayer featureLayer = this.mapView.Map.Layers[1] as FeatureLayer;
                GeodatabaseFeatureTable table = featureLayer.FeatureTable as GeodatabaseFeatureTable;

                // Define an attribute query
                var filter = new Esri.ArcGISRuntime.Data.QueryFilter();
                filter.WhereClause = "POST_ID = '" + searchString + "'"; // 666-13080

                // Execute the query and await results
                IEnumerable<Feature> features = await table.QueryAsync(filter);
               
                foreach(Feature feature in features)
                {
                    string address = feature.Attributes["STREETNAME"] as string;
                    System.Diagnostics.Debug.WriteLine("Address: " + address);
                }
            }
Exemplo n.º 4
0
            public async void SearchByMeterID(string searchString)
            {
                SimpleLineSymbol sls = new SimpleLineSymbol()
                {
                    Color = System.Windows.Media.Colors.Red,
                    Style = SimpleLineStyle.Solid,
                    Width = 2
                };

                // get the layer and table
                FeatureLayer featureLayer = this.mapView.Map.Layers[1] as FeatureLayer;
                GeodatabaseFeatureTable table = featureLayer.FeatureTable as GeodatabaseFeatureTable;

                // Define an attribute query
                var filter = new Esri.ArcGISRuntime.Data.QueryFilter();
                filter.WhereClause = "POST_ID = '" + searchString + "'"; // 666-13080

                // Execute the query and await results
                IEnumerable<Feature> features = await table.QueryAsync(filter);

                // iterate the feature. Should be one in this case.
                foreach (Feature feature in features)
                {
                    // Get the MapPoint, Project to Mercator so that we are working in meters
                    MapPoint mapPoint = feature.Geometry as MapPoint;
                    MapPoint pointMercator = GeometryEngine.Project(mapPoint, SpatialReferences.WebMercator) as MapPoint;
                    Geometry polygon = GeometryEngine.Buffer(pointMercator, 200);

                    // Re-project the polygon to WGS84 so that we can query against the layer which is in WGS84
                    Polygon polygonWgs84 = GeometryEngine.Project(polygon, SpatialReferences.Wgs84) as Polygon;

                    // add the circle (buffer)
                    Graphic graphic = new Graphic();
                    graphic.Symbol = sls;
                    graphic.Geometry = polygonWgs84;
                    this.graphicsLayer.Graphics.Add(graphic);

                    // Make sure the table supports querying
                    if (table.SupportsQuery)
                    {
                        // setup the query to use the polygon that's in WGS84
                        var query = new Esri.ArcGISRuntime.Data.SpatialQueryFilter();
                        query.Geometry = polygonWgs84 as Geometry;
                        query.SpatialRelationship = SpatialRelationship.Intersects;

                        var result = await table.QueryAsync(query);

                        int i = 1;
                        // Loop through query results
                        foreach (Esri.ArcGISRuntime.Data.Feature f in result)
                        {
                            // do something with results
                            System.Diagnostics.Debug.WriteLine(i.ToString());
                            i++;
                        }

                    }
                }
            }