private async void Initialize() { // NOTE: to be a writable geodatabase, this geodatabase must be generated from a service with a GeodatabaseSyncTask. See the "Generate geodatabase" sample. try { // Create and load geodatabase. string geodatabasePath = DataManager.GetDataFolder("74c0c9fa80f4498c9739cc42531e9948", "loudoun_anno.geodatabase"); Geodatabase geodatabase = await Geodatabase.OpenAsync(geodatabasePath); // Create feature layers from tables in the geodatabase. FeatureLayer addressFeatureLayer = new FeatureLayer(geodatabase.GeodatabaseFeatureTable("Loudoun_Address_Points_1")); FeatureLayer parcelFeatureLayer = new FeatureLayer(geodatabase.GeodatabaseFeatureTable("ParcelLines_1")); // Create annotation layers from tables in the geodatabase. AnnotationLayer addressAnnotationLayer = new AnnotationLayer(geodatabase.GeodatabaseAnnotationTable("Loudoun_Address_PointsAnno_1")); AnnotationLayer parcelAnnotationLayer = new AnnotationLayer(geodatabase.GeodatabaseAnnotationTable("ParcelLinesAnno_1")); // Create a map with the layers. _myMapView.Map = new Map(BasemapStyle.ArcGISLightGray); _myMapView.Map.OperationalLayers.AddRange(new List <Layer> { addressFeatureLayer, parcelFeatureLayer, addressAnnotationLayer, parcelAnnotationLayer }); // Zoom to the extent of the parcels. await parcelFeatureLayer.LoadAsync(); _myMapView.SetViewpoint(new Viewpoint(parcelFeatureLayer.FullExtent)); } catch (Exception ex) { new UIAlertView(ex.GetType().Name, ex.Message, (IUIAlertViewDelegate)null, "Ok", null).Show(); } }
private async void Initialize() { // Create a new map to display in the map view with a streets basemap. MyMapView.Map = new Map(BasemapStyle.ArcGISStreets); // Get the path to the downloaded mobile geodatabase (.geodatabase file). string mobileGeodatabaseFilePath = GetMobileGeodatabasePath(); try { // Open the mobile geodatabase. Geodatabase mobileGeodatabase = await Geodatabase.OpenAsync(mobileGeodatabaseFilePath); // Get the 'Trailheads' geodatabase feature table from the mobile geodatabase. GeodatabaseFeatureTable trailheadsGeodatabaseFeatureTable = mobileGeodatabase.GeodatabaseFeatureTable("Trailheads"); // Asynchronously load the 'Trailheads' geodatabase feature table. await trailheadsGeodatabaseFeatureTable.LoadAsync(); // Create a feature layer based on the geodatabase feature table. FeatureLayer trailheadsFeatureLayer = new FeatureLayer(trailheadsGeodatabaseFeatureTable); // Add the feature layer to the operations layers collection of the map. MyMapView.Map.OperationalLayers.Add(trailheadsFeatureLayer); // Zoom the map to the extent of the feature layer. await MyMapView.SetViewpointGeometryAsync(trailheadsFeatureLayer.FullExtent, 50); } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }
private async void Initialize() { // Create a new map to display in the map view with a streets basemap. _myMapView.Map = new Map(Basemap.CreateStreets()); // Get the path to the downloaded mobile geodatabase (.geodatabase file). string mobileGeodatabaseFilePath = DataManager.GetDataFolder("2b0f9e17105847809dfeb04e3cad69e0", "LA_Trails.geodatabase"); try { // Open the mobile geodatabase. Geodatabase mobileGeodatabase = await Geodatabase.OpenAsync(mobileGeodatabaseFilePath); // Get the 'Trailheads' geodatabase feature table from the mobile geodatabase. GeodatabaseFeatureTable trailheadsGeodatabaseFeatureTable = mobileGeodatabase.GeodatabaseFeatureTable("Trailheads"); // Asynchronously load the 'Trailheads' geodatabase feature table. await trailheadsGeodatabaseFeatureTable.LoadAsync(); // Create a feature layer based on the geodatabase feature table. FeatureLayer trailheadsFeatureLayer = new FeatureLayer(trailheadsGeodatabaseFeatureTable); // Add the feature layer to the operations layers collection of the map. _myMapView.Map.OperationalLayers.Add(trailheadsFeatureLayer); // Zoom the map to the extent of the feature layer. await _myMapView.SetViewpointGeometryAsync(trailheadsFeatureLayer.FullExtent, 50); } catch (Exception e) { new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }
private async void Initialize() { // Create a new map to display in the map view with a streets basemap. _myMapView.Map = new Map(Basemap.CreateStreets()); // Get the path to the downloaded mobile geodatabase (.geodatabase file). string mobileGeodatabaseFilePath = GetMobileGeodatabasePath(); try { // Open the mobile geodatabase. Geodatabase mobileGeodatabase = await Geodatabase.OpenAsync(mobileGeodatabaseFilePath); // Get the 'Trailheads' geodatabase feature table from the mobile geodatabase. GeodatabaseFeatureTable trailheadsGeodatabaseFeatureTable = mobileGeodatabase.GeodatabaseFeatureTable("Trailheads"); // Asynchronously load the 'Trailheads' geodatabase feature table. await trailheadsGeodatabaseFeatureTable.LoadAsync(); // Create a feature layer based on the geodatabase feature table. FeatureLayer trailheadsFeatureLayer = new FeatureLayer(trailheadsGeodatabaseFeatureTable); // Add the feature layer to the operations layers collection of the map. _myMapView.Map.OperationalLayers.Add(trailheadsFeatureLayer); // Zoom the map to the extent of the feature layer. await _myMapView.SetViewpointGeometryAsync(trailheadsFeatureLayer.FullExtent, 50); } catch (Exception e) { new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show(); } }
private async void Initialize() { // Create a new map to display in the map view with a streets basemap. MyMapView.Map = new Map(Basemap.CreateStreets()); // Get the path to the downloaded mobile geodatabase (.geodatabase file). string mobileGeodatabaseFilePath = GetMobileGeodatabasePath(); // Open the mobile geodatabase. Geodatabase mobileGeodatabase = await Geodatabase.OpenAsync(mobileGeodatabaseFilePath); // Get the 'Trailheads' geodatabase feature table from the mobile geodatabase. GeodatabaseFeatureTable trailheadsGeodatabaseFeatureTable = mobileGeodatabase.GeodatabaseFeatureTable("Trailheads"); // Asynchronously load the 'Trailheads' geodatabase feature table. await trailheadsGeodatabaseFeatureTable.LoadAsync(); // Create a feature layer based on the geodatabase feature table. FeatureLayer trailheadsFeatureLayer = new FeatureLayer(trailheadsGeodatabaseFeatureTable); // Add the feature layer to the operations layers collection of the map. MyMapView.Map.OperationalLayers.Add(trailheadsFeatureLayer); // Zoom the map to the extent of the feature layer. await MyMapView.SetViewpointGeometryAsync(trailheadsFeatureLayer.FullExtent); }