AnsweredAssumed Answered

Which local service layer we can use to load a sceneLayer

Question asked by ManelKeddar on Aug 25, 2017
Latest reply on Sep 13, 2017 by ManelKeddar

hello ;

for displaying featureLayers as feature Tables we use ServiceFeatureTable , i'm trying to edit a sceneLayer with creating 3D geometry but i don't know how to load the table for example when i work with feature layers and 2D Features  i use the following code :

 

ar featureTableUri = new System.Uri(" URI");
var table = new ServiceFeatureTable(featureTableUri);
await table.LoadAsync();
var layer = new FeatureLayer(table); 

MyMapView.Map = new Map();
MyMapView.Map.OperationalLayers.Add(layer);
var builder = new PolygonBuilder(SpatialReference.Create(2154));

var partOne = new Part(builder.SpatialReference);
//add a line segment going from (0,0) to (0,7)
partOne.Add(new Esri.ArcGISRuntime.Geometry.LineSegment(0,1670.82, 1500, 1400));
//add an other segment from (0,7) to (3,6)
partOne.Add(new Esri.ArcGISRuntime.Geometry.LineSegment(new MapPoint(1500,1400), new MapPoint(1300, 1200)));
builder.AddPart(partOne);
Esri.ArcGISRuntime.Geometry.Polygon polyGeom = builder.ToGeometry();

var description = "description";
var attributes = new Dictionary<string, object>();
attributes.Add("SHAPE", polyGeom);
if (table.LoadStatus == Esri.ArcGISRuntime.LoadStatus.Loaded)
{

var template = table.FeatureTemplates.FirstOrDefault() ?? table.FeatureTypes.FirstOrDefault(t => t.Templates.Any())?.Templates?.FirstOrDefault();
// var couchesCarte = MyMapView.Map.OperationalLayers[0] as FeatureLayer;
// var selectedFeatures = await couchesCarte.GetSelectedFeaturesAsync();
var feature = table.CreateFeature(template,polyGeom);
await table.AddFeatureAsync(feature);
// push this update (apply edits) to the feature service
IReadOnlyList<EditResult> editResults = await table.ApplyEditsAsync();
// check the results for errors
foreach (var r in editResults)
{
if (r.CompletedWithErrors)
{
Console.WriteLine("Edit to Object '" + r.ObjectId + "' failed: " + r.Error.Message);
}
}
}

this code works perfectly , now i need to know what i should use in case that i have 3D features and a sceneLayers i have 3DFeature class with multipatch geometry and i have created with my own code a 3D cone (3D feature )(3D geometry ) and i have to add this geometry to my feature class till now i 'm using (.slpk) to load the URI of my sceneLayer i need to know how to edit my sceneLayer with creating a new 3D feature ?  

here's how i load my sceneLayer 

 

Uri sceneURI =new Uri(@"C:\Users\mkeddar\Documents\scene\scene3D.slpk");
ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(sceneURI);

MySceneView.Scene.OperationalLayers.Add(sceneLayer);
await sceneLayer.LoadAsync();

 

any one can show me how to do that 

thanks

Michael BranscombNagma YasminJennifer NeryMorten NielsenDan Patterson

Outcomes