Open my remote geodatabse and load its tables

813
3
06-13-2017 08:04 AM
ManelKEDDAR
New Contributor III

Hello every one,

Please this is emergency , i realy need your help

I am a new in using arcGis runtime technologies , and i need to open a remote geodatabase not a local so i can load it's feature table and add on it a 3D cone geometry already created on my scenview , and i looked at all the document (API References but still didn't find a solution since i do have only .SDE file for connection to my data base and .MPK file any one can help me please , thanks in advance

Tags (1)
0 Kudos
3 Replies
dotMorten_esri
Esri Notable Contributor

Before you access this data, you should publish your SDE data / MPK using ArcGIS Server.

ArcGIS Runtime can then talk directly to the services exposed by ArcGIS Server, and you'd typically use FeatureLayer / FeatureServiceTable to do that, by pointing to the URL of the services you published on your server.

ArcGIS Runtime can't directly talk to SDE databases or load MPK files. You can author "Mobile Map Packages" (MMPK) in ArcGIS Pro, which you can use directly from Runtime, but note these still won't support SDE, since all the data gets packaged into these MMPK files.

ManelKEDDAR
New Contributor III

Hello Morten Nielsen ,

Thanks for your answer , i actually get what you suggest to me but still don't know how to do it since i don't find the right code , here is what i 'm trying to do 

private Esri.ArcGISRuntime.Geometry.Geometry createCone3D()
{
var location = new MapPoint(-4.04, 70, 1000, SpatialReferences.Wgs84);
var coneSymbole = new SimpleMarkerSceneSymbol
{
Style = SimpleMarkerSceneSymbolStyle.Cone,
Color = Colors.Yellow,
Height = 3000,
Width = 1000,
Depth = 3000,

AnchorPosition = SceneSymbolAnchorPosition.Bottom

};
var coneGraphic = new Graphic(location, coneSymbole);
var geom = coneGraphic.Geometry;
MySceneView.GraphicsOverlays[1].Graphics.Add(coneGraphic);
return geom;
}

private Esri.ArcGISRuntime.LocalServices.LocalServer _localServer;

private async void StartLocalServer()
{
//get the singleton LocalServer object using the static instance property
_localServer = Esri.ArcGISRuntime.LocalServices.LocalServer.Instance;

//Handle the statusChanged event to react when the server is started

_localServer.StatusChanged += ServerStatusChanged;

//Start the local server instance


await _localServer.StartAsync();

}

private async void ServerStatusChanged(object sender , Esri.ArcGISRuntime.LocalServices.StatusChangedEventArgs e)
{

//Check if the server started successfully
if(e.Status == Esri.ArcGISRuntime.LocalServices.LocalServerStatus.Started)
{
//Create a local feature service from a map package on disk

LocalFeatureService featureService = new LocalFeatureService(@"C:\Users\mkeddar\Documents\ArcGIS\Test3.mpk");

//Handle the status changed event to check when it's loaded

featureService.StatusChanged += async (svc, args) =>
{
//If started successfully , add a layer from the service
if (args.Status == LocalServerStatus.Started)
{
//Get the service URL
var featureServiceUrl = (svc as LocalFeatureService).Url.AbsoluteUri;
//Create a new service feature table
ServiceFeatureTable localServiceTable = new ServiceFeatureTable(new Uri(featureServiceUrl + "/2"));
//Create a new feature layer to display the features in the table
FeatureLayer featureLyr = new FeatureLayer(localServiceTable);

var attribute = new Dictionary<String, object>();
attribute.Add("description", "description");

var geomCone = createCone3D();

//create a new feature
var newFeature = localServiceTable.CreateFeature(attribute,geomCone); // here i don't know what to guive as parameters so i create a feature
//from my geometry geomCone
//add the new feature
await localServiceTable.AddFeatureAsync(newFeature);
//push this update (apply edits) to the feature service

IReadOnlyList<EditResult> editResults = await localServiceTable.ApplyEditsAsync();
//check the results for errors

foreach(var r in editResults)
{
if (r.CompletedWithErrors)
{
Console.WriteLine("Edit ti Object" + "'failed'" + r.Error.Message);
}
}


}


};

//Start the local feature service
await featureService.StartAsync();


}

}

so my Questions are :1-How i can create the feature using my geometry 2-do i have to load my table using its name(Test) ? , cause what if i have many tables(many featureLayers) how to point on a a specific table.

When i run my project i have this pretty error that occurs  {"Failed to create service test MapServer. Service failed to initialize: The map package is not supported by the ArcGIS Runtime. There is no .msd file available inside the package. Check that it was authored with ArcGIS Runtime support enabled."} knowing that i have a geodatabase that contains two tables test:(objectID and shape :geometry ) and essai(objectID , shape) AND  i have generated .MPK file  can you help me please thanks advanced

0 Kudos
ManelKEDDAR
New Contributor III

Found the problem for the .MSD but now i have this error :

{"Failed to create service test3 MapServer. Service failed to initialize: Feature service creation failed. hr=0x80040067 No Layer or Table was initialized."} 

0 Kudos