private async void Initialize() { // Create new Map with basemap. Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Enable tap-for-info pattern on results. MyMapView.GeoViewTapped += MyMapView_GeoViewTapped; // Assign the map to the MapView. MyMapView.Map = myMap; try { // Initialize the LocatorTask with the provided service Uri. _geocoder = await LocatorTask.CreateAsync(_serviceUri); // Enable UI controls now that the geocoder is ready. AutoSuggestBox.IsEnabled = true; AutoSuggestBox.IsSuggestionListOpen = true; } catch (Exception e) { await new MessageDialog(e.ToString(), "Error").ShowAsync(); } }
public Online3D() { InitializeComponent(); // Initialisation de carte/scene standard avec Basemap Scene myScene = new Scene(Basemap.CreateImageryWithLabels()); // création d'une étendue sur Lyon et la part dieu Envelope myExtent = new Envelope(540412.4772154895, 5742150.47836813, 540985.754927453, 5742435.624313403, SpatialReferences.WebMercator); // mise en place de l'étendue par défaut de la carte à l'ouverture myScene.InitialViewpoint = new Viewpoint(myExtent); // Ajouter une couche ArcGISSceneLayer lyonBatiments = new ArcGISSceneLayer(new System.Uri("http://maps.esrifrance.fr/arcgis/rest/services/Hosted/Batiments_3D_Lyon/SceneServer/layers/0")); myScene.OperationalLayers.Add(lyonBatiments); // récupération du service d'élévation var elevationSource = new ArcGISTiledElevationSource(new System.Uri("http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")); var sceneSurface = new Surface(); sceneSurface.ElevationSources.Add(elevationSource); // ajout de l'élévation à la scène. myScene.BaseSurface = sceneSurface; // on assigne notre scene à la vue myView.Scene = myScene; }
public void Load_ImageryWithLabels_Layer() { MainViewModel.SetBBox(); MyMapView.Map = new Map(Basemap.CreateImageryWithLabels()); MyMapView.SetViewpointCenterAsync(MainViewModel.CenterPoint); MainViewModel.SetBBox(); }
private async void Initialize() { // Create new Map with basemap. Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Provide used Map to the MapView. MyMapView.Map = myMap; // Add a graphics overlay to the map for showing where the user tapped. MyMapView.GraphicsOverlays.Add(new GraphicsOverlay()); // Enable tap-for-info pattern on results. MyMapView.GeoViewTapped += MyMapView_GeoViewTapped; // Initialize the LocatorTask with the provided service Uri. try { _geocoder = await LocatorTask.CreateAsync(_serviceUri); } catch (Exception e) { await new MessageDialog(e.ToString(), "Error configuring geocoder").ShowAsync(); } // Set the initial viewpoint. await MyMapView.SetViewpointCenterAsync(34.058, -117.195, 5e4); }
private async void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Provide used Map to the MapView MyMapView.Map = myMap; // Set addresses as items source SearchBox.ItemsSource = _addresses; // Enable tap-for-info pattern on results MyMapView.GeoViewTapped += MyMapView_GeoViewTapped; // Initialize the LocatorTask with the provided service Uri try { _geocoder = await LocatorTask.CreateAsync(_serviceUri); // Enable UI controls now that the LocatorTask is ready SearchBox.IsEnabled = true; SearchButton.IsEnabled = true; } catch (Exception e) { MessageBox.Show(e.ToString(), "Error"); } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Initialize the MapView and SceneView with basemaps. _myMapView.Map = new Map(Basemap.CreateImageryWithLabels()); _mySceneView.Scene = new Scene(Basemap.CreateImageryWithLabels()); // Disable 'flick' gesture - this is the most straightforward way to prevent the 'flick' // animation on one view from competing with user interaction on the other. _mySceneView.InteractionOptions = new SceneViewInteractionOptions { IsFlickEnabled = false }; _myMapView.InteractionOptions = new MapViewInteractionOptions { IsFlickEnabled = false }; // Subscribe to viewpoint change events for both views - event raised on click+drag. _myMapView.ViewpointChanged += OnViewpointChanged; _mySceneView.ViewpointChanged += OnViewpointChanged; // Subscribe to the navigation completed events - raised on flick. _myMapView.NavigationCompleted += OnNavigationComplete; _mySceneView.NavigationCompleted += OnNavigationComplete; }
private async void Initialize() { // Create new Map with basemap. Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Provide used Map to the MapView. _myMapView.Map = myMap; // Add a graphics overlay to the map for showing where the user tapped. _myMapView.GraphicsOverlays.Add(new GraphicsOverlay()); // Enable tap-for-info pattern on results. _myMapView.GeoViewTapped += _myMapView_GeoViewTapped; // Initialize the LocatorTask with the provided service Uri. try { _geocoder = await LocatorTask.CreateAsync(_serviceUri); } catch (Exception e) { new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show(); } // Set the initial viewpoint. await _myMapView.SetViewpointCenterAsync(34.058, -117.195, 5e4); }
private async void Initialize() {// Create new Map with basemap Map myMap = new Map(Basemap.CreateImageryWithLabels()); myMap.InitialViewpoint = new Viewpoint(34.05293, -118.24368, 6000); // Assign the map to the MapView MyMapView.Map = myMap; try { // Initialize the LocatorTask with the provided service Uri _geocoder = await LocatorTask.CreateAsync(_serviceUri); var vm = CoreDependencyService.GetViewModel <SearchViewModel>(); vm.MapView = MyMapView; // Enable the UI controls now that the LocatorTask is ready MySuggestButton.IsEnabled = true; MySearchBar.IsEnabled = true; } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }
public Server() { InitializeComponent(); // Initialisation de carte standard avec Basemap myMap = new Map(Basemap.CreateImageryWithLabels()); // création d'une étendue sur versailles Envelope myExtent = new Envelope(227170.8480635096, 6236085.360818156, 245515.73485192718, 6245210.031069688, SpatialReferences.WebMercator); // mise en place de l'étendue par défaut de la carte à l'ouverture myMap.InitialViewpoint = new Viewpoint(myExtent); // Ajouter une couche stationnements = new FeatureLayer(new Uri("https://services2.arcgis.com/YECJCCLQCtaylXWh/arcgis/rest/services/Stationnement/FeatureServer/3")); myMap.OperationalLayers.Add(stationnements); // selection plus large stationnements.SelectionWidth = stationnements.SelectionWidth + 3; // Ajouter une autre couche ponctuelle livraisons = new FeatureLayer(new Uri("https://services2.arcgis.com/YECJCCLQCtaylXWh/arcgis/rest/services/Stationnement/FeatureServer/1/")); myMap.OperationalLayers.Add(livraisons); // on assigne notre carte à la vue : la carte est "chargée" myView.Map = myMap; // on en profite pour assigner l'event au click/tap sur la vue myView.GeoViewTapped += MyView_GeoViewTapped; }
private async void Initialize() { // Add a basemap. MySceneView.Scene = new Scene(Basemap.CreateImageryWithLabels()); MySceneView.Scene.BaseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"))); // Get the URL to the data. Uri kmlUrl = new Uri(DataManager.GetDataFolder("da301cb122874d5497f8a8f6c81eb36e", "esri_test_data.kmz")); // Create the KML dataset and layer. KmlDataset dataset = new KmlDataset(kmlUrl); KmlLayer layer = new KmlLayer(dataset); // Add the layer to the map. MySceneView.Scene.OperationalLayers.Add(layer); await dataset.LoadAsync(); // Build the ViewModel from the expanded list of layer infos. foreach (KmlNode node in dataset.RootNodes) { // LayerDisplayVM is a custom type made for this sample to serve as the ViewModel; it is not a part of ArcGIS Runtime. LayerDisplayVM nodeVm = new LayerDisplayVM(node, null); _viewModelList.Add(nodeVm); LayerDisplayVM.BuildLayerInfoList(nodeVm, _viewModelList); } // Update the list of layers, using the root node from the list. LayerTreeView.ItemsSource = _viewModelList; }
private async void Initialize() { if (await ApiKeyManager.CheckKeyValidity() != ApiKeyStatus.Valid) { await new MessageDialog2("Please use the settings dialog to configure an API Key.", "Error").ShowAsync(); return; } // Create new Map with basemap. Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Enable tap-for-info pattern on results. MyMapView.GeoViewTapped += MyMapView_GeoViewTapped; // Assign the map to the MapView. MyMapView.Map = myMap; try { // Initialize the LocatorTask with the provided service Uri. _geocoder = await LocatorTask.CreateAsync(_serviceUri); // Enable UI controls now that the geocoder is ready. AutoSuggestBox.IsEnabled = true; AutoSuggestBox.IsSuggestionListOpen = true; } catch (Exception e) { await new MessageDialog2(e.ToString(), "Error").ShowAsync(); } }
private async void Initialize() { // Create the map. Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Create a point in the Greenwich observatory courtyard in London, UK, the location of the prime meridian. _originalPoint = new MapPoint(538985.355, 177329.516, SpatialReference.Create(27700)); // Set the initial extent to an extent centered on the point. Viewpoint initialViewpoint = new Viewpoint(_originalPoint, 5000); myMap.InitialViewpoint = initialViewpoint; // Add the map to the map view. MyMapView.Map = myMap; // Create a graphics overlay to hold the original and projected points. _pointsOverlay = new GraphicsOverlay(); MyMapView.GraphicsOverlays.Add(_pointsOverlay); // Add the point as a graphic with a blue square. SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Square, Colors.Blue, 15); Graphic originalGraphic = new Graphic(_originalPoint, markerSymbol); _pointsOverlay.Graphics.Add(originalGraphic); // Get the path to the projection engine data (if it exists). string peFolderPath = GetProjectionDataPath(); if (!String.IsNullOrEmpty(peFolderPath)) { TransformationCatalog.ProjectionEngineDirectory = peFolderPath; MessagesTextBox.Text = "Using projection data found at '" + peFolderPath + "'"; } else { MessagesTextBox.Text = "Projection engine data not found."; } try { // Wait for the map to load so that it has a spatial reference. await myMap.LoadAsync(); // Show the input and output spatial reference. InSpatialRefTextBox.Text = "In WKID = " + _originalPoint.SpatialReference.Wkid; OutSpatialRefTextBox.Text = "Out WKID = " + myMap.SpatialReference.Wkid; // Set up the UI. TransformationsListBox.ItemsSource = SuitableTransformationsList; // Create a list of transformations to fill the UI list box. GetSuitableTransformations(_originalPoint.SpatialReference, myMap.SpatialReference, UseExtentSwitch.IsToggled); } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }
private void Initialize() { // Create new map with a base map Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Set the map view, map property to the base map MyMapView.Map = myMap; // Create a set of predefined bookmarks; each one follows the pattern of: // ~ Initialize a viewpoint pointing to a latitude longitude // ~ Create a new bookmark // ~ Give the bookmark a name // ~ Assign the viewpoint // ~ Add the bookmark to bookmark collection of the map // ~ Add the bookmark name to the UI combo box for the user to choose from // Bookmark-1 Viewpoint myViewpoint1 = new Viewpoint(27.3805833, 33.6321389, 6000); Bookmark myBookmark1 = new Bookmark(); myBookmark1.Name = "Mysterious Desert Pattern"; myBookmark1.Viewpoint = myViewpoint1; MyMapView.Map.Bookmarks.Add(myBookmark1); bookmarkPicker.Items.Add(myBookmark1.Name); // Bookmark-2 Viewpoint myViewpoint2 = new Viewpoint(37.401573, -116.867808, 6000); Bookmark myBookmark2 = new Bookmark(); myBookmark2.Name = "Strange Symbol"; myBookmark2.Viewpoint = myViewpoint2; MyMapView.Map.Bookmarks.Add(myBookmark2); bookmarkPicker.Items.Add(myBookmark2.Name); // Bookmark-3 Viewpoint myViewpoint3 = new Viewpoint(-33.867886, -63.985, 40000); Bookmark myBookmark3 = new Bookmark(); myBookmark3.Name = "Guitar-Shaped Forest"; myBookmark3.Viewpoint = myViewpoint3; MyMapView.Map.Bookmarks.Add(myBookmark3); bookmarkPicker.Items.Add(myBookmark3.Name); // Bookmark-4 Viewpoint myViewpoint4 = new Viewpoint(44.525049, -110.83819, 6000); Bookmark myBookmark4 = new Bookmark(); myBookmark4.Name = "Grand Prismatic Spring"; myBookmark4.Viewpoint = myViewpoint4; MyMapView.Map.Bookmarks.Add(myBookmark4); bookmarkPicker.Items.Add(myBookmark4.Name); // Set the initial combo box selection to the last bookmark added bookmarkPicker.SelectedIndex = 3; // Zoom to the last bookmark myMap.InitialViewpoint = myMap.Bookmarks.Last().Viewpoint; }
public async void Initialize() { // Create a new scene with basemap var myScene = new Scene(Basemap.CreateImageryWithLabels()); // create an elevation source ArcGISTiledElevationSource elevationSrc = new ArcGISTiledElevationSource(_elevationSourceUrl); myScene.BaseSurface.ElevationSources.Add(elevationSrc); // create additional layer ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(_serviceUri); myScene.OperationalLayers.Add(sceneLayer); // Set the surface placement mode for the overlay. graphicsOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Relative; // create a red "X" marker symbol SimpleMarkerSceneSymbol car = new SimpleMarkerSceneSymbol(SimpleMarkerSceneSymbolStyle.Cube, Color.Red, 20, 20, 20, SceneSymbolAnchorPosition.Bottom); // create a new graphic; assign the point and the symbol in the constructor try { // Load the layer. await sceneLayer.LoadAsync(); // Get the center of the scene layer. MapPoint center = (MapPoint)GeometryEngine.Project(sceneLayer.FullExtent.GetCenter(), SpatialReferences.Wgs84); Console.WriteLine(center.ToString()); var newPoint = new MapPoint(_positionPublisher.getX(), _positionPublisher.getY(), 0, SpatialReferences.Wgs84); graphic.Geometry = newPoint; graphic.Symbol = car; graphicsOverlay.Graphics.Add(graphic); MainWindow.View.Map3D.GraphicsOverlays.Add(graphicsOverlay); // Assign the Scene to the SceneView. MainWindow.View.Map3D.Scene = myScene; //// CAMERA ANGLE //// // Create a camera with coordinates showing layer data. // Camera camera = new Camera(center.Y, center.X, 225, 220, 80, 0); // Set view point of scene view using camera. //await Map3D.SetViewpointCameraAsync(camera); // create an OrbitGeoElementCameraController, pass in the target graphic and initial camera distance var orbitGraphicController = new OrbitGeoElementCameraController(graphic, 1000); MainWindow.View.Map3D.CameraController = orbitGraphicController; } catch (Exception e) { MessageBox.Show(e.ToString(), "Error"); } }
// 改变底图 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 void Initialize() { // Initialize the MapView and SceneView with a basemap MyMapView.Map = new Map(Basemap.CreateImageryWithLabels()); MySceneView.Scene = new Scene(Basemap.CreateImageryWithLabels()); // Subscribe to viewpoint change events for both views MyMapView.ViewpointChanged += view_viewpointChanged; MySceneView.ViewpointChanged += view_viewpointChanged; }
public MainWindow() { InitializeComponent(); // Création de l'objet map standard var myDefaultMap = new Map(Basemap.CreateImageryWithLabels()); // On assigne notre map à la vue, la carte se charge. mapView1.Map = myDefaultMap; }
private void Initialize() { // Create a new map with a World Imagery base map Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Add the map to the MapView _myMapView.Map = myMap; // Create a set of predefined bookmarks; each one follows the pattern of: // ~ Initialize a viewpoint pointing to a latitude longitude // ~ Create a new bookmark // ~ Give the bookmark a name // ~ Assign the viewpoint // ~ Add the bookmark to bookmark collection of the map // Bookmark-1 Viewpoint myViewpoint1 = new Viewpoint(27.3805833, 33.6321389, 6000); Bookmark myBookmark1 = new Bookmark { Name = "Mysterious Desert Pattern", Viewpoint = myViewpoint1 }; _myMapView.Map.Bookmarks.Add(myBookmark1); // Bookmark-2 Viewpoint myViewpoint2 = new Viewpoint(-39.299987, 174.060858, 600000); Bookmark myBookmark2 = new Bookmark { Name = "Dormant Volcano", Viewpoint = myViewpoint2 }; _myMapView.Map.Bookmarks.Add(myBookmark2); // Bookmark-3 Viewpoint myViewpoint3 = new Viewpoint(-33.867886, -63.985, 40000); Bookmark myBookmark3 = new Bookmark { Name = "Guitar-Shaped Forest", Viewpoint = myViewpoint3 }; _myMapView.Map.Bookmarks.Add(myBookmark3); // Bookmark-4 Viewpoint myViewpoint4 = new Viewpoint(44.525049, -110.83819, 6000); Bookmark myBookmark4 = new Bookmark { Name = "Grand Prismatic Spring", Viewpoint = myViewpoint4 }; _myMapView.Map.Bookmarks.Add(myBookmark4); }
private void Initialize() { // Set up the basemap. MySceneView.Scene = new Scene(Basemap.CreateImageryWithLabels()); // Update the UI. LayerPicker.IsEnabled = true; LayerPicker.ItemsSource = _sources; LayerPicker.SelectedIndexChanged += LayerPicker_SelectionChanged; LayerPicker.SelectedIndex = 0; }
private async void Initialize() { // Show a labeled imagery basemap. _myMapView.Map = new Map(Basemap.CreateImageryWithLabels()); // Initialize the geocoder with the provided service URL. _geocoder = await LocatorTask.CreateAsync(_serviceUri); // Enable controls now that the geocoder is ready. _addressSearchBar.UserInteractionEnabled = true; }
private void Initialize() { // Create a map with 'Imagery with Labels' basemap. Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Assign the map to the MapView. _myMapView.Map = myMap; // Create a center point for the graphics. MapPoint centerPoint = new MapPoint(-117.195800, 34.056295, SpatialReferences.Wgs84); // Create an envelope from that center point. Envelope pointExtent = new Envelope(centerPoint, .07, .035); // Create a collection of points on the corners of the envelope. PointCollection points = new PointCollection(SpatialReferences.Wgs84) { new MapPoint(pointExtent.XMax, pointExtent.YMax), new MapPoint(pointExtent.XMax, pointExtent.YMin), new MapPoint(pointExtent.XMin, pointExtent.YMax), new MapPoint(pointExtent.XMin, pointExtent.YMin), }; // Create overlay to where graphics are shown. GraphicsOverlay overlay = new GraphicsOverlay(); // Add points to the graphics overlay. foreach (MapPoint point in points) { // Create new graphic and add it to the overlay. overlay.Graphics.Add(new Graphic(point)); } // Create symbol for points. SimpleMarkerSymbol pointSymbol = new SimpleMarkerSymbol() { Color = Color.Yellow, Size = 30, Style = SimpleMarkerSymbolStyle.Square }; // Create simple renderer with symbol. SimpleRenderer renderer = new SimpleRenderer(pointSymbol); // Set renderer to graphics overlay. overlay.Renderer = renderer; // Add created overlay to the MapView. _myMapView.GraphicsOverlays.Add(overlay); // Center the MapView on the points. _myMapView.SetViewpointGeometryAsync(pointExtent, 50); }
private async void CreateNewMap() { Map newMap = new Map(Basemap.CreateImageryWithLabels()); FeatureLayer trailHeadsLayer = new FeatureLayer(new Uri("https://services1.arcgis.com/vxtcdWjsjPHYpR1J/arcgis/rest/services/Onderwijsinstellingen/FeatureServer/0")); //new FeatureLayer(new Uri("https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads/FeatureServer/0")); await trailHeadsLayer.LoadAsync(); trailHeadsLayer.IsPopupEnabled = true; newMap.OperationalLayers.Add(trailHeadsLayer); newMap.InitialViewpoint = new Viewpoint(trailHeadsLayer.FullExtent); Map = newMap; }
private void Initialize() { // Create a map with labeled imagery basemap. Map map = new Map(Basemap.CreateImageryWithLabels()); // Add default bookmarks. AddDefaultBookmarks(map); // Zoom to the last bookmark. map.InitialViewpoint = map.Bookmarks.Last().Viewpoint; // Show the map. _myMapView.Map = map; }
private void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Provide used Map to the MapView _myMapView.Map = myMap; // Add default bookmarks AddDefaultBookmarks(); // Zoom to the last bookmark myMap.InitialViewpoint = myMap.Bookmarks.Last().Viewpoint; }
private async void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Assign the map to the MapView MyMapView.Map = myMap; // Initialize the LocatorTask with the provided service Uri _geocoder = await LocatorTask.CreateAsync(_serviceUri); // Enable the UI controls now that the LocatorTask is ready MySuggestButton.IsEnabled = true; MySearchBar.IsEnabled = true; }
private void Initialize() { // Initialize the MapView and SceneView with basemaps. _myMapView.Map = new Map(BasemapStyle.ArcGISImagery); _mySceneView.Scene = new Scene(Basemap.CreateImageryWithLabels()); // Disable 'flick' gesture - this is the most straightforward way to prevent the 'flick' // animation on one view from competing with user interaction on the other. _mySceneView.InteractionOptions = new SceneViewInteractionOptions { IsFlickEnabled = false }; _myMapView.InteractionOptions = new MapViewInteractionOptions { IsFlickEnabled = false }; }
public MapVM(MapView MyMapViewFormWin, MainVM mainViewModel) { MyMapView = MyMapViewFormWin; MainViewModel = mainViewModel; MyMapView.Map = new Map(Basemap.CreateImageryWithLabels()); MainViewModel.SpaceMap = true; Load_Cad(); MainViewModel.CadMap = true; MyMapView.Map.InitialViewpoint = new Viewpoint(54.5293000, 36.2754200, 60000); OverLay = new GraphicsOverlay(); OverLayforBorder = new GraphicsOverlay(); SelectedPlaceCoord = new PlaceCoord(); GetPlaceProp = new GetPlace(); MyMapView.GraphicsOverlays.Add(OverLay); MyMapView.GraphicsOverlays.Add(OverLayforBorder); }
private void Initialize() { // Create new map with basemap layer. Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Create several map points using the WGS84 coordinates (latitude and longitude). MapPoint oldFaithfulPoint = new MapPoint(-110.828140, 44.460458, SpatialReferences.Wgs84); MapPoint cascadeGeyserPoint = new MapPoint(-110.829004, 44.462438, SpatialReferences.Wgs84); MapPoint plumeGeyserPoint = new MapPoint(-110.829381, 44.462735, SpatialReferences.Wgs84); // Use the two points farthest apart to create an envelope. Envelope initialEnvelope = new Envelope(oldFaithfulPoint, plumeGeyserPoint); // Set the map initial viewpoint. myMap.InitialViewpoint = new Viewpoint(initialEnvelope); // Add the map to the map view. _myMapView.Map = myMap; // Set the viewpoint to the envelope with padding. _myMapView.SetViewpointGeometryAsync(initialEnvelope, 50); // Create a graphics overlay. GraphicsOverlay myGraphicOverlay = new GraphicsOverlay(); // Create graphics based upon the map points. Graphic oldFaithfulGraphic = new Graphic(oldFaithfulPoint); Graphic cascadeGeyserGraphic = new Graphic(cascadeGeyserPoint); Graphic plumeGeyserGraphic = new Graphic(plumeGeyserPoint); // Add the graphics to the graphics overlay. myGraphicOverlay.Graphics.Add(oldFaithfulGraphic); myGraphicOverlay.Graphics.Add(cascadeGeyserGraphic); myGraphicOverlay.Graphics.Add(plumeGeyserGraphic); // Create a simple marker symbol - red, cross, size 12. SimpleMarkerSymbol mySymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Cross, System.Drawing.Color.Red, 12); // Create a simple renderer based on the simple marker symbol. SimpleRenderer myRenderer = new SimpleRenderer(mySymbol); // Apply the renderer to the graphics overlay (all graphics use the same symbol). myGraphicOverlay.Renderer = myRenderer; // Add the graphics overlay to the map view. _myMapView.GraphicsOverlays.Add(myGraphicOverlay); }
private async void OpenMMPK() { var filepath = mapClass.Filepath; Basemap heatBase = Basemap.CreateImageryWithLabels(); try { // Load directly or unpack then load as needed by the map package. if (await MobileMapPackage.IsDirectReadSupportedAsync(filepath)) { // Open the map package. MobileMapPackage heatMap = await MobileMapPackage.OpenAsync(filepath); Map HeatVulnerabilityMap = heatMap.Maps.First(); // Check for map in .mmpk and give to corresponding views if (heatMap.Maps.Count > 0) { HeatVuln.Map = HeatVulnerabilityMap; HeatVuln.Map.Basemap = heatBase; HeatVuln.Map.OperationalLayers[0].IsVisible = false; // Avg Temp / Daily Heating HeatVuln.Map.OperationalLayers[1].IsVisible = false; // Impervous Surfaces HeatVuln.Map.OperationalLayers[2].IsVisible = false; // Tree Canopy HeatVuln.Map.OperationalLayers[3].IsVisible = true; // Heat Vulnerability HeatVuln.Map.OperationalLayers[4].IsVisible = false; // Richmond Poverty } } else { // Create a path for the unpacked package. string unpackedPath = filepath + "unpacked"; // Unpack the package. await MobileMapPackage.UnpackAsync(filepath, unpackedPath); // Open the package. MobileMapPackage package = await MobileMapPackage.OpenAsync(unpackedPath); // Load the package. await package.LoadAsync(); } } catch (Exception e) { System.Windows.MessageBox.Show(e.ToString(), "Error"); } }
private void Initialize() { // Create a new map with a World Imagery base map var myMap = new Map(Basemap.CreateImageryWithLabels()); // Add the map to the MapView _myMapView.Map = myMap; // Create a set of predefined bookmarks; each one follows the pattern of: // ~ Initialize a viewpoint pointing to a latitude longitude // ~ Create a new bookmark // ~ Give the bookmark a name // ~ Assign the viewpoint // ~ Add the bookmark to bookmark collection of the map // Bookmark-1 Viewpoint myViewpoint1 = new Viewpoint(27.3805833, 33.6321389, 6000); Bookmark myBookmark1 = new Bookmark(); myBookmark1.Name = "Mysterious Desert Pattern"; myBookmark1.Viewpoint = myViewpoint1; _myMapView.Map.Bookmarks.Add(myBookmark1); // Bookmark-2 Viewpoint myViewpoint2 = new Viewpoint(37.401573, -116.867808, 6000); Bookmark myBookmark2 = new Bookmark(); myBookmark2.Name = "Strange Symbol"; myBookmark2.Viewpoint = myViewpoint2; _myMapView.Map.Bookmarks.Add(myBookmark2); // Bookmark-3 Viewpoint myViewpoint3 = new Viewpoint(-33.867886, -63.985, 40000); Bookmark myBookmark3 = new Bookmark(); myBookmark3.Name = "Guitar-Shaped Forest"; myBookmark3.Viewpoint = myViewpoint3; _myMapView.Map.Bookmarks.Add(myBookmark3); // Bookmark-4 Viewpoint myViewpoint4 = new Viewpoint(44.525049, -110.83819, 6000); Bookmark myBookmark4 = new Bookmark(); myBookmark4.Name = "Grand Prismatic Spring"; myBookmark4.Viewpoint = myViewpoint4; _myMapView.Map.Bookmarks.Add(myBookmark4); }