Connect to feature layer in SDE server

637
1
02-16-2017 12:08 PM
JoshuaTharp
New Contributor II

We have a requirement to be able to connect to a feature layer hosted in enterprise SDE server.

The user will load the layer on demand.

There is some documentation on connecting to SDE layers but not really.

WorkspaceInfo.CreateSDEConnection Method (String, String) 

How can we do this?

I did find this post:

ArcSDE and Runtime 10.1.1 

Where they tried to connect but were not successful.

The example code in the above link is:

```

  1. final WorkspaceInfo info = WorkspaceInfo.CreateSDEConnection("test", "feature.sde");  
  2.   
  3. // try to create a new feature service using the blank map pack  
  4. final LocalFeatureService lfs = new LocalFeatureService("mpk_blank.mpk");  
  5. lfs.getDynamicWorkspaces().add(info);  
  6. lfs.start();  
  7.   
  8. // create a feature layer using the local service  
  9. final ArcGISFeatureLayer layer = new ArcGISFeatureLayer(lfs.getUrlFeatureService());  

```

But it does not show how to specify a layer to display.

I don't need write access to the layer just read access.

Creating a MPK file and adding it there is not sufficient.

Just need a example to provide a absolute path to a sde layer and add to the map.

0 Kudos
1 Reply
MichaelBranscomb
Esri Frequent Contributor

Hi,

To connect to data in an enterprise geodatabase (previously ArcSDE) we recommend you publish the feature classes / tables within a feature service. If you want something really adhoc (and read-only), then it is possible via the Local Server component of ArcGIS Runtime (which is where the code above comes in). The "DynamicLayer" capability of the MapServer endpoint for both ArcGIS Enterprise and the ArcGIS Runtime Local Server allows you to completely customize the contents of a map service, including connecting to feature classes / tables in an enterprise geodatabase. (for more info see ArcGIS REST API).

The API types to do that are available in 10.2.7 but not currently in v100.0, although they are on the roadmap for the next release. Note that use of the Local Server may necessitate additional licensing depending on what other functionality you already use (for more info see License your app—ArcGIS Runtime SDK for .NET | ArcGIS for Developers).

Cheers

Mike

0 Kudos