Parameters
- uri
- A System.Uri represents the path or url to a dataset or .lyrx or .lpkx file.
Some sample paths to:
A FeatureClass in a FileGeodatabase | C:\Data\MyFileGDB.gdb\Census |
A shape file in a folder | \\Machine\SharedFolder\MySpatialData.dbf |
A RasterDataset in a FileGeodatabase | C:\Data\MyFileGDB.gdb\DEM |
A FeatureClass from a SDE | C:\Connections\MySDEConnection.sde\Roads |
An image file in a folder | \\Machine\SharedFolder\Imagery.tif |
A .lyrx or .lpkx file | \\Machine\SharedFolder\Fires.lyrx |
A map service layer | http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer |
A feature layer off a map or feature service | http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0 |
var sceneLayerUrl = @"https://myportal.com/server/rest/services/Hosted/SceneLayerServiceName/SceneServer"; //portal items also ok as long as the portal is the current active portal... //var sceneLayerUrl = @"https://myportal.com/home/item.html?id=123456789abcdef1234567890abcdef0"; await QueuedTask.Run(() => { //Create with initial visibility set to false. Add to current scene var createparams = new LayerCreationParams(new Uri(sceneLayerUrl, UriKind.Absolute)) { IsVisible = false }; //cast to specific type of scene layer being created - in this case FeatureSceneLayer var sceneLayer = LayerFactory.Instance.CreateLayer<Layer>( createparams, MapView.Active.Map) as FeatureSceneLayer; //or...specify the cast directly var sceneLayer2 = LayerFactory.Instance.CreateLayer<FeatureSceneLayer>( createparams, MapView.Active.Map); //ditto for BuildingSceneLayer, PointCloudSceneLayer, IntegratedMeshSceneLayer //... });
Target Platforms: Windows 11, Windows 10