/// <summary> /// Requests for features whose attributes will be displayed in <see cref="UI.FeatureDataField"/> /// </summary> /// <returns>A task that represents the asynchronous loading of features. </returns> private async Task LoadFeaturesAsync() { string error = null; try { var table = new ServiceFeatureTable(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessmentStatePlane/FeatureServer/0")); table.FeatureRequestMode = FeatureRequestMode.ManualCache; await table.LoadAsync(); var queryParameters = new QueryParameters() { WhereClause = "incidentid <> ''", MaxFeatures = 100 }; // Request for the same fields defined in the ListView.ItemTemplate. var outFields = new string[] { "objectid", "incidentid", "typdamage", "habitable", "predisval", "inspdate", "lastupdate" }; var features = await table.PopulateFromServiceAsync(queryParameters, true, outFields); grid.ItemsSource = features.ToList(); } catch (Exception exception) { error = exception.Message; } if (!string.IsNullOrEmpty(error)) { await new MessageDialog($"Error occured : {error}", "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 string[] outputFields = { "*" }; try { // Populate feature table with the data based on query await _incidentsFeatureTable.PopulateFromServiceAsync(queryParameters, true, outputFields); } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Error", ex.ToString(), "OK"); } }
private async void OnLoadedPopulateData(object sender, LoadStatusEventArgs e) { // If layer isn't loaded, do nothing if (e.Status != LoadStatus.Loaded) { return; } // Create new query object that contains a basic 'include everything' clause QueryParameters queryParameters = new QueryParameters() { WhereClause = "1=1" }; // Create a new time extent that covers the desired interval (beginning of time to September 16th, 2000) TimeExtent myExtent = new TimeExtent(new DateTime(1, 1, 1), new DateTime(2000, 9, 16)); // Apply the time extent to the query parameters queryParameters.TimeExtent = myExtent; // Create list of the fields that are returned from the service string[] outputFields = { "*" }; try { // Populate feature table with the data based on query await _myFeatureTable.PopulateFromServiceAsync(queryParameters, true, outputFields); } catch (Exception ex) { await((Page)Parent).DisplayAlert("Error", ex.ToString(), "OK"); } }
private async void OnLoadedPopulateData(object sender, EventArgs e) { // Unsubscribe from events. _myFeatureTable.Loaded -= OnLoadedPopulateData; // Create new query object that contains a basic 'include everything' clause. QueryParameters queryParameters = new QueryParameters { WhereClause = "1=1", // Restrict query with a time extent that covers the desired interval (beginning of time to September 16th, 2000). TimeExtent = new TimeExtent(new DateTime(1, 1, 1), new DateTime(2000, 9, 16)) }; // Create list of the fields that are returned from the service. string[] outputFields = { "*" }; try { // Populate feature table with the data based on query. await _myFeatureTable.PopulateFromServiceAsync(queryParameters, true, outputFields); } catch (Exception ex) { new UIAlertView("Error", ex.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }
private async Task QueryAllCountryFeaturesAsync() { // Query all the country features var parameters = new QueryParameters(); parameters.WhereClause = @"1=1"; parameters.ReturnGeometry = true; //var queryResult = await _countryTable.QueryFeaturesAsync(parameters, QueryFeatureFields.LoadAll); var outFields = new[] { @"*" }; var queryResult = await _countryTable.PopulateFromServiceAsync(parameters, true, outFields); foreach (var countryFeature in queryResult) { var countryAttributes = new Dictionary <string, object>(countryFeature.Attributes); countryAttributes.Add(@"HitCount", 0L); var countryGraphic = new Graphic(countryFeature.Geometry, countryAttributes); countryGraphic.IsVisible = false; _countryOverlay.Graphics.Add(countryGraphic); const string countryFieldName = @"COUNTRY"; if (countryAttributes.ContainsKey(@"FID") && countryAttributes.ContainsKey(countryFieldName)) { var fid = countryAttributes[@"FID"].ToString(); var countryName = countryAttributes[countryFieldName].ToString(); _countries.Add(fid, new CountryEntry { Name = countryName, HitCount = 0L }); } } }
private async void Initialize() { // Web マップの URL を指定してマップを作成 var webMap = await Map.LoadFromUriAsync(new Uri("https://arcgis.com/home/item.html?id=9a6a1c9f857a4a68a6e405bb5917e620")); // マップビューのマップに設定 MyMapView.Map = webMap; //住所検索用のジオコーディング タスクを初期化 onlineLocatorTask = await LocatorTask.CreateAsync(new Uri(WORLD_GEOCODE_SERVICE_URL)); // グラフィックス オーバーレイの新規追加 geocodeResultGraphicsOverlay = new GraphicsOverlay() { Renderer = createGeocoordingSymbol(), }; MyMapView.GraphicsOverlays.Add(geocodeResultGraphicsOverlay); isMapReady = true; // マップがロードされた際の処理 if (MyMapView.Map.LoadStatus == LoadStatus.Loaded) { // マップビューのタップ イベントを登録 MyMapView.GeoViewTapped += OnMapViewTapped; // Web マップに含まれる最上位のレイヤーを取得 myFeatureLayer = (FeatureLayer)MyMapView.Map.OperationalLayers[1]; // フィーチャ レイヤからフィーチャ テーブルを定義 myFeatureTable = (ServiceFeatureTable)myFeatureLayer.FeatureTable; // リクエスト モードの設定 myFeatureTable.FeatureRequestMode = FeatureRequestMode.ManualCache; // フィーチャの検索用のパラメーターを作成 var queryParams = new QueryParameters(); // すべてのフィーチャを取得するように条件を設定 queryParams.WhereClause = "1=1"; // 検索結果にフィーチャのすべての属性情報(outFields の配列に "*" を指定)を含める var outputFields = new string[] { "*" }; // クエリの条件に基づいてフィーチャ テーブルにデータを設定する await myFeatureTable.PopulateFromServiceAsync(queryParams, true, outputFields); // マップビューにグラフィック表示用のオーバレイを追加 MyMapView.GraphicsOverlays.Add(myGraphicsOverlay); } }
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 OnLoadedPopulateData(object sender, LoadStatusEventArgs e) { // If layer isn't loaded, do nothing. if (e.Status != LoadStatus.Loaded) { return; } // Create new query object that contains a basic 'include everything' clause. QueryParameters queryParameters = new QueryParameters { WhereClause = "1=1", // Restrict query with a time extent that covers the desired interval (beginning of time to September 16th, 2000). TimeExtent = new TimeExtent(new DateTime(1, 1, 1), new DateTime(2000, 9, 16)) }; // Create list of the fields that are returned from the service. string[] outputFields = { "*" }; // Populate feature table with the data based on query. await _myFeatureTable.PopulateFromServiceAsync(queryParameters, true, outputFields); }
private async void OnLoadedPopulateData(object sender, EventArgs e) { // Unsubscribe from event. _incidentsFeatureTable.Loaded -= OnLoadedPopulateData; // 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. string[] outputFields = { "*" }; try { // Populate feature table with the data based on query. await _incidentsFeatureTable.PopulateFromServiceAsync(queryParameters, true, outputFields); } catch (Exception ex) { new UIAlertView("Error", ex.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }