Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for .NET

3D ArcGIS Dynamic Map Service Layer

Download Samples Repository

Description

Demonstrates adding an 2d ArcGIS dynamic map service to a Scene in XAML.

"Desktop" Available for Desktop

Sample Code

<UserControl 
	x:Class="ArcGISRuntime.Samples.Desktop.ArcGISDynamicMapServiceLayerSample3d"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
	mc:Ignorable="d" 
	d:DesignHeight="300" d:DesignWidth="300">
	<Grid>
		<esri:SceneView x:Name="MySceneView">
			<esri:Scene>
				<esri:ArcGISTiledMapServiceLayer ID="Imagery"
					ServiceUri="http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer" />
				<esri:ArcGISDynamicMapServiceLayer 
					ServiceUri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer"/>
			</esri:Scene>
		</esri:SceneView>
	</Grid>
</UserControl>
using Esri.ArcGISRuntime.Controls;
using Esri.ArcGISRuntime.Geometry;
using System;
using System.Diagnostics;
using System.Windows;

namespace ArcGISRuntime.Samples.Desktop
{
	/// <summary>
	/// Demonstrates adding an 2d ArcGIS dynamic map service to a Scene in XAML.
	/// </summary>
	/// <title>3D ArcGIS Dynamic Map Service Layer</title>
	/// <category>Scene</category>
	/// <subcategory>Layers</subcategory>
	public partial class ArcGISDynamicMapServiceLayerSample3d
	{
		public ArcGISDynamicMapServiceLayerSample3d()
		{
			InitializeComponent();
			MySceneView.SpatialReferenceChanged += MySceneView_SpatialReferenceChanged;
		}

		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());
			}
		}
	}
}
Feedback on this topic?