private async void Initialize() { // Create the scene with basemap. MySceneView.Scene = new Scene(Basemap.CreateImagery()); // Create a surface and add the elevation service to it. Surface groundSurface = new Surface(); groundSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri(ElevationServiceUrl))); // Add the surface to the scene. MySceneView.Scene.BaseSurface = groundSurface; // Get the path to the local point cloud data. string pointCloudPath = DataManager.GetDataFolder("34da965ca51d4c68aa9b3a38edb29e00", "sandiego-north-balboa-pointcloud.slpk"); // Create the point cloud layer. PointCloudLayer balboaPointCloud = new PointCloudLayer(new Uri(pointCloudPath)); // Add the point cloud to the scene. MySceneView.Scene.OperationalLayers.Add(balboaPointCloud); // Wait for the layer to load. await balboaPointCloud.LoadAsync(); // Zoom to the extent of the point cloud. await MySceneView.SetViewpointAsync(new Viewpoint(balboaPointCloud.FullExtent)); }
private async void NavigateToNode(KmlNode node) { // Get a corrected Runtime viewpoint using the KmlViewpoint. bool viewpointNeedsAltitudeAdjustment; Viewpoint runtimeViewpoint = ViewpointFromKmlViewpoint(node, out viewpointNeedsAltitudeAdjustment); if (viewpointNeedsAltitudeAdjustment) { runtimeViewpoint = await GetAltitudeAdjustedViewpointAsync(node, runtimeViewpoint); } // Set the viewpoint. if (runtimeViewpoint != null && !runtimeViewpoint.TargetGeometry.IsEmpty) { await MySceneView.SetViewpointAsync(runtimeViewpoint); } }
private async void LayerPicker_SelectionChanged(object sender, EventArgs e) { // Clear existing layers. MySceneView.Scene.OperationalLayers.Clear(); // Get the name of the selected layer. string name = _sources[LayerPicker.SelectedIndex]; try { // Create the layer using the chosen constructor. KmlLayer layer; switch (name) { case "URL": default: layer = new KmlLayer(new Uri("https://www.wpc.ncep.noaa.gov/kml/noaa_chart/WPC_Day1_SigWx.kml")); break; case "Local file": string filePath = DataManager.GetDataFolder("324e4742820e46cfbe5029ff2c32cb1f", "US_State_Capitals.kml"); layer = new KmlLayer(new Uri(filePath)); break; case "Portal item": ArcGISPortal portal = await ArcGISPortal.CreateAsync(); PortalItem item = await PortalItem.CreateAsync(portal, "9fe0b1bfdcd64c83bd77ea0452c76253"); layer = new KmlLayer(item); break; } // Add the selected layer to the map. MySceneView.Scene.OperationalLayers.Add(layer); // Zoom to the extent of the United States. await MySceneView.SetViewpointAsync(new Viewpoint(_usEnvelope)); } catch (Exception ex) { await((Page)Parent).DisplayAlert("Error", ex.ToString(), "OK"); } }
private async void Initialize() { // Set up the basemap. MySceneView.Scene = new Scene(Basemap.CreateImageryWithLabels()); // Create the dataset. KmlDataset dataset = new KmlDataset(new Uri("https://www.arcgis.com/sharing/rest/content/items/600748d4464442288f6db8a4ba27dc95/data")); // Listen for network link control messages. // These should be shown to the user. dataset.NetworkLinkControlMessage += Dataset_NetworkLinkControlMessage; // Create the layer from the dataset. KmlLayer fileLayer = new KmlLayer(dataset); // Add the layer to the map. MySceneView.Scene.OperationalLayers.Add(fileLayer); // Zoom in to center the map on Germany. await MySceneView.SetViewpointAsync(new Viewpoint(new MapPoint(8.150526, 50.472421, SpatialReferences.Wgs84), 20000000)); }
private async void NavigateToNode(KmlNode node) { try { // Get a corrected Runtime viewpoint using the KmlViewpoint. bool viewpointNeedsAltitudeAdjustment; Viewpoint runtimeViewpoint = ViewpointFromKmlViewpoint(node, out viewpointNeedsAltitudeAdjustment); if (viewpointNeedsAltitudeAdjustment) { runtimeViewpoint = await GetAltitudeAdjustedViewpointAsync(node, runtimeViewpoint); } // Set the viewpoint. if (runtimeViewpoint != null && !runtimeViewpoint.TargetGeometry.IsEmpty) { await MySceneView.SetViewpointAsync(runtimeViewpoint); } } catch (Exception e) { await new MessageDialog2(e.ToString(), "Error").ShowAsync(); } }
private async void NavigateToNode(KmlNode node) { try { // Get a corrected Runtime viewpoint using the KmlViewpoint. bool viewpointNeedsAltitudeAdjustment; Viewpoint runtimeViewpoint = ViewpointFromKmlViewpoint(node, out viewpointNeedsAltitudeAdjustment); if (viewpointNeedsAltitudeAdjustment) { runtimeViewpoint = await GetAltitudeAdjustedViewpointAsync(node, runtimeViewpoint); } // Set the viewpoint. if (runtimeViewpoint != null && !runtimeViewpoint.TargetGeometry.IsEmpty) { await MySceneView.SetViewpointAsync(runtimeViewpoint); } } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }