private void ViewButton_Click(object sender, RoutedEventArgs e) { //Change button to 2D or 3D when button is clicked ViewButton.Content = FindResource(ViewButton.Content == FindResource("3D") ? "2D" : "3D"); if (ViewButton.Content == FindResource("2D")) { threeD = true; if (myScene == null) { //Create a new scene myScene = new Scene(Basemap.CreateNationalGeographic()); sceneView.Scene = myScene; // create an elevation source var elevationSource = new ArcGISTiledElevationSource(new System.Uri(ELEVATION_IMAGE_SERVICE)); // create a surface and add the elevation surface var sceneSurface = new Surface(); sceneSurface.ElevationSources.Add(elevationSource); // apply the surface to the scene sceneView.Scene.BaseSurface = sceneSurface; } //Once the scene has been created hide the mapView and show the sceneView mapView.Visibility = Visibility.Hidden; sceneView.Visibility = Visibility.Visible; } else { threeD = false; sceneView.Visibility = Visibility.Hidden; mapView.Visibility = Visibility.Visible; } }
private void Initialize() { // Configure the scene with National Geographic basemap. MySceneView.Scene = new Scene(Basemap.CreateNationalGeographic()); // Add the base surface for elevation data. Surface elevationSurface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(new Uri(_elevationServiceUrl)); elevationSurface.ElevationSources.Add(elevationSource); // Add the surface to the scene. MySceneView.Scene.BaseSurface = elevationSurface; // Set the initial camera. MapPoint initialLocation = new MapPoint(-119.9489, 46.7592, 0, SpatialReferences.Wgs84); Camera initialCamera = new Camera(initialLocation, 15000, 40, 60, 0); MySceneView.SetViewpointCamera(initialCamera); // Update terrain exaggeration based on the slider value. TerrainSlider.ValueChanged += (sender, e) => { elevationSurface.ElevationExaggeration = TerrainSlider.Value; }; }
private async void CreateNewMap() { Map newMap = new Map(Basemap.CreateNationalGeographic()); FeatureLayer NeaplAdmin1 = new FeatureLayer(new Uri("https://services.arcgis.com/iQ1dY19aHwbSDYIF/arcgis/rest/services/GAFSP_Nepal_2016/FeatureServer/1")); FeatureLayer NeaplandFood = new FeatureLayer(new Uri("https://services.arcgis.com/iQ1dY19aHwbSDYIF/arcgis/rest/services/GAFSP_Nepal_2016/FeatureServer/2")); FeatureLayer NeaplAirport = new FeatureLayer(new Uri("https://services.arcgis.com/pGfbNJoYypmNq86F/arcgis/rest/services/Nepal_Places_Facilities/FeatureServer/2")); await NeaplAirport.LoadAsync(); await NeaplAdmin1.LoadAsync(); await NeaplandFood.LoadAsync(); newMap.OperationalLayers.Add(NeaplandFood); newMap.OperationalLayers.Add(NeaplAdmin1); newMap.OperationalLayers.Add(NeaplAirport); newMap.InitialViewpoint = new Viewpoint(NeaplAdmin1.FullExtent); Map = newMap; }
private void Initialize() { //Exercise 1: Create new Map with basemap and initial location myMap = new Map(Basemap.CreateNationalGeographic()); //Exercise 1: Assign the map to the MapView mapView.Map = myMap; }
private void Initialize() { // Configure the scene with National Geographic basemap. _mySceneView.Scene = new Scene(Basemap.CreateNationalGeographic()); // Add the base surface for elevation data. Surface elevationSurface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(new Uri(_elevationServiceUrl)); elevationSurface.ElevationSources.Add(elevationSource); // Add the surface to the scene. _mySceneView.Scene.BaseSurface = elevationSurface; // Set the initial camera. MapPoint initialLocation = new MapPoint(-119.9489, 46.7592, 0, SpatialReferences.Wgs84); Camera initialCamera = new Camera(initialLocation, 15000, 40, 60, 0); _mySceneView.SetViewpointCamera(initialCamera); // Update terrain exaggeration based on the slider value. _terrainSlider.ProgressChanged += (sender, e) => { // Values are scaled to enable smoother animation - Android Seekbar has a course step size. elevationSurface.ElevationExaggeration = 1 + _terrainSlider.Progress / 20.0; }; }
private async void ViewButton_Click(object sender, RoutedEventArgs e) { originPoint = null; //Change button to 2D or 3D when button is clicked ViewButton.Content = FindResource(ViewButton.Content == FindResource("3D") ? "2D" : "3D"); if (ViewButton.Content == FindResource("2D")) { threeD = true; if (myScene == null) { //Create a new scene myScene = new Scene(Basemap.CreateNationalGeographic()); sceneView.Scene = myScene; // create an elevation source var elevationSource = new ArcGISTiledElevationSource(new System.Uri(ELEVATION_IMAGE_SERVICE)); // create a surface and add the elevation surface var sceneSurface = new Surface(); sceneSurface.ElevationSources.Add(elevationSource); // apply the surface to the scene sceneView.Scene.BaseSurface = sceneSurface; //Exercise 3: Open mobie map package (.mmpk) and add its operational layers to the scene var mmpk = await MobileMapPackage.OpenAsync(MMPK_PATH); if (mmpk.Maps.Count >= 0) { myMap = mmpk.Maps[0]; LayerCollection layerCollection = myMap.OperationalLayers; for (int i = 0; i < layerCollection.Count(); i++) { var thelayer = layerCollection[i]; myMap.OperationalLayers.Clear(); myScene.OperationalLayers.Add(thelayer); sceneView.SetViewpoint(myMap.InitialViewpoint); //Rotate the camera Viewpoint viewpoint = sceneView.GetCurrentViewpoint(ViewpointType.CenterAndScale); Esri.ArcGISRuntime.Geometry.MapPoint targetPoint = (MapPoint)viewpoint.TargetGeometry; Camera camera = sceneView.Camera.RotateAround(targetPoint, 45.0, 65.0, 0.0); await sceneView.SetViewpointCameraAsync(camera); } sceneView.Scene = myScene; bufferAndQuerySceneGraphics.SceneProperties.SurfacePlacement = SurfacePlacement.Draped; sceneView.GraphicsOverlays.Add(bufferAndQuerySceneGraphics); sceneRouteGraphics.SceneProperties.SurfacePlacement = SurfacePlacement.Draped; sceneView.GraphicsOverlays.Add(sceneRouteGraphics); } } //Exercise 1 Once the scene has been created hide the mapView and show the sceneView mapView.Visibility = Visibility.Hidden; sceneView.Visibility = Visibility.Visible; } else { threeD = false; sceneView.Visibility = Visibility.Hidden; mapView.Visibility = Visibility.Visible; } }
// 改变底图 private void ChangeBaseMap_list_SelectionChanged(object sender, SelectionChangedEventArgs e) { Map myMap = myMapView.Map; switch (ChangeBaseMap_list.SelectedIndex) { case 0: myMap.Basemap = Basemap.CreateDarkGrayCanvasVector(); myMapView_Eagle.Map.Basemap = Basemap.CreateDarkGrayCanvasVector(); break; case 1: myMap.Basemap = Basemap.CreateImagery(); myMapView_Eagle.Map.Basemap = Basemap.CreateImagery(); break; case 2: myMap.Basemap = Basemap.CreateImageryWithLabels(); myMapView_Eagle.Map.Basemap = Basemap.CreateImageryWithLabels(); break; case 3: myMap.Basemap = Basemap.CreateTerrainWithLabels(); myMapView_Eagle.Map.Basemap = Basemap.CreateTerrainWithLabels(); break; case 4: myMap.Basemap = Basemap.CreateLightGrayCanvas(); myMapView_Eagle.Map.Basemap = Basemap.CreateLightGrayCanvas(); break; case 5: myMap.Basemap = Basemap.CreateTopographic(); myMapView_Eagle.Map.Basemap = Basemap.CreateTopographic(); break; case 6: myMap.Basemap = Basemap.CreateNationalGeographic(); myMapView_Eagle.Map.Basemap = Basemap.CreateNationalGeographic(); break; case 7: myMap.Basemap = Basemap.CreateNavigationVector(); myMapView_Eagle.Map.Basemap = Basemap.CreateNavigationVector(); break; case 8: myMap.Basemap = Basemap.CreateOceans(); myMapView_Eagle.Map.Basemap = Basemap.CreateOceans(); break; case 9: myMap.Basemap = Basemap.CreateStreets(); myMapView_Eagle.Map.Basemap = Basemap.CreateStreets(); break; } }
private async void Initialize() { // Show a map in the default WebMercator spatial reference. _myMapView.Map = new Map(Basemap.CreateNationalGeographic()); // Add a graphics overlay for showing the tapped point. GraphicsOverlay overlay = new GraphicsOverlay(); SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Red, 5); overlay.Renderer = new SimpleRenderer(markerSymbol); _myMapView.GraphicsOverlays.Add(overlay); // Zoom to Minneapolis. Envelope startingEnvelope = new Envelope(-10995912.335747, 5267868.874421, -9880363.974046, 5960699.183877, SpatialReferences.WebMercator); await _myMapView.SetViewpointGeometryAsync(startingEnvelope); }
private async void Initialize() { //Exercise 1: Create new Map with basemap and initial location myMap = new Map(Basemap.CreateNationalGeographic()); //Exercise 1: Assign the map to the MapView mapView.Map = myMap; //Exercise 3: Add mobile map package to the map var mmpk = await MobileMapPackage.OpenAsync(MMPK_PATH); if (mmpk.Maps.Count >= 0) { myMap = mmpk.Maps[0]; //Exercise 3: Mobile map package does not contain a basemap so must add one. myMap.Basemap = Basemap.CreateNationalGeographic(); mapView.Map = myMap; } }
public static Basemap FromBasemapType(this BasemapType type) { switch (type) { case BasemapType.DarkGrayCanvasVector: return(Basemap.CreateDarkGrayCanvasVector()); case BasemapType.Imagery: return(Basemap.CreateImagery()); case BasemapType.ImageryWithLabels: return(Basemap.CreateImageryWithLabels()); case BasemapType.ImageryWithLabelsVector: return(Basemap.CreateImageryWithLabelsVector()); case BasemapType.LightGrayCanvas: return(Basemap.CreateLightGrayCanvas()); case BasemapType.LightGrayCanvasVector: return(Basemap.CreateLightGrayCanvasVector()); case BasemapType.NationalGeographic: return(Basemap.CreateNationalGeographic()); case BasemapType.NavigationVector: return(Basemap.CreateNavigationVector()); case BasemapType.Oceans: return(Basemap.CreateOceans()); case BasemapType.OpenStreetMap: return(Basemap.CreateOpenStreetMap()); case BasemapType.Streets: return(Basemap.CreateStreets()); case BasemapType.StreetsNightVector: return(Basemap.CreateStreetsNightVector()); case BasemapType.StreetsVector: return(Basemap.CreateStreetsVector()); case BasemapType.StreetsWithReliefVector: return(Basemap.CreateStreetsWithReliefVector()); case BasemapType.TerrainWithLabels: return(Basemap.CreateTerrainWithLabels()); case BasemapType.TerrainWithLabelsVector: return(Basemap.CreateTerrainWithLabelsVector()); case BasemapType.Topographic: return(Basemap.CreateTopographic()); case BasemapType.TopographicVector: return(Basemap.CreateTopographicVector()); default: throw new NotImplementedException(type.ToString()); } }
private void Initialize() { // Configure the scene with National Geographic basemap. _mySceneView.Scene = new Scene(Basemap.CreateNationalGeographic()); // Add the base surface for elevation data. _elevationSurface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(new Uri(_elevationServiceUrl)); _elevationSurface.ElevationSources.Add(elevationSource); // Add the surface to the scene. _mySceneView.Scene.BaseSurface = _elevationSurface; // Set the initial camera. MapPoint initialLocation = new MapPoint(-119.9489, 46.7592, 0, SpatialReferences.Wgs84); Camera initialCamera = new Camera(initialLocation, 15000, 40, 60, 0); _mySceneView.SetViewpointCamera(initialCamera); }
private async void Initialize() { //Exercise 1: Create new Map with basemap and initial location myMap = new Map(Basemap.CreateNationalGeographic()); //Exercise 1: Assign the map to the MapView mapView.Map = myMap; //Exercise 3: Add mobile map package to the map var mmpk = await MobileMapPackage.OpenAsync(MMPK_PATH); if (mmpk.Maps.Count >= 0) { myMap = mmpk.Maps[0]; //Exercise 3: Mobile map package does not contain a basemap so must add one. myMap.Basemap = Basemap.CreateNationalGeographic(); mapView.Map = myMap; } mapView.GraphicsOverlays.Add(bufferAndQueryMapGraphics); mapView.GraphicsOverlays.Add(mapRouteGraphics); Uri routeServiceUri = new Uri("http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World"); TokenCredential credentials = await AuthenticationManager.Current.GenerateCredentialAsync(routeServiceUri, "username", "password"); routeTask = await RouteTask.CreateAsync(routeServiceUri, credentials); try { routeParameters = await routeTask.GenerateDefaultParametersAsync(); } catch (Exception error) { Console.WriteLine(error.Message); } }
public Basemap GetBasemap(BasemapType basemapType) { Basemap basemap = null; switch (basemapType) { case BasemapType.Imagery: basemap = Basemap.CreateImagery(); break; case BasemapType.ImageryWithLabels: basemap = Basemap.CreateImageryWithLabels(); break; case BasemapType.Streets: basemap = Basemap.CreateStreets(); break; case BasemapType.Topographic: basemap = Basemap.CreateTopographic(); break; case BasemapType.TerrainWithLabels: basemap = Basemap.CreateTerrainWithLabels(); break; case BasemapType.LightGrayCanvas: basemap = Basemap.CreateLightGrayCanvas(); break; case BasemapType.NationalGeographic: basemap = Basemap.CreateNationalGeographic(); break; case BasemapType.Oceans: basemap = Basemap.CreateOceans(); break; case BasemapType.OpenStreetMap: basemap = Basemap.CreateOpenStreetMap(); break; case BasemapType.ImageryWithLabelsVector: basemap = Basemap.CreateImageryWithLabelsVector(); break; case BasemapType.StreetsVector: basemap = Basemap.CreateStreetsVector(); break; case BasemapType.TopographicVector: basemap = Basemap.CreateTopographicVector(); break; case BasemapType.TerrainWithLabelsVector: basemap = Basemap.CreateTerrainWithLabelsVector(); break; case BasemapType.LightGrayCanvasVector: basemap = Basemap.CreateLightGrayCanvasVector(); break; case BasemapType.NavigationVector: basemap = Basemap.CreateNavigationVector(); break; case BasemapType.StreetsNightVector: basemap = Basemap.CreateStreetsVector(); break; case BasemapType.StreetsWithReliefVector: basemap = Basemap.CreateStreetsWithReliefVector(); break; case BasemapType.DarkGrayCanvasVector: basemap = Basemap.CreateDarkGrayCanvasVector(); break; default: break; } return(basemap); }
public Basemap GetBaseMap(CusMapView cusMapView) { switch (cusMapView.Map.MapType) { case MapType.Imagery: return(Basemap.CreateImagery()); case MapType.Streets: return(Basemap.CreateStreets()); case MapType.ImageryWithLabels: return(Basemap.CreateImageryWithLabels()); case MapType.ImageryWithLabelsVector: return(Basemap.CreateImageryWithLabelsVector()); case MapType.LightGrayCanvas: return(Basemap.CreateLightGrayCanvas()); case MapType.LightGrayCanvasVector: return(Basemap.CreateLightGrayCanvasVector()); case MapType.DarkGrayCanvasVector: return(Basemap.CreateDarkGrayCanvasVector()); case MapType.NationalGeographic: return(Basemap.CreateNationalGeographic()); case MapType.Oceans: return(Basemap.CreateOceans()); case MapType.StreetsVector: return(Basemap.CreateStreetsVector()); case MapType.StreetsWithReliefVector: return(Basemap.CreateStreetsWithReliefVector()); case MapType.StreetsNightVector: return(Basemap.CreateStreetsNightVector()); case MapType.NavigationVector: return(Basemap.CreateNavigationVector()); case MapType.TerrainWithLabels: return(Basemap.CreateTerrainWithLabels()); case MapType.TerrainWithLabelsVector: return(Basemap.CreateTerrainWithLabelsVector()); case MapType.Topographic: return(Basemap.CreateTopographic()); case MapType.TopographicVector: return(Basemap.CreateTopographicVector()); case MapType.OpenStreetMap: return(Basemap.CreateOpenStreetMap()); case MapType.WebMap: if (!string.IsNullOrEmpty(cusMapView.Map.WebMapUrl)) { return(new Basemap(new Uri(cusMapView.Map.WebMapUrl))); } throw new ArgumentOutOfRangeException(nameof(cusMapView.Map.WebMapUrl), cusMapView.Map.WebMapUrl, null); default: throw new ArgumentOutOfRangeException(nameof(cusMapView.Map.MapType), cusMapView.Map.MapType, null); } }