Beispiel #1
0
        // 관리번호로 해당Feature 객체찾기
        public async void SelectFct(string _FTR_CDE, string _FTR_IDN, FeatureLayer _featureLayer)
        {
            // 0.Feature 테이블 가져오기
            //FeatureLayer __featureLayer = _featureLayer.Clone() as FeatureLayer;
            FeatureTable _featureTable = _featureLayer.FeatureTable;



            // Create a query parameters that will be used to Query the feature table.
            QueryParameters queryParams = new QueryParameters();


            // Construct and assign the where clause that will be used to query the feature table.
            queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' ORDER BY FTR_IDN DESC";
            if (!FmsUtil.IsNull(_FTR_IDN))
            {
                queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' AND FTR_IDN like '%' ||  " + _FTR_IDN + " || '%'";
            }


            List <Feature> features;

            try
            {
                // Query the feature table.
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                features = queryResult.ToList();
            }
            catch (Exception e)
            {
                Messages.ShowErrMsgBox(e.Message);
                return;
            }

            if (features.Any())
            {
                // Create an envelope.
                EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);



                if (features.Count == 1)
                {
                    //한건인 경우 선택처리
                    ShowFctPage(features[0]);
                }
                else
                {
                    //피쳐영역 Extent 위치이동
                    foreach (Feature feature in features)
                    {
                        envBuilder.UnionOf(feature.Geometry.Extent); //복수의 피처영역 합치기
                    }
                    // Zoom to the extent of the selected feature(s).
                    await mapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
            }
        }
Beispiel #2
0
        private async Task HideLeatherbackTurtleSpecies()
        {
            try
            {
                // Create a query parameters that will be used to Query the feature table.
                QueryParameters queryParams = new QueryParameters();

                // Construct and assign the where clause that will be used to query the feature table.
                queryParams.WhereClause = "Species = 'Leatherback' or Species = 'Leatherback Sea Turtle' or Species = 'Leatherback Sea Turtle (2+)'";

                // Query the feature table.
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                List <Feature> features = queryResult.ToList();

                if (features.Any())
                {
                    // Loop over each feature from the query result.
                    foreach (Feature feature in features)
                    {
                        // Select each feature.
                        _featureLayer.SetFeatureVisible(feature, false);
                    }
                }
                else
                {
                    MessageBox.Show("No Features to Select");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred.\n" + ex, "Sample error");
            }
        }
Beispiel #3
0
        public async void UpdateExtents(object sender, RoutedEventArgs e)
        {
            statusTextBlock.Text = "Updating Extents";

            QueryParameters queryParams = new QueryParameters();

            queryParams.WhereClause = "TaxID LIKE '" + _currTaxID + "'";

            FeatureQueryResult queryResult = await sfFeatTable.QueryFeaturesAsync(queryParams);

            List <Feature> features = queryResult.ToList();

            if (features.Any())
            {
                EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReference.Create(102715));

                foreach (Feature feature in features)
                {
                    envBuilder.UnionOf(feature.Geometry.Extent);
                    newFeatureLayer.ClearSelection();
                    newFeatureLayer.SelectFeature(feature);
                }

                await MyMapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 20);

                statusTextBlock.Text = "";
            }

            else
            {
                statusTextBlock.Text = "No parcel found for current query";
            }
        }
Beispiel #4
0
        private async void SolveRoutesClick(object sender, EventArgs e)
        {
            // Holds locations of hospitals around San Diego.
            List <Facility> facilities = new List <Facility>();

            // Holds locations of hospitals around San Diego.
            List <Incident> incidents = new List <Incident>();

            // Create query parameters to select all features.
            QueryParameters queryParams = new QueryParameters()
            {
                WhereClause = "1=1"
            };

            // Query all features in the facility table.
            FeatureQueryResult facilityResult = await _facilityTable.QueryFeaturesAsync(queryParams);

            // Add all of the query results to facilities as new Facility objects.
            facilities.AddRange(facilityResult.ToList().Select(feature => new Facility((MapPoint)feature.Geometry)));

            // Query all features in the incident table.
            FeatureQueryResult incidentResult = await _incidentTable.QueryFeaturesAsync(queryParams);

            // Add all of the query results to facilities as new Incident objects.
            incidents.AddRange(incidentResult.ToList().Select(feature => new Incident((MapPoint)feature.Geometry)));

            // Set facilities and incident in parameters.
            ClosestFacilityParameters closestFacilityParameters = await _task.CreateDefaultParametersAsync();

            closestFacilityParameters.SetFacilities(facilities);
            closestFacilityParameters.SetIncidents(incidents);

            try
            {
                // Use the task to solve for the closest facility.
                ClosestFacilityResult result = await _task.SolveClosestFacilityAsync(closestFacilityParameters);

                for (int i = 0; i < incidents.Count; i++)
                {
                    // Get the index of the closest facility to incident. (i) is the index of the incident, [0] is the index of the closest facility.
                    int closestFacility = result.GetRankedFacilityIndexes(i)[0];

                    // Get the route to the closest facility.
                    ClosestFacilityRoute route = result.GetRoute(closestFacility, i);

                    // Display the route on the graphics overlay.
                    _myMapView.GraphicsOverlays[0].Graphics.Add(new Graphic(route.RouteGeometry, _routeSymbols[i % _routeSymbols.Count]));
                }

                // Disable the solve button.
                _solveRoutesButton.Enabled = false;

                // Enable the reset button.
                _resetButton.Enabled = true;
            }
            catch (Esri.ArcGISRuntime.Http.ArcGISWebException exception)
            {
                CreateErrorDialog("An ArcGIS web exception occurred.\n" + exception.Message);
            }
        }
Beispiel #5
0
        private async void OnMapViewTapped(object sender, Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs e)
        {
            try
            {
                Console.WriteLine("タップしました");

                // 2回目以降の検索時でフィーチャが選択されている場合は、選択を解除
                if (myFeatures != null && myFeatures.Count() != 0)
                {
                    myFeatureLayer.UnselectFeatures(myFeatures);
                }

                // グラフィック オーバレイに追加したグラフィックを削除
                myGraphicsOverlay.Graphics.Clear();

                // タップした地点から1000メートルのバッファーの円を作成し、グラフィックとして表示する
                var buffer        = GeometryEngine.Buffer(e.Location, 1000);
                var outLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.DashDot, System.Drawing.Color.Yellow, 5);
                var fillSymbol    = new SimpleFillSymbol(SimpleFillSymbolStyle.Null, System.Drawing.Color.White, outLineSymbol);
                var graphic       = new Graphic(buffer, null, fillSymbol);

                myGraphicsOverlay.Graphics.Add(graphic);

                // フィーチャの検索用のパラメーターを作成
                var queryParams = new QueryParameters();
                // 検索範囲を作成したバファーの円に指定
                queryParams.Geometry = buffer;

                // 検索範囲とフィーチャの空間的な関係性を指定(バファーの円の中にフィーチャが含まれる)
                queryParams.SpatialRelationship = SpatialRelationship.Contains;
                // フィーチャの検索を実行
                FeatureQueryResult queryResult = await myFeatureLayer.FeatureTable.QueryFeaturesAsync(queryParams);

                var alertString = "";

                // 検索結果のフィーチャのリストを取得
                myFeatures = queryResult.ToList();
                // 検索結果のフィーチャを選択(ハイライト表示)
                myFeatureLayer.SelectFeatures(myFeatures);

                for (int i = 0; i < myFeatures.Count; ++i)
                {
                    Feature feature = myFeatures[i];
                    // フィーチャの"Name"フィールドの属性値を取得
                    var nameStr = feature.GetAttributeValue("物件名");
                    alertString = alertString + Environment.NewLine + nameStr;
                    Console.WriteLine(nameStr);
                }

                // 取得した属性値をアラート表示
                await DisplayAlert("検索結果", alertString, "OK");
            }

            catch (Exception ex)
            {
                await DisplayAlert("検索のエラー", ex.ToString(), "OK");
            }
        }
Beispiel #6
0
        private async Task MakeTableFromTurtleData()
        {
            if (TurtleTableButton.Content.Equals("Hide Turtle Data Table"))
            {
                TurtleDataGrid.Visibility = Visibility.Hidden;
                TurtleTableButton.Content = "Show Turtle Data Table";
            }

            else
            {
                try
                {
                    // Create a query parameters that will be used to Query the feature table.
                    QueryParameters queryParams = new QueryParameters();

                    // Construct and assign the where clause that will be used to query the feature table.
                    queryParams.WhereClause = "1=1";

                    // Query the feature table.
                    FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                    // Cast the QueryResult to a List so the results can be interrogated.
                    List <Feature> features = queryResult.ToList();


                    if (features.Any())
                    {
                        // Loop over each feature from the query result.
                        foreach (Feature feature in features)
                        {
                            TurtleData turtleData = new TurtleData();
                            turtleData.Species    = feature.GetAttributeValue("Species").ToString();
                            turtleData.Date_Found = feature.GetAttributeValue("Date").ToString();
                            //turtleData.Alive_or_Dead = feature.GetAttributeValue("Alive_Dead").ToString();
                            //turtleData.Area_Found = feature.GetAttributeValue("Area").ToString();
                            //turtleData.State_Found = feature.GetAttributeValue("State").ToString();
                            //turtleData.Longitude = feature.GetAttributeValue("Longitude").ToString();
                            //turtleData.Latitude = feature.GetAttributeValue("Latitude").ToString();
                            //turtleData.Notes = feature.GetAttributeValue("Notes").ToString();
                            turtleDataList.Add(turtleData);
                        }

                        TurtleDataGrid.ItemsSource = turtleDataList;
                        TurtleDataGrid.Visibility  = Visibility.Visible;
                        TurtleTableButton.Content  = "Hide Turtle Data Table";
                    }
                    else
                    {
                        MessageBox.Show("No Features to Select");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("An error occurred.\n" + ex, "Sample error");
                }
            }
        }
Beispiel #7
0
        private async void Initialize()
        {
            try
            {
                // Create a new Map with a streets basemap.
                Map myMap = new Map(Basemap.CreateStreets());

                // Create the URI to the Service Requests map service.
                Uri serviceRequestUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/MapServer");

                // Create a new ArcGISMapImageLayer that uses the service URI.
                ArcGISMapImageLayer serviceRequestsMapImageLayer = new ArcGISMapImageLayer(serviceRequestUri);

                // Load all sublayers and tables contained by the map image layer.
                await serviceRequestsMapImageLayer.LoadTablesAndLayersAsync();

                // Set the initial map extent to the extent of all service request features.
                Envelope requestsExtent = serviceRequestsMapImageLayer.FullExtent;
                myMap.InitialViewpoint = new Viewpoint(requestsExtent);

                // Add the layer to the map.
                myMap.OperationalLayers.Add(serviceRequestsMapImageLayer);

                // Get the service request comments table from the map image layer.
                ServiceFeatureTable commentsTable = serviceRequestsMapImageLayer.Tables[0];

                // Create query parameters to get all non-null service request comment records (features) from the table.
                QueryParameters queryToGetNonNullComments = new QueryParameters
                {
                    WhereClause = "requestid <> '' AND comments <> ''"
                };

                // Query the comments table to get the non-null records.
                FeatureQueryResult commentQueryResult = await commentsTable.QueryFeaturesAsync(queryToGetNonNullComments, QueryFeatureFields.LoadAll);

                // Store the comments in a list.
                _commentFeatures = commentQueryResult.ToList();

                // Show the comment text from the service request comments records in the list view control.
                var          comments        = _commentFeatures.Select(c => c.Attributes["comments"]);
                ArrayAdapter commentsAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, comments.ToArray());
                _commentsListBox.Adapter = commentsAdapter;

                // Create a graphics overlay to show selected features and add it to the map view.
                _selectedFeaturesOverlay = new GraphicsOverlay();
                _myMapView.GraphicsOverlays.Add(_selectedFeaturesOverlay);

                // Assign the map to the MapView.
                _myMapView.Map = myMap;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
            }
        }
        private async Task QueryStateFeature(string stateName)
        {
            try
            {
                // Hide keyboard.
                _queryTextView.ResignFirstResponder();

                // Create a query parameters that will be used to Query the feature table.
                QueryParameters queryParams = new QueryParameters();

                // Trim whitespace on the state name to prevent broken queries.
                string formattedStateName = stateName.Trim().ToUpper();

                // Construct and assign the where clause that will be used to query the feature table.
                queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + formattedStateName + "%'";

                // Query the feature table.
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                List <Feature> features = queryResult.ToList();

                if (features.Any())
                {
                    // Create an envelope.
                    EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);

                    // Loop over each feature from the query result.
                    foreach (Feature feature in features)
                    {
                        // Add the extent of each matching feature to the envelope.
                        envBuilder.UnionOf(feature.Geometry.Extent);

                        // Select each feature.
                        _featureLayer.SelectFeature(feature);
                    }

                    // Zoom to the extent of the selected feature(s).
                    await _myMapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
                else
                {
                    UIAlertView alert = new UIAlertView("State Not Found!", "Add a valid state name.", (IUIAlertViewDelegate)null, "OK", null);
                    alert.Show();
                }
            }
            catch (Exception ex)
            {
                UIAlertView alert = new UIAlertView("Sample error", ex.ToString(), (IUIAlertViewDelegate)null, "OK", null);
                alert.Show();
            }
        }
        private async Task QueryStateFeature(string stateName)
        {
            // Create dialog to display alert information
            AlertDialog.Builder alert = new AlertDialog.Builder(this);

            try
            {
                // Create a query parameters that will be used to Query the feature table
                QueryParameters queryParams = new QueryParameters
                {
                    // Construct and assign the where clause that will be used to query the feature table
                    WhereClause = "upper(STATE_NAME) LIKE '%" + stateName.Trim().ToUpper() + "%'"
                };

                // Query the feature table
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                List <Feature> features = queryResult.ToList();

                if (features.Any())
                {
                    // Create an envelope.
                    EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);

                    // Loop over each feature from the query result.
                    foreach (Feature feature in features)
                    {
                        // Add the extent of each matching feature to the envelope.
                        envBuilder.UnionOf(feature.Geometry.Extent);

                        // Select each feature.
                        _featureLayer.SelectFeature(feature);
                    }

                    // Zoom to the extent of the selected feature(s).
                    await _myMapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
                else
                {
                    alert.SetTitle("State Not Found!");
                    alert.SetMessage("Add a valid state name.");
                    alert.Show();
                }
            }
            catch (Exception ex)
            {
                alert.SetTitle("Sample Error");
                alert.SetMessage(ex.Message);
                alert.Show();
            }
        }
        private async void Initialize()
        {
            // Create a new Map with a vector streets basemap.
            Map myMap = new Map(BasemapStyle.ArcGISStreets);

            // Create the URI to the Service Requests map service.
            Uri serviceRequestUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/MapServer");

            // Create a new ArcGISMapImageLayer that uses the service URI.
            ArcGISMapImageLayer serviceRequestsMapImageLayer = new ArcGISMapImageLayer(serviceRequestUri);

            try
            {
                // Load all sublayers and tables contained by the map image layer.
                await serviceRequestsMapImageLayer.LoadTablesAndLayersAsync();

                // Set the initial map extent to the extent of all service request features.
                Envelope requestsExtent = serviceRequestsMapImageLayer.FullExtent;
                myMap.InitialViewpoint = new Viewpoint(requestsExtent);

                // Add the layer to the map.
                myMap.OperationalLayers.Add(serviceRequestsMapImageLayer);

                // Get the service request comments table from the map image layer.
                ServiceFeatureTable commentsTable = serviceRequestsMapImageLayer.Tables[0];

                // Create query parameters to get all non-null service request comment records (features) from the table.
                QueryParameters queryToGetNonNullComments = new QueryParameters
                {
                    WhereClause = "requestid <> '' AND comments <> ''"
                };

                // Query the comments table to get the non-null records.
                FeatureQueryResult commentQueryResult = await commentsTable.QueryFeaturesAsync(queryToGetNonNullComments, QueryFeatureFields.LoadAll);

                // Show the records from the service request comments table in the list view control.
                CommentsListBox.ItemsSource = commentQueryResult.ToList();

                // Create a graphics overlay to show selected features and add it to the map view.
                _selectedFeaturesOverlay = new GraphicsOverlay();
                MyMapView.GraphicsOverlays.Add(_selectedFeaturesOverlay);

                // Assign the map to the MapView.
                MyMapView.Map = myMap;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error");
            }
        }
Beispiel #11
0
        private async Task QueryStateFeature(string stateName)
        {
            try
            {
                // Create a query parameters that will be used to Query the feature table
                QueryParameters queryParams = new QueryParameters();

                // Trim whitespace on the state name to prevent broken queries
                string formattedStateName = stateName.Trim().ToUpper();

                // Construct and assign the where clause that will be used to query the feature table
                queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + formattedStateName + "%'";

                // Query the feature table
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated
                List <Feature> features = queryResult.ToList();

                if (features.Any())
                {
                    // Create an envelope.
                    EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);

                    foreach (Feature feature in features)
                    {
                        // Add the extent of each matching feature to the envelope.
                        envBuilder.UnionOf(feature.Geometry.Extent);

                        // Select each feature.
                        _featureLayer.SelectFeature(feature);
                    }

                    // Zoom to the extent of the selected feature(s).
                    await MyMapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
                else
                {
                    MessageDialog message = new MessageDialog("State Not Found!", "Add a valid state name.");
                    await message.ShowAsync();
                }
            }
            catch (Exception ex)
            {
                MessageDialog message = new MessageDialog("Sample error: " + ex, "An error occurred");
                await message.ShowAsync();
            }
        }
Beispiel #12
0
        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);
            }
        }
Beispiel #13
0
        private async Task QueryStateFeature(string stateName)
        {
            try
            {
                // Hide keyboard
                _queryTextView.ResignFirstResponder();

                // Create a query parameters that will be used to Query the feature table
                QueryParameters queryParams = new QueryParameters();

                // Trim whitespace on the state name to prevent broken queries
                String formattedStateName = stateName.Trim().ToUpper();

                // Construct and assign the where clause that will be used to query the feature table
                queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + formattedStateName + "%'";

                // Query the feature table
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated
                var features = queryResult.ToList();

                if (features.Any())
                {
                    // Get the first feature returned in the Query result
                    Feature feature = features[0];

                    // Add the returned feature to the collection of currently selected features
                    _featureLayer.SelectFeature(feature);

                    // Zoom to the extent of the newly selected feature
                    await _myMapView.SetViewpointGeometryAsync(feature.Geometry.Extent);
                }
                else
                {
                    var alert = new UIAlertView("State Not Found!", "Add a valid state name.", null, "OK", null);
                    alert.Show();
                }
            }
            catch (Exception ex)
            {
                var alert = new UIAlertView("Sample error", ex.ToString(), null, "OK", null);
                alert.Show();
            }
        }
        private async void AsyncInitProcesses()
        {
            await _redlandsBoundary.LoadAsync();

            await _mapView.SetViewpointAsync(new Viewpoint(_redlandsBoundary.FullExtent.Extent));

            // await _water.LoadAsync();

            await _parks.LoadAsync();

            // Holds locations of hospitals around San Diego.

            _parkPolygons = new List <Polygon>();
            // Create query parameters to select all features.
            QueryParameters queryParams = new QueryParameters()
            {
                WhereClause = "1=1"
            };

            FeatureQueryResult redlandsResult = await _redlandsBoundary.FeatureTable.QueryFeaturesAsync(queryParams);

            List <Polygon> redlandsBound = redlandsResult.ToList().Select(feature => (Polygon)feature.Geometry).ToList();
            //GeometryEngine.Union()
            await _mapView.SetViewpointAsync(new Viewpoint(GeometryEngine.Union(redlandsBound).Extent));

            // Query all features in the facility table.
            FeatureQueryResult facilityResult = await _parks.FeatureTable.QueryFeaturesAsync(queryParams);

            // Add all of the query results to facilities as new Facility objects.
            _parkPolygons.AddRange(facilityResult.ToList().Select(feature => (Polygon)feature.Geometry));

            //await _mapView.SetViewpointAsync(new Viewpoint(_parkPolygons[0].Extent));

            FeatureQueryResult buildingsResult = await _buildings.FeatureTable.QueryFeaturesAsync(queryParams);

            _buildingGeometry = buildingsResult.ToList().Select(feature => (Polygon)feature.Geometry).ToList();

            /*
             * foreach(Polygon building in _buildingGeometry)
             * {
             *  Graphic bgraphic = new Graphic(building, new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, Color.Blue, new SimpleLineSymbol(SimpleLineSymbolStyle.Dash, Color.Gray, 3.0)));
             *  _barrierOverlay.Graphics.Add(bgraphic);
             * }
             */
        }
Beispiel #15
0
        private async Task ShowTurtleData()
        {
            myMap.OperationalLayers.Add(_featureLayer);
            GreenSeaTurtleCheckbox.IsChecked     = true;
            LeatherbackCheckbox.IsChecked        = true;
            OliveRidleyCheckbox.IsChecked        = true;
            LoggerheadCheckbox.IsChecked         = true;
            UnidentifiedTurtleCheckBox.IsChecked = true;

            try
            {
                // Create a query parameters that will be used to Query the feature table.
                QueryParameters queryParams = new QueryParameters();

                // Construct and assign the where clause that will be used to query the feature table.
                queryParams.WhereClause = "1=1";

                // Query the feature table.
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                List <Feature> features = queryResult.ToList();

                if (features.Any())
                {
                    // Loop over each feature from the query result.
                    foreach (Feature feature in features)
                    {
                        var attributevalue     = feature.GetAttributeValue("Species").ToString();
                        var attributeDatevalue = feature.GetAttributeValue("Date").ToString();
                        // Select each feature.
                        _featureLayer.SetFeatureVisible(feature, true);
                    }
                }
                else
                {
                    MessageBox.Show("No Features to Select");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred.\n" + ex, "Sample error");
            }
        }
        private async Task QueryStateFeature(string stateName)
        {
            // Create dialog to display alert information
            var alert = new AlertDialog.Builder(this);

            try
            {
                // Create a query parameters that will be used to Query the feature table
                QueryParameters queryParams = new QueryParameters();

                // Construct and assign the where clause that will be used to query the feature table
                queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + (stateName.Trim().ToUpper()) + "%'";

                // Query the feature table
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated
                var features = queryResult.ToList();

                if (features.Any())
                {
                    // Get the first feature returned in the Query result
                    Feature feature = features[0];

                    // Add the returned feature to the collection of currently selected features
                    _featureLayer.SelectFeature(feature);

                    // Zoom to the extent of the newly selected feature
                    await _myMapView.SetViewpointGeometryAsync(feature.Geometry.Extent);
                }
                else
                {
                    alert.SetTitle("State Not Found!");
                    alert.SetMessage("Add a valid state name.");
                    alert.Show();
                }
            }
            catch (Exception ex)
            {
                alert.SetTitle("Sample Error");
                alert.SetMessage(ex.Message);
                alert.Show();
            }
        }
        private async Task QueryStateFeature(string stateName)
        {
            try
            {
                // Create a query parameters that will be used to Query the feature table
                QueryParameters queryParams = new QueryParameters();

                // Construct and assign the where clause that will be used to query the feature table
                queryParams.WhereClause = "upper(STATE_NAME) LIKE '%" + (stateName.ToUpper()) + "%'";

                // Query the feature table
                FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated
                var features = queryResult.ToList();

                if (features.Any())
                {
                    // Get the first feature returned in the Query result
                    Feature feature = features[0];

                    // Add the returned feature to the collection of currently selected features
                    _featureLayer.SelectFeature(feature);

                    // Zoom to the extent of the newly selected feature
                    await myMapView.SetViewpointGeometryAsync(feature.Geometry.Extent);
                }
                else
                {
                    var message = new MessageDialog("State Not Found!", "Add a valid state name.");
                    await message.ShowAsync();
                }
            }
            catch (Exception ex)
            {
                var message = new MessageDialog("Sample error: " + ex.ToString(), "An error occurred");
                await message.ShowAsync();
            }
        }
Beispiel #18
0
        private async Task ShowWindData()
        {
            myMap.OperationalLayers.Add(_windFeatureLayer);
            try
            {
                // Create a query parameters that will be used to Query the feature table.
                QueryParameters queryParams = new QueryParameters();

                // Construct and assign the where clause that will be used to query the feature table.
                queryParams.WhereClause = "1=1";

                // Query the feature table.
                FeatureQueryResult queryResult = await _windFeatureTable.QueryFeaturesAsync(queryParams);

                // Cast the QueryResult to a List so the results can be interrogated.
                List <Feature> features = queryResult.ToList();

                if (features.Any())
                {
                    // Loop over each feature from the query result.
                    foreach (Feature feature in features)
                    {
                        // Select each feature.
                        _windFeatureLayer.SetFeatureVisible(feature, true);
                        _windFeatureLayer.MinScale = 100000000;
                    }
                }
                else
                {
                    MessageBox.Show("No Features to Select");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred.\n" + ex, "Sample error");
            }
        }
        private async void OnMapViewTapped(object sender, GeoViewInputEventArgs evt)
        {
            try
            {
                // グラフィック オーバレイに追加したグラフィックを削除
                myGraphicsOverlay.Graphics.Clear();

                // シンボルの作成
                var incidentPointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Colors.Red, 8);
                var outLineSymbol       = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.FromArgb(100, 255, 183, 51), 2);
                var bufferPolygonSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, Color.FromArgb(75, 255, 183, 51), outLineSymbol);

                // クリック地点をマップに表示
                var point    = evt.Location;
                var location = new Graphic(point, incidentPointSymbol);

                myGraphicsOverlay.Graphics.Add(location);

                // クリック地点を解析のパラメーターに設定
                var incidentOneLocation = new MapPoint(evt.Location.X, evt.Location.Y, MyMapView.SpatialReference);
                var incidentOne         = new Incident(incidentOneLocation);

                var incidentList = new List <Incident>();
                incidentList.Add(incidentOne);

                closestFacilityParameters.SetIncidents(incidentList);

                // タップした地点から1000メートルのバッファーの円を作成し、グラフィックとして表示する
                var buffer  = GeometryEngine.Buffer(evt.Location, 1000);
                var graphic = new Graphic(buffer, null, bufferPolygonSymbol);

                myGraphicsOverlay.Graphics.Add(graphic);

                // フィーチャの検索用のパラメーターを作成
                var queryParams = new QueryParameters();
                // 検索範囲を作成したバファーの円に指定
                queryParams.Geometry = buffer;

                // 検索範囲とフィーチャの空間的な関係性を指定(バファーの円の中にフィーチャが含まれる)
                queryParams.SpatialRelationship = SpatialRelationship.Contains;
                // フィーチャの検索を実行
                FeatureQueryResult queryResult = await shelterLayer.FeatureTable.QueryFeaturesAsync(queryParams);

                // 検索結果のフィーチャのリストを取得
                var queryList  = queryResult.ToList();
                var facilities = new List <Facility>();

                for (int i = 0; i < queryList.Count; ++i)
                {
                    facilities.Add(new Facility((MapPoint)queryList[i].Geometry));
                }

                // パラメーターを設定し、最寄り施設検出解析を実行
                closestFacilityParameters.SetFacilities(facilities);
                closestFacility();
            }
            catch (Exception ex)
            {
                MessageBox.Show("解析の実行エラー " + ex.Message);
            }
        }
Beispiel #20
0
        // 레이에서 해당 Feature 찾기
        private async Task QueryStateFeature(string _FTR_CDE, string _FTR_IDN, FeatureLayer _featureLayer)
        {
            try
            {
                // 0.Feature 테이블 가져오기
                //FeatureLayer __featureLayer = _featureLayer.Clone() as FeatureLayer;
                FeatureTable _featureTable = _featureLayer.FeatureTable;



                // Create a query parameters that will be used to Query the feature table.
                QueryParameters queryParams = new QueryParameters();


                // Construct and assign the where clause that will be used to query the feature table.
                queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' ";
                if (!FmsUtil.IsNull(_FTR_IDN))
                {
                    queryParams.WhereClause += " AND FTR_IDN = " + _FTR_IDN;
                }


                List <Feature> features;
                try
                {
                    // Query the feature table.
                    FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams);

                    // Cast the QueryResult to a List so the results can be interrogated.
                    features = queryResult.ToList();
                }
                catch (Exception)
                {
                    Messages.ShowErrMsgBox("보호된 메모리 접근 에러..");
                    return;
                }

                if (features.Any())
                {
                    // Create an envelope.
                    EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);



                    // Loop over each feature from the query result.
                    foreach (Feature feature in features)
                    {
                        // Add the extent of each matching feature to the envelope.
                        //envBuilder.UnionOf(feature.Geometry.Extent); //복수의 피처영역 합치기

                        // Select each feature.
                        _featureLayer.SelectFeature(feature);
                        //해당피처로 이동
                        await mapView.SetViewpointCenterAsync(feature.Geometry.Extent.GetCenter(), 40000);
                    }

                    // Zoom to the extent of the selected feature(s).
                    //await mapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50);
                }
                else
                {
                    MessageBox.Show("해당 시설물 위치를 찾을 수 없습니다.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred.\n" + ex, "Sample error");
            }
        }