How can I get a layer's DataSource properties.

1095
6
01-05-2012 02:20 PM
ESRICustomer
New Contributor III
I have some loaded layers in a map control, and I would like to get some information from these layers.

Do you know what classes/interfaces I need to use in order to get the information that is displayed in a layer properties Source tab. (See attached pic)

Keep in mind, these are ALREADY loaded layers. I'm not attempting nor able to load the layers myself and get the information at that point. (if that makes any difference)

I'm looking for the data for these items

  • Data Type:

  • Feature Class:

  • SERVER:

  • INSTANCE:

  • Location:

  • AUTHENTICATION_MODE:

  • VERSION:

I already have the information for

  • Feature Type

  • Geometry Type

0 Kudos
6 Replies
by Anonymous User
Not applicable
Just for reference, may be wrong

�?�Data Type: IFeatureLayer.DataSourceType
�?�Feature Class: IFeatureLayer.featureClass
�?�SERVER: IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("Server")
�?�INSTANCE:IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("Instance")
�?�Location:IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("database")
�?�AUTHENTICATION_MODE:IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("AUTHENTICATION_MODE")
�?�VERSION:IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("version")

Regards,

Bing
0 Kudos
ESRICustomer
New Contributor III
Just for reference, may be wrong

�?�Data Type: IFeatureLayer.DataSourceType
�?�Feature Class: IFeatureLayer.featureClass
�?�SERVER: IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("Server")
�?�INSTANCE:IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("Instance")
�?�Location:IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("database")
�?�AUTHENTICATION_MODE:IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("AUTHENTICATION_MODE")
�?�VERSION:IFeatureLayer.featureClass->Idataset->IpropertySet->GetProperty("version")

Regards,

Bing


Thanks a lot.  I'll try those and report back.
0 Kudos
AndyBridle
New Contributor
have you got a sample of this working? I'm trying to do exactly the same thing with some SDE layers in a map but hitting an error.

pfeatureclass = pfeaturelayer.FeatureClass
pdataset = pfeatureclass.FeatureDataset
MsgBox(pdataset.PropertySet.GetProperty("Server"))

pfeatureclass seems to be set okay but pdataset is always nothing which then causes the propertyset to fail
0 Kudos
sapnas
by
Occasional Contributor III
You can use  pfeatureclass.FeatureDataset if the feature class is stored inside feature dataset. if not use below statement to convert ifeatureclass to idataset and then get the connection properties.

IDataset pdataset = pfeatureclass as IDataset;
0 Kudos
LeoDonahue
Occasional Contributor III
Well, another option, if the data is published via server, would be to use:

.NET
IPublishLayer.DataDetails 
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/0012/001200000p29000000.htm

Java
FeatureLayer.getDataDetails()
http://help.arcgis.com/en/sdk/10.0/java_ao_adf/api/arcobjects/com/esri/arcgis/carto/FeatureLayer.htm...

You get a nicely formatted String with those properties you're looking for.

Data Type: ArcSDE Database
Location: Server: Server Name
User: username
Instance: sde:sqlserver:whatever
Version: dbo.DEFAULT
Description: Instance default version.
Feature Class: server.owner.name

And, as you can see the Java version gets the output wrong.  I reported as a potential bug...
0 Kudos
AndyBridle
New Contributor
You can use  pfeatureclass.FeatureDataset if the feature class is stored inside feature dataset. if not use below statement to convert ifeatureclass to idataset and then get the connection properties.

IDataset pdataset = pfeatureclass as IDataset;


many thanks, working now
0 Kudos