private void Initialize() { // Create the scene with basemap. MySceneView.Scene = new Scene(Basemap.CreateImagery()); // Create and use an elevation surface to show terrain. Surface baseSurface = new Surface(); baseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri(ElevationServiceUrl))); MySceneView.Scene.BaseSurface = baseSurface; // Create the integrated mesh layer from URL. IntegratedMeshLayer meshLayer = new IntegratedMeshLayer(new Uri(IntegratedMeshLayerUrl)); // Add the layer to the scene's operational layers. MySceneView.Scene.OperationalLayers.Add(meshLayer); // Start with camera pointing at El Capitan. MySceneView.SetViewpointCamera(new Camera(new MapPoint(-119.622075, 37.720650, 2104.901239), 315.50368761552056, 78.09465920130114, 0)); }
private void Initialize() { // Create the scene with basemap. MySceneView.Scene = new Scene(BasemapStyle.ArcGISImageryStandard); // Create and use an elevation surface to show terrain. Surface baseSurface = new Surface(); baseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri(ElevationServiceUrl))); MySceneView.Scene.BaseSurface = baseSurface; // Create the integrated mesh layer from URL. IntegratedMeshLayer meshLayer = new IntegratedMeshLayer(new Uri(IntegratedMeshLayerUrl)); // Add the layer to the scene's operational layers. MySceneView.Scene.OperationalLayers.Add(meshLayer); // Start with camera pointing at the scene. MySceneView.SetViewpointCamera(new Camera(new MapPoint(2.8259, 41.9906, 200.0), 190, 65, 0)); }
private async void MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e) { MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged; try { // Set camera and navigate to it var viewpoint = new Camera( location: new MapPoint(x: -99, y: 34, z: 3500000), heading: 0, pitch: 5); await MySceneView.SetViewAsync(camera : viewpoint, velocity : 10, liftOff : true); } catch (Exception ex) { MessageBox.Show("Error occured while navigating to the target viewpoint", "An error occured"); Debug.WriteLine(ex.ToString()); } }
private async void MySceneView_PointerMoved(object sender, PointerRoutedEventArgs e) { try { // Get the geographic location for the current mouse position. MapPoint geoPoint = await MySceneView.ScreenToLocationAsync(e.GetCurrentPoint(MySceneView).Position); if (geoPoint == null) { return; } // Update the location distance measurement. _distanceMeasurement.EndLocation = geoPoint; } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
private void Initialize() { // Create a scene for the sceneview. Scene myScene = new Scene(Basemap.CreateImagery()); MySceneView.Scene = myScene; // Create a geometry for the ground overlay. Envelope overlayGeometry = new Envelope(-123.066227926904, 44.04736963555683, -123.0796942287304, 44.03878298600624, SpatialReferences.Wgs84); // Create a KML Icon for the overlay image. KmlIcon overlayImage = new KmlIcon(_imageryUri); // Create the KML ground overlay. KmlGroundOverlay overlay = new KmlGroundOverlay(overlayGeometry, overlayImage); // Set the rotation of the ground overlay. overlay.Rotation = -3.046024799346924; // Create a KML dataset with the ground overlay as the root node. KmlDataset dataset = new KmlDataset(overlay); // Create a KML layer for the scene view. KmlLayer layer = new KmlLayer(dataset); // Add the layer to the map. MySceneView.Scene.OperationalLayers.Add(layer); // Move the viewpoint to the ground overlay. MySceneView.SetViewpoint(new Viewpoint(overlay.Geometry, new Camera(overlay.Geometry.Extent.GetCenter(), 1250, 45, 60, 0))); // Add an event handler for the on-screen slider. OpacitySlider.ValueChanged += (s, e) => { // Change the color of the KML ground overlay image to edit the alpha-value. (Other color values are left as-is in the original image.) overlay.Color = System.Drawing.Color.FromArgb((int)(e.NewValue), 0, 0, 0); // Make the value an integer (For the UI). OpacitySlider.Value = (int)OpacitySlider.Value; }; }
private void Initialize() { // Create a new scene Scene myScene = new Scene(); // Crate a new base map using the static/shared create imagery method Basemap myBaseMap = Basemap.CreateImagery(); // Add the imagery basemap to the scene's base map property myScene.Basemap = myBaseMap; // Add scene (with an imagery basemap) to the scene view's scene property MySceneView.Scene = myScene; // Create a new surface Surface mySurface = new Surface(); // Define the string that points to the elevation image service string myElevationImageService = "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"; // Create a Uri from the elevation image service string Uri myUri = new Uri(myElevationImageService); // Create an ArcGIS tiled elevation ArcGISTiledElevationSource myArcGISTiledElevationSource = new ArcGISTiledElevationSource(); // Set the ArcGIS tiled elevation sources property to the Uri of the elevation image service myArcGISTiledElevationSource.Source = myUri; // Add the ArcGIS tiled elevation source to the surface's elevated sources collection mySurface.ElevationSources.Add(myArcGISTiledElevationSource); // Set the scene's base surface to the surface with the ArcGIS tiled elevation source myScene.BaseSurface = mySurface; // Create camera with an initial camera position (Mount Everest in the Alps mountains) Camera myCamera = new Camera(28.4, 83.9, 10010.0, 10.0, 80.0, 300.0); // Set the scene view's camera position MySceneView.SetViewpointCameraAsync(myCamera); }
private void MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e) { MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged; try { // Set initial viewpoint MySceneView.SetView( new Camera( new MapPoint(-106.882128302391, 38.7658957449754, 12994.1727461051, SpatialReferences.Wgs84), 358.607816178049, 70.0562968167998)); } catch (Exception ex) { MessageBox.Show("Error occured while setting initial viewpoint", "An error occured"); Debug.WriteLine(ex.ToString()); } }
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 void Initialize() { // Create the scene with a basemap. MySceneView.Scene = new Scene(Basemap.CreateImagery()); // Add an elevation source to the scene. Surface elevationSurface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(new Uri(_elevationServiceUrl)); elevationSurface.ElevationSources.Add(elevationSource); MySceneView.Scene.BaseSurface = elevationSurface; // Set the initial viewpoint. Camera initialCamera = new Camera(64.416919, -14.483728, 100, 318, 105, 0); MySceneView.SetViewpointCamera(initialCamera); // Configure the picker. AtmosphereEffectPicker.ItemsSource = new [] { "Realistic", "Horizon only", "None" }; AtmosphereEffectPicker.SelectedIndex = 1; // Apply the selected atmosphere effect option. AtmosphereEffectPicker.SelectedIndexChanged += (o, e) => { switch (AtmosphereEffectPicker.SelectedIndex) { case 0: MySceneView.AtmosphereEffect = AtmosphereEffect.Realistic; break; case 1: MySceneView.AtmosphereEffect = AtmosphereEffect.HorizonOnly; break; case 2: MySceneView.AtmosphereEffect = AtmosphereEffect.None; break; } }; }
private async void Initialize() { // Create new Scene. Scene myScene = new Scene { Basemap = Basemap.CreateImagery() }; // Create and add an elevation source for the Scene. ArcGISTiledElevationSource elevationSrc = new ArcGISTiledElevationSource(_elevationSourceUrl); myScene.BaseSurface.ElevationSources.Add(elevationSrc); // Create new scene layer from the URL. ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(_serviceUri); // Add created layer to the operational layers collection. myScene.OperationalLayers.Add(sceneLayer); try { // Load the layer. await sceneLayer.LoadAsync(); // Get the center of the scene layer. MapPoint center = (MapPoint)GeometryEngine.Project(sceneLayer.FullExtent.GetCenter(), SpatialReferences.Wgs84); // Create a camera with coordinates showing layer data. Camera camera = new Camera(center.Y, center.X, 225, 220, 80, 0); // Assign the Scene to the SceneView. MySceneView.Scene = myScene; // Set view point of scene view using camera. await MySceneView.SetViewpointCameraAsync(camera); } catch (Exception e) { await new MessageDialog2(e.ToString(), "Error").ShowAsync(); } }
private void Initialize() { // Set up the scene with an imagery basemap. MySceneView.Scene = new Scene(Basemap.CreateImagery()); // Set the initial viewpoint for the scene. MapPoint point = new MapPoint(83.9, 28.4, 1000, SpatialReferences.Wgs84); Camera initialCamera = new Camera(point, 1000, 0, 50, 0); MySceneView.SetViewpointCamera(initialCamera); // Create a graphics overlay. GraphicsOverlay overlay = new GraphicsOverlay(); overlay.SceneProperties.SurfacePlacement = SurfacePlacement.Relative; MySceneView.GraphicsOverlays.Add(overlay); // Add a renderer using rotation expressions. SimpleRenderer renderer = new SimpleRenderer(); renderer.SceneProperties.HeadingExpression = "[HEADING]"; renderer.SceneProperties.PitchExpression = "[PITCH]"; // Apply the renderer to the graphics overlay. overlay.Renderer = renderer; // Create a red cone graphic. SimpleMarkerSceneSymbol coneSymbol = SimpleMarkerSceneSymbol.CreateCone(Color.Red, 100, 100); coneSymbol.Pitch = -90; MapPoint conePoint = new MapPoint(83.9, 28.41, 200, SpatialReferences.Wgs84); Graphic cone = new Graphic(conePoint, coneSymbol); // Add the cone graphic to the overlay. overlay.Graphics.Add(cone); // Listen for changes in slider values and update graphic properties. HeadingSlider.ValueChanged += (sender, e) => { cone.Attributes["HEADING"] = HeadingSlider.Value; }; PitchSlider.ValueChanged += (sender, e) => { cone.Attributes["PITCH"] = PitchSlider.Value; }; }
private async Task AddModelMarkerSymbol() { // Instantiate a new ModelMarkerSymbol ModelMarkerSymbol modelMarkerSymbol = new ModelMarkerSymbol(); // Set the SourceUri property modelMarkerSymbol.SourceUri = Path.Combine(AssemblyDirectory, @"Samples\Scene\PT-Boat-Model\PTBoat.obj"); // Increase the scale to achieve the desired visual size modelMarkerSymbol.Scale = 50; // Create a new MapPoint for the location MapPoint mapPoint = new MapPoint(-155, 19, -100); // Create a new Graphic to display the model symbol Graphic graphic = new Graphic(mapPoint); // Set the Graphic Symbol property graphic.Symbol = modelMarkerSymbol; // Create a GraphicsOverlay to contain the symbolized Graphic GraphicsOverlay graphicsoverlay = new GraphicsOverlay() { RenderingMode = GraphicsRenderingMode.Dynamic, SceneProperties = new LayerSceneProperties() { SurfacePlacement = SurfacePlacement.Relative } }; // Add the Graphic to the GraphicsOverlay graphicsoverlay.Graphics.Add(graphic); // Add the GraphicsOverlay to the MapView's GraphicsOverlays collection MySceneView.GraphicsOverlays.Add(graphicsoverlay); // Set the Viewpoint await MySceneView.SetViewAsync(new Camera(mapPoint.Y - 0.5, mapPoint.X + 0.5, 25000, 315, 70)); }
private void Initialize() { // Create the scene with a basemap. MySceneView.Scene = new Scene(BasemapStyle.ArcGISImageryStandard); // Add an elevation source to the scene. Surface elevationSurface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(new Uri(_elevationServiceUrl)); elevationSurface.ElevationSources.Add(elevationSource); MySceneView.Scene.BaseSurface = elevationSurface; // Set the initial viewpoint. Camera initialCamera = new Camera(64.416919, -14.483728, 100, 318, 105, 0); MySceneView.SetViewpointCamera(initialCamera); // Apply the selected atmosphere effect option. RealisticOption.Selected += (sender, e) => MySceneView.AtmosphereEffect = AtmosphereEffect.Realistic; HorizonOnlyOption.Selected += (sender, e) => MySceneView.AtmosphereEffect = AtmosphereEffect.HorizonOnly; NoneOption.Selected += (sender, e) => MySceneView.AtmosphereEffect = AtmosphereEffect.None; }
private async void LayerPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Clear existing layers. MySceneView.Scene.OperationalLayers.Clear(); // Get the name of the selected layer. string name = e.AddedItems[0].ToString(); // 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)); }
private async void CreateFeatureLayers() { try { var geodatabase = await Geodatabase.OpenAsync(GeodatabasePath); Envelope extent = null; foreach (var table in geodatabase.FeatureTables) { var featureLayer = new FeatureLayer() { ID = table.Name, DisplayName = table.Name, FeatureTable = table }; if (!Geometry.IsNullOrEmpty(table.ServiceInfo.Extent)) { if (Geometry.IsNullOrEmpty(extent)) { extent = table.ServiceInfo.Extent; } else { extent = extent.Union(table.ServiceInfo.Extent); } } MySceneView.Scene.Layers.Add(featureLayer); } await MySceneView.SetViewAsync(new Camera(new MapPoint(-99.343, 26.143, 5881928.401), 2.377, 10.982)); } catch (Exception ex) { MessageBox.Show("Error creating feature layer: " + ex.Message, "Samples"); } }
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 MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e) { MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged; try { // Set camera and navigate to it var viewpoint = new Camera( new MapPoint( -122.41213238640989, 37.78073901800655, 80.497554714791477), 53.719780233659428, 73.16171159612496); await MySceneView.SetViewAsync(viewpoint, 1, true); } catch (Exception ex) { MessageBox.Show("Error occured while navigating to the target viewpoint", "An error occured"); Debug.WriteLine(ex.ToString()); } }
private void addGraphics() { //var camera = new Camera(28.4, 83, 20000, 10, 70, 300) //var x = camera.Location.X - 0.01; //var y = camera.Location.Y- 0.25; var type = new ViewpointType(); var extent = MySceneView.GetCurrentViewpoint(type).TargetGeometry.Extent; var x = extent.XMin - 0.01; var y = extent.YMax + 0.25; for (int i = 0; i < 6; i++) { for (int j = 0; j < 4; j++) { double valueX = x + i * (squareSize + spacing); double valueY = y + j * (squareSize + spacing); MapPoint mapPoint = new MapPoint(valueX, valueY); Geometry polygon = polygonForStartingPoint(mapPoint); addGraphicsForPolygon(polygon); } } }
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"); } }
public MyMapView() { InitializeComponent(); // Create a scene with elevation. Surface sceneSurface = new Surface(); sceneSurface.ElevationSources.Add(new ArcGISTiledElevationSource(_worldElevationService)); Scene myScene = new Scene(Basemap.CreateImagery()) { BaseSurface = sceneSurface }; // Create and add a building layer. ArcGISSceneLayer buildingsLayer = new ArcGISSceneLayer(_buildingService); myScene.OperationalLayers.Add(buildingsLayer); // Create and add an analysis overlay. AnalysisOverlay measureAnalysisOverlay = new AnalysisOverlay(); MySceneView.AnalysisOverlays.Add(measureAnalysisOverlay); //SpatialReference spref = new SpatialReference(26717); // NAD_1927_UTM_Zone_17N MapPoint baseMapPoint1 = new MapPoint(25.905114, -80.767646, SpatialReferences.WebMercator); MapPoint start = new MapPoint(-4.494677, 48.384472, 24.772694, SpatialReferences.Wgs84); double latitude = double.Parse("50.250000"); // No difference if values are between 19.75N and 50.25N double longitude = double.Parse("-81.000000"); // 81.0W is the central meridian for UTM 17N SpatialReference spref = new SpatialReference(26717); // NAD_1927_UTM_Zone_17N MapPoint baseMapPoint = new MapPoint(longitude, latitude, SpatialReferences.Wgs84); MapPoint mapPoint1 = GeometryEngine.Project(baseMapPoint, spref) as MapPoint; MySceneView.SetViewpointCamera(new Camera(baseMapPoint1, 200, 0, 45, 0)); // Show the scene in the view. MySceneView.Scene = myScene; }
private async void Initialize() { // Create a new Scene with an imagery basemap. Scene scene = new Scene(BasemapStyle.ArcGISImageryStandard); // Add a base surface with elevation data. Surface elevationSurface = new Surface(); Uri elevationService = new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"); elevationSurface.ElevationSources.Add(new ArcGISTiledElevationSource(elevationService)); scene.BaseSurface = elevationSurface; // Add a scene layer. Uri buildingsService = new Uri("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Berlin/SceneServer"); ArcGISSceneLayer buildingsLayer = new ArcGISSceneLayer(buildingsService); scene.OperationalLayers.Add(buildingsLayer); // Assign the Scene to the SceneView. MySceneView.Scene = scene; try { // Create a camera with an interesting view. await buildingsLayer.LoadAsync(); MapPoint center = (MapPoint)GeometryEngine.Project(buildingsLayer.FullExtent.GetCenter(), SpatialReferences.Wgs84); Camera viewCamera = new Camera(center.Y, center.X, 600, 120, 60, 0); // Set the viewpoint with the camera. MySceneView.SetViewpointCamera(viewCamera); } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }
private async Task QueryElevation(MapPoint location) { if (MySceneView.GetCurrentViewpoint(ViewpointType.BoundingGeometry) == null) { return; } if (!_isSceneReady) { return; } try { _isSceneReady = false; double elevation = await _fileElevationSource.GetElevationAsync(location); if (elevation.ToString() == "NaN") { mapTip.Visibility = System.Windows.Visibility.Hidden; return; } MapView.SetViewOverlayAnchor(mapTip, location); mapTip.Visibility = System.Windows.Visibility.Visible; txtElevation.Text = String.Format("Elevation: {0} meters", elevation.ToString()); } catch (Exception ex) { MessageBox.Show("Error retrieving elevation values: " + ex.Message, "Sample Error"); } finally { _isSceneReady = true; } }
private async void Initialize() { // Create the layers. ArcGISSceneLayer devOne = new ArcGISSceneLayer(new Uri("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/DevA_Trees/SceneServer")); FeatureLayer devTwo = new FeatureLayer(new Uri("https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/DevA_Pathways/FeatureServer/1")); ArcGISSceneLayer devThree = new ArcGISSceneLayer(new Uri("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/DevB_BuildingShells/SceneServer")); ArcGISSceneLayer nonDevOne = new ArcGISSceneLayer(new Uri("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/DevA_BuildingShells/SceneServer")); FeatureLayer nonDevTwo = new FeatureLayer(new Uri("https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/DevelopmentProjectArea/FeatureServer/0")); // Create the group layer and add sublayers. GroupLayer gLayer = new GroupLayer(); gLayer.Name = "Group: Dev A"; gLayer.Layers.Add(devOne); gLayer.Layers.Add(devTwo); gLayer.Layers.Add(devThree); // Create the scene with a basemap. MySceneView.Scene = new Scene(BasemapStyle.ArcGISImageryStandard); // Add the top-level layers to the scene. MySceneView.Scene.OperationalLayers.Add(gLayer); MySceneView.Scene.OperationalLayers.Add(nonDevOne); MySceneView.Scene.OperationalLayers.Add(nonDevTwo); // Wait for all of the layers in the group layer to load. await Task.WhenAll(gLayer.Layers.ToList().Select(m => m.LoadAsync()).ToList()); // Zoom to the extent of the group layer. MySceneView.SetViewpoint(new Viewpoint(gLayer.FullExtent)); // Add the layer list to the UI. foreach (Layer layer in MySceneView.Scene.OperationalLayers) { AddLayersToUI(layer); } }
private void MySceneViewOnMouseMove(object sender, MouseEventArgs mouseEventArgs) { // Get the mouse position. Point cursorSceenPoint = mouseEventArgs.GetPosition(MySceneView); // Get the corresponding MapPoint. MapPoint onMapLocation = MySceneView.ScreenToBaseSurface(cursorSceenPoint); // Return if the MapPoint is null. This might happen if mouse leaves SceneView area. if (onMapLocation == null) { return; } // Adjust the Z value of the MapPoint to reflect the selected height. onMapLocation = new MapPoint(onMapLocation.X, onMapLocation.Y, onMapLocation.Z + _viewHeight); // Update the viewshed. _viewshed.Location = onMapLocation; // Update the viewpoint symbol. _viewpointOverlay.Graphics.Clear(); _viewpointOverlay.Graphics.Add(new Graphic(onMapLocation, _viewpointSymbol)); }
private void Initialize() { // Create new Scene. Scene myScene = new Scene { // Set the Scene's basemap property. Basemap = new Basemap(BasemapStyle.ArcGISImageryStandard) }; // Create a camera with coordinates showing layer data. Camera camera = new Camera(48.389124348393182, -4.4595173327138591, 140, 322, 74, 0); // Assign the Scene to the SceneView. MySceneView.Scene = myScene; // Create ElevationSource from elevation data Uri. ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource( new Uri("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")); // Create scene layer from the Brest, France scene server. var sceneLayer = new ArcGISSceneLayer(new Uri("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Brest/SceneServer")); MySceneView.Scene.OperationalLayers.Add(sceneLayer); // Add elevationSource to BaseSurface's ElevationSources. MySceneView.Scene.BaseSurface.ElevationSources.Add(elevationSource); // Set view point of scene view using camera. MySceneView.SetViewpointCameraAsync(camera); // Create overlays with elevation modes. _drapedBillboardedOverlay = new GraphicsOverlay(); _drapedBillboardedOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.DrapedBillboarded; MySceneView.GraphicsOverlays.Add(_drapedBillboardedOverlay); _drapedFlatOverlay = new GraphicsOverlay(); _drapedFlatOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.DrapedFlat; GraphicsOverlay relativeToSceneOverlay = new GraphicsOverlay(); relativeToSceneOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.RelativeToScene; MySceneView.GraphicsOverlays.Add(relativeToSceneOverlay); GraphicsOverlay relativeToSurfaceOverlay = new GraphicsOverlay(); relativeToSurfaceOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Relative; MySceneView.GraphicsOverlays.Add(relativeToSurfaceOverlay); GraphicsOverlay absoluteOverlay = new GraphicsOverlay(); absoluteOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Absolute; MySceneView.GraphicsOverlays.Add(absoluteOverlay); // Create point for graphic location. MapPoint sceneRelatedPoint = new MapPoint(-4.4610562, 48.3902727, 70, camera.Location.SpatialReference); MapPoint surfaceRelatedPoint = new MapPoint(-4.4609257, 48.3903965, 70, camera.Location.SpatialReference); // Create a red triangle symbol. var triangleSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Triangle, Color.FromArgb(255, 255, 0, 0), 10); // Create a text symbol for each elevation mode. TextSymbol drapedBillboardedText = new TextSymbol("DRAPED BILLBOARDED", Color.FromArgb(255, 0, 0, 255), 10, Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Center, Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle); drapedBillboardedText.OffsetY += 20; TextSymbol drapedFlatText = new TextSymbol("DRAPED FLAT", Color.FromArgb(255, 0, 0, 255), 10, Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Center, Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle); drapedFlatText.OffsetY += 20; TextSymbol relativeToSurfaceText = new TextSymbol("RELATIVE TO SURFACE", Color.FromArgb(255, 0, 0, 255), 10, Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Center, Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle); relativeToSurfaceText.OffsetY += 20; TextSymbol relativeToSceneText = new TextSymbol("RELATIVE TO SCENE", Color.FromArgb(255, 0, 0, 255), 10, Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Center, Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle); relativeToSceneText.OffsetY -= 20; TextSymbol absoluteText = new TextSymbol("ABSOLUTE", Color.FromArgb(255, 0, 0, 255), 10, Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Center, Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle); absoluteText.OffsetY += 20; // Add the point graphic and text graphic to the corresponding graphics overlay. _drapedBillboardedOverlay.Graphics.Add(new Graphic(surfaceRelatedPoint, triangleSymbol)); _drapedBillboardedOverlay.Graphics.Add(new Graphic(surfaceRelatedPoint, drapedBillboardedText)); _drapedFlatOverlay.Graphics.Add(new Graphic(surfaceRelatedPoint, triangleSymbol)); _drapedFlatOverlay.Graphics.Add(new Graphic(surfaceRelatedPoint, drapedFlatText)); relativeToSceneOverlay.Graphics.Add(new Graphic(sceneRelatedPoint, triangleSymbol)); relativeToSceneOverlay.Graphics.Add(new Graphic(sceneRelatedPoint, relativeToSceneText)); relativeToSurfaceOverlay.Graphics.Add(new Graphic(surfaceRelatedPoint, triangleSymbol)); relativeToSurfaceOverlay.Graphics.Add(new Graphic(surfaceRelatedPoint, relativeToSurfaceText)); absoluteOverlay.Graphics.Add(new Graphic(surfaceRelatedPoint, triangleSymbol)); absoluteOverlay.Graphics.Add(new Graphic(surfaceRelatedPoint, absoluteText)); }
private void Initialize() { // Create new Scene Scene myScene = new Scene(); // Set Scene's base map property myScene.Basemap = Basemap.CreateImagery(); // Create a camera with coordinates showing layer data Camera camera = new Camera(53.04, -4.04, 1300, 0, 90.0, 0); // Assign the Scene to the SceneView MySceneView.Scene = myScene; // Create ElevationSource from elevation data Uri ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource( new Uri("http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")); // Add elevationSource to BaseSurface's ElevationSources MySceneView.Scene.BaseSurface.ElevationSources.Add(elevationSource); // Set view point of scene view using camera MySceneView.SetViewpointCameraAsync(camera); // Create overlays with elevation modes GraphicsOverlay drapedOverlay = new GraphicsOverlay(); drapedOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Draped; MySceneView.GraphicsOverlays.Add(drapedOverlay); GraphicsOverlay relativeOverlay = new GraphicsOverlay(); relativeOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Relative; MySceneView.GraphicsOverlays.Add(relativeOverlay); GraphicsOverlay absoluteOverlay = new GraphicsOverlay(); absoluteOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Absolute; MySceneView.GraphicsOverlays.Add(absoluteOverlay); // Create point for graphic location MapPoint point = new MapPoint(-4.04, 53.06, 1000, camera.Location.SpatialReference); // Create a red circle symbol SimpleMarkerSymbol circleSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.FromArgb(255, 255, 0, 0), 10); // Create a text symbol for each elevation mode TextSymbol drapedText = new TextSymbol("DRAPED", Color.FromArgb(255, 255, 255, 255), 10, Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Left, Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle); TextSymbol relativeText = new TextSymbol("RELATIVE", Color.FromArgb(255, 255, 255, 255), 10, Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Left, Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle); TextSymbol absoluteText = new TextSymbol("ABSOLUTE", Color.FromArgb(255, 255, 255, 255), 10, Esri.ArcGISRuntime.Symbology.HorizontalAlignment.Left, Esri.ArcGISRuntime.Symbology.VerticalAlignment.Middle); // Add the point graphic and text graphic to the corresponding graphics overlay drapedOverlay.Graphics.Add(new Graphic(point, circleSymbol)); drapedOverlay.Graphics.Add(new Graphic(point, drapedText)); relativeOverlay.Graphics.Add(new Graphic(point, circleSymbol)); relativeOverlay.Graphics.Add(new Graphic(point, relativeText)); absoluteOverlay.Graphics.Add(new Graphic(point, circleSymbol)); absoluteOverlay.Graphics.Add(new Graphic(point, absoluteText)); }
private void Initialize() { // Create a scene with elevation. Surface sceneSurface = new Surface(); sceneSurface.ElevationSources.Add(new ArcGISTiledElevationSource(_worldElevationService)); Scene myScene = new Scene(Basemap.CreateImagery()) { BaseSurface = sceneSurface }; // Create and add a building layer. ArcGISSceneLayer buildingsLayer = new ArcGISSceneLayer(_buildingService); myScene.OperationalLayers.Add(buildingsLayer); // Create and add an analysis overlay. AnalysisOverlay measureAnalysisOverlay = new AnalysisOverlay(); MySceneView.AnalysisOverlays.Add(measureAnalysisOverlay); // Create an initial distance measurement and show it. MapPoint start = new MapPoint(-4.494677, 48.384472, 24.772694, SpatialReferences.Wgs84); MapPoint end = new MapPoint(-4.495646, 48.384377, 58.501115, SpatialReferences.Wgs84); _distanceMeasurement = new LocationDistanceMeasurement(start, end); measureAnalysisOverlay.Analyses.Add(_distanceMeasurement); // Keep the UI updated. _distanceMeasurement.MeasurementChanged += (o, e) => { // This is needed because measurement change events occur on a non-UI thread and this code accesses UI object. Device.BeginInvokeOnMainThread(() => { // Update the labels with new values in the format {value} {unit system}. DirectMeasureLabel.Text = $"{_distanceMeasurement.DirectDistance.Value:F} {_distanceMeasurement.DirectDistance.Unit.Abbreviation}"; VerticalMeasureLabel.Text = $"{_distanceMeasurement.VerticalDistance.Value:F} {_distanceMeasurement.VerticalDistance.Unit.Abbreviation}"; HorizontalMeasureLabel.Text = $"{_distanceMeasurement.HorizontalDistance.Value:F} {_distanceMeasurement.HorizontalDistance.Unit.Abbreviation}"; }); }; // Configure the unit system selection box. UnitSystemCombo.ItemsSource = Enum.GetValues(typeof(UnitSystem)); UnitSystemCombo.SelectedItem = _distanceMeasurement.UnitSystem; // Update the unit system selection. UnitSystemCombo.SelectedIndexChanged += (sender, args) => { _distanceMeasurement.UnitSystem = (UnitSystem)UnitSystemCombo.SelectedItem; }; // Show the scene in the view. MySceneView.Scene = myScene; MySceneView.SetViewpointCamera(new Camera(start, 200, 0, 45, 0)); // Subscribe to tap events to enable updating the measurement. MySceneView.GeoViewTapped += MySceneView_GeoViewTapped; }
private void Initialize() { _viewHeight = HeightSlider.Value; // Create the scene with the imagery basemap. Scene myScene = new Scene(Basemap.CreateImagery()); MySceneView.Scene = myScene; // Add the surface elevation. Surface mySurface = new Surface(); mySurface.ElevationSources.Add(new ArcGISTiledElevationSource(_localElevationImageService)); myScene.BaseSurface = mySurface; // Add the scene layer. ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(_buildingsUrl); myScene.OperationalLayers.Add(sceneLayer); // Create the MapPoint representing the initial location. MapPoint initialLocation = new MapPoint(-4.5, 48.4, 46 + _viewHeight); // Create the location viewshed analysis. _viewshed = new LocationViewshed( initialLocation, HeadingSlider.Value, PitchSlider.Value, HorizontalAngleSlider.Value, VerticalAngleSlider.Value, MinimumDistanceSlider.Value, MaximumDistanceSlider.Value); // Create a camera based on the initial location. Camera camera = new Camera(initialLocation, 200.0, 20.0, 70.0, 0.0); // Create a symbol for the viewpoint. _viewpointSymbol = SimpleMarkerSceneSymbol.CreateSphere(Color.Blue, 10, SceneSymbolAnchorPosition.Center); // Add the symbol to the viewpoint overlay. _viewpointOverlay = new GraphicsOverlay(); _viewpointOverlay.SceneProperties = new LayerSceneProperties(SurfacePlacement.Absolute); _viewpointOverlay.Graphics.Add(new Graphic(initialLocation, _viewpointSymbol)); // Apply the camera to the scene view. MySceneView.SetViewpointCamera(camera); // Create an analysis overlay for showing the viewshed analysis. _analysisOverlay = new AnalysisOverlay(); // Add the viewshed analysis to the overlay. _analysisOverlay.Analyses.Add(_viewshed); // Add the analysis overlay to the SceneView. MySceneView.AnalysisOverlays.Add(_analysisOverlay); // Add the graphics overlay MySceneView.GraphicsOverlays.Add(_viewpointOverlay); // Update the frustum outline Color. // The frustum outline shows the volume in which the viewshed analysis is performed. Viewshed.FrustumOutlineColor = Color.Blue; // Subscribe to tap events. This enables the 'pick up' and 'drop' workflow for moving the viewpoint. MySceneView.GeoViewTapped += MySceneViewOnGeoViewTapped; }
public async void Initialize() { await MySceneView.SetViewAsync(new Camera(new MapPoint(-99.343, 26.143, 5881928.401), 2.377, 10.982)); }
public async void Initialize() { await MySceneView.SetViewAsync(new Camera(new MapPoint(-116.799471, 34.039555, 12819.401), 0, 40.49)); }