private void Initialize() { // Configure the basemap _myMapView.Map = new Map(Basemap.CreateTopographic()); // Create the graphics overlay and set the selection color _graphicsOverlay = new GraphicsOverlay(); // Add the overlay to the MapView _myMapView.GraphicsOverlays.Add(_graphicsOverlay); // Create the point collection that defines the polygon PointCollection polygonPoints = new PointCollection(SpatialReferences.WebMercator) { new MapPoint(-5991501.677830, 5599295.131468), new MapPoint(-6928550.398185, 2087936.739807), new MapPoint(-3149463.800709, 1840803.011362), new MapPoint(-1563689.043184, 3714900.452072), new MapPoint(-3180355.516764, 5619889.608838) }; // Create the polygon Polygon polygonGeometry = new Polygon(polygonPoints); // Define and apply the symbology SimpleLineSymbol polygonOutlineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Green, 2); SimpleFillSymbol polygonFillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.ForwardDiagonal, Color.Green, polygonOutlineSymbol); // Create the graphic and add it to the graphics overlay _polygonGraphic = new Graphic(polygonGeometry, polygonFillSymbol); _graphicsOverlay.Graphics.Add(_polygonGraphic); // Create the graphics and symbology for the tapped point, the nearest vertex, and the nearest coordinate SimpleMarkerSymbol tappedLocationSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.X, Color.Orange, 15); SimpleMarkerSymbol nearestCoordinateSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Diamond, Color.Red, 10); SimpleMarkerSymbol nearestVertexSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Blue, 15); _nearestCoordinateGraphic = new Graphic { Symbol = nearestCoordinateSymbol }; _tappedLocationGraphic = new Graphic { Symbol = tappedLocationSymbol }; _nearestVertexGraphic = new Graphic { Symbol = nearestVertexSymbol }; _graphicsOverlay.Graphics.Add(_tappedLocationGraphic); _graphicsOverlay.Graphics.Add(_nearestVertexGraphic); _graphicsOverlay.Graphics.Add(_nearestCoordinateGraphic); // Listen for taps; the spatial relationships will be updated in the handler _myMapView.GeoViewTapped += MapViewTapped; // Center the map on the polygon _myMapView.SetViewpointCenterAsync(polygonGeometry.Extent.GetCenter(), 200000000); }
private void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateTopographic()); // Create uri to the used feature service var serviceUri = new Uri( "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"); // Create service feature table ServiceFeatureTable statesFeatureTable = new ServiceFeatureTable(serviceUri); // Create a new feature layer using the service feature table FeatureLayer statesLayer = new FeatureLayer(statesFeatureTable); // Create a new unique value renderer UniqueValueRenderer regionRenderer = new UniqueValueRenderer(); // Add the "SUB_REGION" field to the renderer regionRenderer.FieldNames.Add("SUB_REGION"); // Define a line symbol to use for the region fill symbols SimpleLineSymbol stateOutlineSymbol = new SimpleLineSymbol( SimpleLineSymbolStyle.Solid, System.Drawing.Color.White, 0.7); // Define distinct fill symbols for a few regions (use the same outline symbol) SimpleFillSymbol pacificFillSymbol = new SimpleFillSymbol( SimpleFillSymbolStyle.Solid, System.Drawing.Color.Blue, stateOutlineSymbol); SimpleFillSymbol mountainFillSymbol = new SimpleFillSymbol( SimpleFillSymbolStyle.Solid, System.Drawing.Color.LawnGreen, stateOutlineSymbol); SimpleFillSymbol westSouthCentralFillSymbol = new SimpleFillSymbol( SimpleFillSymbolStyle.Solid, System.Drawing.Color.SandyBrown, stateOutlineSymbol); // Add values to the renderer: define the label, description, symbol, and attribute value for each regionRenderer.UniqueValues.Add( new UniqueValue("Pacific", "Pacific Region", pacificFillSymbol, "Pacific")); regionRenderer.UniqueValues.Add( new UniqueValue("Mountain", "Rocky Mountain Region", mountainFillSymbol, "Mountain")); regionRenderer.UniqueValues.Add( new UniqueValue("West South Central", "West South Central Region", westSouthCentralFillSymbol, "West South Central")); // Set the default region fill symbol (transparent with no outline) for regions not explicitly defined in the renderer SimpleFillSymbol defaultFillSymbol = new SimpleFillSymbol( SimpleFillSymbolStyle.Null, System.Drawing.Color.Transparent, null); regionRenderer.DefaultSymbol = defaultFillSymbol; regionRenderer.DefaultLabel = "Other"; // Apply the unique value renderer to the states layer statesLayer.Renderer = regionRenderer; // Add created layer to the map myMap.OperationalLayers.Add(statesLayer); // Assign the map to the MapView _myMapView.Map = myMap; }
private void Window_Loaded(object sender, RoutedEventArgs e) { // 绘制层 myMapView.GraphicsOverlays.Add(graphicsOverlay); // 鹰眼的底图 myMapView_Eagle.Map = new Map(Basemap.CreateTopographic()); // 主地图的底图(因为一次地图错误——重复载入底图导致进程中断 才添加的) myMapView.Map = new Map(Basemap.CreateTopographic()); // 底图的列表 ChangeBaseMap_list.ItemsSource = new List <ListBoxItem>() { new ListBoxItem() { Content = "DarkGrayCanvasVector" }, new ListBoxItem() { Content = "Imagery" }, new ListBoxItem() { Content = "ImageryWithLabels" }, new ListBoxItem() { Content = "TerrainWithLabels" }, new ListBoxItem() { Content = "LightGrayCanvas" }, new ListBoxItem() { Content = "Topographic" }, new ListBoxItem() { Content = "NationalGeographic" }, new ListBoxItem() { Content = "NavigationVector" }, new ListBoxItem() { Content = "Oceans" }, new ListBoxItem() { Content = "Streets" }, }; // 初始化底图2 myMapView2.Map = new Map(Basemap.CreateLightGrayCanvas()); }
private async void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateTopographic()); // Provide Map to the MapView _myMapView.Map = myMap; // Get the path to the geodatabase string geodbFilePath = GetGeodatabasePath(); // Load the geodatabase from local storage Geodatabase baseGeodatabase = await Geodatabase.OpenAsync(geodbFilePath); // Get the path to the symbol dictionary string symbolFilepath = GetStyleDictionaryPath(); try { // Load the symbol dictionary from local storage // Note that the type of the symbol definition must be explicitly provided along with the file name DictionarySymbolStyle symbolStyle = await DictionarySymbolStyle.OpenAsync("mil2525d", symbolFilepath); // Add geodatabase features to the map, using the defined symbology foreach (FeatureTable table in baseGeodatabase.GeodatabaseFeatureTables) { // Load the table await table.LoadAsync(); // Create the feature layer from the table FeatureLayer myLayer = new FeatureLayer(table); // Load the layer await myLayer.LoadAsync(); // Create a Dictionary Renderer using the DictionarySymbolStyle DictionaryRenderer dictRenderer = new DictionaryRenderer(symbolStyle); // Apply the dictionary renderer to the layer myLayer.Renderer = dictRenderer; // Add the layer to the map myMap.OperationalLayers.Add(myLayer); } // Create geometry for the center of the map MapPoint centerGeometry = new MapPoint(-13549402.587055, 4397264.96879385, SpatialReference.Create(3857)); // Set the map's viewpoint to highlight the desired content _myMapView.SetViewpoint(new Viewpoint(centerGeometry, 201555)); } catch (Exception e) { new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show(); } }
private async void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateTopographic()); // Provide Map to the MapView MyMapView.Map = myMap; // Get the path to the geodatabase string geodbFilePath = GetGeodatabasePath(); // Load the geodatabase from local storage Geodatabase baseGeodatabase = await Geodatabase.OpenAsync(geodbFilePath); // Get the path to the symbol dictionary string symbolFilepath = GetStyleDictionaryPath(); try { // Load the symbol dictionary from local storage DictionarySymbolStyle symbolStyle = await DictionarySymbolStyle.CreateFromFileAsync(symbolFilepath); // Add geodatabase features to the map, using the defined symbology foreach (FeatureTable table in baseGeodatabase.GeodatabaseFeatureTables) { // Load the table await table.LoadAsync(); // Create the feature layer from the table FeatureLayer myLayer = new FeatureLayer(table); // Load the layer await myLayer.LoadAsync(); // Create a Dictionary Renderer using the DictionarySymbolStyle DictionaryRenderer dictRenderer = new DictionaryRenderer(symbolStyle); // Apply the dictionary renderer to the layer myLayer.Renderer = dictRenderer; // Add the layer to the map myMap.OperationalLayers.Add(myLayer); } // Create geometry for the center of the map MapPoint centerGeometry = new MapPoint(-13549402.587055, 4397264.96879385, SpatialReference.Create(3857)); // Set the map's viewpoint to highlight the desired content MyMapView.SetViewpoint(new Viewpoint(centerGeometry, 201555)); } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }
private void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateTopographic()); // Assign the map to the MapView MyMapView.Map = myMap; // Set titles as a items source basemapChooser.ItemsSource = titles; }
public void ResetMap() { // Set the current map to null _map = null; // Create a new map with topographic basemap Map newMap = new Map(Basemap.CreateTopographic()); // Store the new map Map = newMap; }
private void Initialize() { // Create a map with 'Imagery with Labels' basemap and an initial location Map myMap = new Map(Basemap.CreateTopographic()); // Create new geoprocessing task _hotspotTask = new GeoprocessingTask(new Uri(HotspotsUrl)); // Assign the map to the MapView MyMapView.Map = myMap; }
private void Initialize() { // Create and show a map with a topographic basemap. _myMapView.Map = new Map(Basemap.CreateTopographic()); // Create an overlay to hold the lines of the hull. _graphicsOverlay = new GraphicsOverlay(); // Add the created graphics overlay to the MapView. _myMapView.GraphicsOverlays.Add(_graphicsOverlay); }
private async void Initialize() { // Set up the map with basemap. _myMapView.Map = new Map(Basemap.CreateTopographic()); // Load the rendering rules for the raster. await LoadRenderingRules(); // Apply the first rendering rule SelectRenderingRule(_renderRuleInfos[0]); }
private async void Initialize() { // Create a map with a topographic basemap Map myMap = new Map(Basemap.CreateTopographic()); // Create a new geoprocessing task _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); // Assign the map to the MapView MyMapView.Map = myMap; }
private void Initialize() { // Create and show a topographic basemap. _myMapView.Map = new Map(Basemap.CreateTopographic()); // Create graphics overlay with graphics. CreateOverlay(); // Respond to taps on the map. _myMapView.GeoViewTapped += OnMapViewTapped; }
private void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateTopographic()); // Assign the map to the MapView MyMapView.Map = myMap; // Set titles as a items source locationModes.ItemsSource = _navigationTypes; }
private void Initialize() { // Add event handler for when this sample is unloaded. Unloaded += SampleUnloaded; // Assign the map to the MapView. MyMapView.Map = new Map(Basemap.CreateTopographic()); // Populate the list of options and select a default. LocationModes.ItemsSource = _navigationTypes; LocationModes.SelectedIndex = 0; }
public async override void ViewDidLoad() { base.ViewDidLoad(); // Create a new MapView control and provide its location coordinates on the frame _myMapView = new MapView(); _myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height); // Create a new Map instance with the basemap Map myMap = new Map(SpatialReferences.WebMercator); myMap.Basemap = Basemap.CreateTopographic(); // Assign the Map to the MapView _myMapView.Map = myMap; // Create a segmented control to display buttons _myUISegmentedControl = new UISegmentedControl(); _myUISegmentedControl.Frame = new CoreGraphics.CGRect(8, 8, View.Bounds.Width - 16, 24); // Make the text for the buttons in the UISegmentedControl small to display the names of the rendering rules UIFont myUIFont = UIFont.FromName("Helvetica-Bold", 8f); _myUISegmentedControl.SetTitleTextAttributes(new UITextAttributes() { Font = myUIFont }, UIControlState.Normal); // Wire-up the UISegmentedControl's value change event handler _myUISegmentedControl.ValueChanged += _segmentControl_ValueChanged; // Create a UIBarButtonItem where its view is the SegmentControl UIBarButtonItem myUIBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); myUIBarButtonItem.CustomView = _myUISegmentedControl; // Create a toolbar on the bottom of the display _myUIToolbar = new UIToolbar(); _myUIToolbar.Frame = new CoreGraphics.CGRect(0, View.Bounds.Height - 40, View.Bounds.Width, 40); _myUIToolbar.AutosizesSubviews = true; // Add the bar button item to an array of UIBarButtonItems UIBarButtonItem[] barButtonItems = new UIBarButtonItem[] { myUIBarButtonItem }; // Add the UIBarButtonItems array to the toolbar _myUIToolbar.SetItems(barButtonItems, true); // Add the map view and toolbar to the view View.AddSubviews(_myMapView, _myUIToolbar); // Load of the rendering rules of the image service raster and display their names on the buttons in the toolbar await LoadRenderingRules(); }
private async void Initialize() { // Create new Map with basemap. Map map = new Map(Basemap.CreateTopographic()); // Provide Map to the MapView. _myMapView.Map = map; // Get the path to the geodatabase. string geodbFilePath = DataManager.GetDataFolder("e0d41b4b409a49a5a7ba11939d8535dc", "militaryoverlay.geodatabase"); // Load the geodatabase from local storage. Geodatabase baseGeodatabase = await Geodatabase.OpenAsync(geodbFilePath); // Get the path to the symbol dictionary. string symbolFilepath = DataManager.GetDataFolder("e34835bf5ec5430da7cf16bb8c0b075c", "mil2525d.stylx"); try { // Load the symbol dictionary from local storage. // Note that the type of the symbol definition must be explicitly provided along with the file name. DictionarySymbolStyle symbolStyle = await DictionarySymbolStyle.OpenAsync("mil2525d", symbolFilepath); // Add geodatabase features to the map, using the defined symbology. foreach (GeodatabaseFeatureTable table in baseGeodatabase.GeodatabaseFeatureTables) { // Load the table. await table.LoadAsync(); // Create the feature layer from the table. FeatureLayer layer = new FeatureLayer(table); // Load the layer. await layer.LoadAsync(); // Create and use a Dictionary Renderer using the DictionarySymbolStyle. layer.Renderer = new DictionaryRenderer(symbolStyle); // Add the layer to the map. map.OperationalLayers.Add(layer); } // Create geometry for the center of the map. MapPoint centerGeometry = new MapPoint(-13549402.587055, 4397264.96879385, SpatialReference.Create(3857)); // Set the map's viewpoint to highlight the desired content. _myMapView.SetViewpoint(new Viewpoint(centerGeometry, 201555)); } catch (Exception e) { new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }
public async override void ViewDidLoad() { base.ViewDidLoad(); // Create a new ArcGISMapImageLayer instance and pass a Url to the service var mapImageLayer = new ArcGISMapImageLayer( new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer")); // Await the load call for the layer. await mapImageLayer.LoadAsync(); // Create a new Map instance with the basemap Map myMap = new Map(SpatialReferences.Wgs84); myMap.Basemap = Basemap.CreateTopographic(); // Add the map image layer to the map's operational layers myMap.OperationalLayers.Add(mapImageLayer); // Create a new MapView control and provide its location coordinates on the frame. MapView myMapView = new MapView(); myMapView.Frame = new CoreGraphics.CGRect(0, 60, View.Bounds.Width, View.Bounds.Height - 40); // Assign the Map to the MapView myMapView.Map = myMap; // Create a button to show sublayers UIButton sublayersButton = new UIButton(UIButtonType.Custom); sublayersButton.Frame = new CoreGraphics.CGRect(0, myMapView.Bounds.Height, View.Bounds.Width, 40); sublayersButton.BackgroundColor = UIColor.White; sublayersButton.SetTitle("Sublayers", UIControlState.Normal); sublayersButton.SetTitleColor(UIColor.Blue, UIControlState.Normal); // Create a new instance of the Sublayers Table View Controller. This View Controller // displays a table of sublayers with a switch for setting the layer visibility. SublayersTable sublayersTableView = new SublayersTable(); // When the sublayers button is clicked, load the Sublayers Table View Controller sublayersButton.TouchUpInside += (s, e) => { if (mapImageLayer.Sublayers.Count > 0) { sublayersTableView.mapImageLayer = mapImageLayer; this.NavigationController.PushViewController(sublayersTableView, true); } }; // Add the MapView and Sublayers button to the View View.AddSubviews(myMapView, sublayersButton); }
private void Initialize() { // Show a topographic basemap. _myMapView.Map = new Map(Basemap.CreateTopographic()); // Load the layers from the corresponding URIs. ArcGISMapImageLayer imageryLayer = new ArcGISMapImageLayer(_mapServerUri); FeatureLayer pointLayer = new FeatureLayer(_featureLayerUri); // Add the layers to the map. _myMapView.Map.OperationalLayers.Add(imageryLayer); _myMapView.Map.OperationalLayers.Add(pointLayer); }
private void Initialize() { // Create a map with 'Imagery with Labels' basemap and an initial location Map myMap = new Map(Basemap.CreateTopographic()); // Create graphics overlay with graphics CreateOverlay(); _myMapView.GeoViewTapped += OnMapViewTapped; // Assign the map to the MapView _myMapView.Map = myMap; }
private void Initialize() { // Create a map with a topographic basemap and add it to the map view. MyMapView.Map = new Map(Basemap.CreateTopographic()); // Handle the MapView's GeoViewTapped event to create buffers. MyMapView.GeoViewTapped += MyMapView_GeoViewTapped; // Create a fill symbol for geodesic buffer polygons. Colors geodesicBufferColor = Colors.FromArgb(120, 255, 0, 0); SimpleLineSymbol geodesicOutlineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, geodesicBufferColor, 2); SimpleFillSymbol geodesicBufferFillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, geodesicBufferColor, geodesicOutlineSymbol); // Create a fill symbol for planar buffer polygons. Colors planarBufferColor = Colors.FromArgb(120, 0, 0, 255); SimpleLineSymbol planarOutlineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, planarBufferColor, 2); SimpleFillSymbol planarBufferFillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, planarBufferColor, planarOutlineSymbol); // Create a marker symbol for tap locations. SimpleMarkerSymbol tapSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Cross, System.Drawing.Color.White, 14); // Create a graphics overlay to display geodesic polygons, set its renderer and add it to the map view. GraphicsOverlay geodesicPolysOverlay = new GraphicsOverlay { Id = "GeodesicPolys", Renderer = new SimpleRenderer(geodesicBufferFillSymbol) }; MyMapView.GraphicsOverlays.Add(geodesicPolysOverlay); // Create a graphics overlay to display planar polygons, set its renderer and add it to the map view. GraphicsOverlay planarPolysOverlay = new GraphicsOverlay { Id = "PlanarPolys", Renderer = new SimpleRenderer(planarBufferFillSymbol) }; MyMapView.GraphicsOverlays.Add(planarPolysOverlay); // Create a graphics overlay to display tap locations for buffers, set its renderer and add it to the map view. GraphicsOverlay tapLocationsOverlay = new GraphicsOverlay { Id = "TapPoints", Renderer = new SimpleRenderer(tapSymbol) }; MyMapView.GraphicsOverlays.Add(tapLocationsOverlay); // Show the colors for each type of buffer in the UI. ShowBufferSwatches(planarBufferColor, geodesicBufferColor); }
private async void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateTopographic()); // Provide Map to the MapView MyMapView.Map = myMap; // Create geometry for the center of the map MapPoint centerGeometry = new MapPoint(-13549402.587055, 4397264.96879385, SpatialReference.Create(3857)); // Set the map's viewpoint to highlight the desired content await MyMapView.SetViewpointCenterAsync(centerGeometry); await MyMapView.SetViewpointScaleAsync(201555.279); // Get the path to the geodatabase string geodbFilePath = await GetPreparedFilePath(_geodatabaseName, _geodatabaseId); // Load the geodatabase from local storage Geodatabase baseGeodatabase = await Geodatabase.OpenAsync(geodbFilePath); // Get the path to the symbol dictionary string symbolFilepath = await GetPreparedFilePath(_symbolDefName, _symbolDefId); // Load the symbol dictionary from local storage // Note that the type of the symbol definition must be explicitly provided along with the file name DictionarySymbolStyle symbolStyle = await DictionarySymbolStyle.OpenAsync("mil2525d", symbolFilepath); // Add geodatabase features to the map, using the defined symbology foreach (FeatureTable table in baseGeodatabase.GeodatabaseFeatureTables) { // Load the table await table.LoadAsync(); // Create the feature layer from the table FeatureLayer myLayer = new FeatureLayer(table); // Load the layer await myLayer.LoadAsync(); // Create a Dictionary Renderer using the DictionarySymbolStyle DictionaryRenderer dictRenderer = new DictionaryRenderer(symbolStyle); // Apply the dictionary renderer to the layer myLayer.Renderer = dictRenderer; // Add the layer to the map myMap.OperationalLayers.Add(myLayer); } }
private async void Initialize() { // Create a map with a topographic basemap. Map myMap = new Map(Basemap.CreateTopographic()); // Create a new geoprocessing task. _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); // Assign the map to the MapView. _myMapView.Map = myMap; // Zoom into Portland, Oregon. await _myMapView.SetViewpointCenterAsync(new MapPoint(-122.66, 45.52, SpatialReferences.Wgs84), 1000000); }
private void Initialize() { // Create and show a map with a topographic basemap. _myMapView.Map = new Map(Basemap.CreateTopographic()); // Create an overlay to hold the lines of the hull. _graphicsOverlay = new GraphicsOverlay(); // Add the created graphics overlay to the MapView. _myMapView.GraphicsOverlays.Add(_graphicsOverlay); // Wire up the MapView's GeoViewTapped event handler. _myMapView.GeoViewTapped += MyMapView_GeoViewTapped; }
public Form1() { InitializeComponent(); var mapView = new MapView(); mOverlay = new GraphicsOverlay(); mapView.Map = new Map(Basemap.CreateTopographic()); mElementHost.Child = mapView; mapView.GraphicsOverlays.Add(mOverlay); mTimer.Tick += (sender, args) => SwitchGraphics(); mTimer.Interval = 1000; mTimer.Start(); }
private async void Initialize() { // Create the map with topographic basemap Map myMap = new Map(Basemap.CreateTopographic()); // Create the point for the map's initial viewpoint MapPoint point = new MapPoint(-11662054, 4818336, SpatialReference.Create(3857)); // Create a viewpoint for the point Viewpoint viewpoint = new Viewpoint(point, 200000); // Set the initial viewpoint myMap.InitialViewpoint = viewpoint; // Create a shapefile feature table from the shapefile path ShapefileFeatureTable myFeatureTable = new ShapefileFeatureTable(GetShapefilePath()); // Create a layer from the feature table _shapefileFeatureLayer = new FeatureLayer(myFeatureTable); // Add the layer to the map myMap.OperationalLayers.Add(_shapefileFeatureLayer); // Create the symbology for the alternate renderer SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Red, 1.0); SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, System.Drawing.Color.Yellow, lineSymbol); // Create the alternate renderer _alternateRenderer = new SimpleRenderer(fillSymbol); try { // Wait for the layer to load so that it will be assigned a default renderer await _shapefileFeatureLayer.LoadAsync(); // Hold a reference to the default renderer (to enable switching between the renderers) _defaultRenderer = _shapefileFeatureLayer.Renderer; // Add the map to the mapview _myMapView.Map = myMap; // Enable changing symbology now that sample is loaded _myRendererButton.Enabled = true; } catch (Exception e) { new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show(); } }
private async void Initialize() { // Create the point for the map's initial viewpoint. MapPoint point = new MapPoint(-11662054, 4818336, SpatialReference.Create(3857)); // Create and show a map with topographic basemap. Map myMap = new Map(Basemap.CreateTopographic()) { InitialViewpoint = new Viewpoint(point, 200000) }; // Get the path to the shapefile. string shapefilePath = DataManager.GetDataFolder("d98b3e5293834c5f852f13c569930caa", "Subdivisions.shp"); // Create a shapefile feature table from the shapefile path. ShapefileFeatureTable featureTable = new ShapefileFeatureTable(shapefilePath); // Create a layer from the feature table. _shapefileFeatureLayer = new FeatureLayer(featureTable); // Add the layer to the map. myMap.OperationalLayers.Add(_shapefileFeatureLayer); // Create the symbology for the alternate renderer. SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Red, 1.0); SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, System.Drawing.Color.Yellow, lineSymbol); // Create the alternate renderer. _alternateRenderer = new SimpleRenderer(fillSymbol); try { // Wait for the layer to load so that it will be assigned a default renderer. await _shapefileFeatureLayer.LoadAsync(); // Hold a reference to the default renderer (to enable switching between the renderers). _defaultRenderer = _shapefileFeatureLayer.Renderer; // Add the map to the mapview. _myMapView.Map = myMap; // Enable changing symbology now that sample is loaded. _changeRendererButton.Enabled = true; } catch (Exception e) { new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }
private async void Initialize() { // Create a map with a topographic basemap MyMapView.Map = new Map(Basemap.CreateTopographic()); try { // Create a new geoprocessing task _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); } catch (Exception e) { MessageBox.Show(e.ToString(), "Error"); } }
private async void Initialize() { // Create a map with a topographic basemap MyMapView.Map = new Map(Basemap.CreateTopographic()); try { // Create a new geoprocessing task _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(_hotspotUrl)); } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }
private async void Initialize() { // Create and show a map with a topographic basemap. _myMapView.Map = new Map(Basemap.CreateTopographic()); try { // Create a new geoprocessing task. _hotspotTask = await GeoprocessingTask.CreateAsync(new Uri(HotspotUrl)); } catch (Exception e) { new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } }
private async void InitializeScene() { try { //var webSceneUrl = new Uri("https://geoinfo-support.maps.arcgis.com/home/webscene/viewer.html?webscene=47435c44d2d8483d9489218eac5329dd"); Uri serviceFeatureTable_Uri = new Uri("https://services.arcgis.com/LeHsdRPbeEIElrVR/arcgis/rest/services/globalSceneTrainees_WFL1/FeatureServer/1"); ServiceFeatureTable featureTable = new ServiceFeatureTable(serviceFeatureTable_Uri); FeatureLayer featureLayer = new FeatureLayer(featureTable) { RenderingMode = FeatureRenderingMode.Dynamic }; SimpleLineSymbol mySimpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Colors.Black, 1); SimpleFillSymbol mysimpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, Colors.Blue, mySimpleLineSymbol); SimpleRenderer mySimpleRenderer = new SimpleRenderer(mysimpleFillSymbol); var scene = new Scene(Basemap.CreateTopographic()); //scene = new Scene(Basemap.CreateTopographic()); scene.BaseSurface.BackgroundGrid.IsVisible = false; //scene.BaseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"))); scene.BaseSurface.NavigationConstraint = NavigationConstraint.None; RendererSceneProperties myRendererSceneProperties = mySimpleRenderer.SceneProperties; myRendererSceneProperties.ExtrusionMode = ExtrusionMode.AbsoluteHeight; myRendererSceneProperties.ExtrusionExpression = "[height]"; featureLayer.Renderer = mySimpleRenderer; scene.OperationalLayers.Add(featureLayer); await scene.LoadAsync(); arSceneView.Scene = scene; double widthScene = 1300; double widthReal = 1; arSceneView.TranslationFactor = widthScene / widthReal; //scene.OperationalLayers.Add(layer); arSceneView.ClippingDistance = 800; arSceneView.SetInitialTransformation(TransformationMatrix.Create(0, 0, 0, 1, 0, .5, 1.5)); } catch (System.Exception ex) { await DisplayAlert("Failed to load scene", ex.Message, "OK"); await Navigation.PopAsync(); } }