How can I get a layer's DataSource properties.
http://forums.arcgis.com/threads/47114-How-can-I-get-a-layer-s-DataSource-properties.
获取图层名 IPublishLayer ILayer
IPublishLayer
How can I get a layer's DataSource properties. 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 theinformation that is displayed in a layer properties Source tab. (Seeattached pic)
Keep in mind, these are ALREADY loaded layers. I'm not attempting norable 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:
- Feature Type
- Geometry Type
Attached Thumbnails
![]()
Reply With QuoteTopBottom
- 01-05-2012 04:04 PM#2renon
Bing ZHENG
- Join Date
- Apr 2010
- Posts
- 19
- Points
- 0
- Answers Provided
- 0
0![]()
Re: How can I get a layer's DataSource properties. 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 ![]()
Reply With QuoteTopBottom
- 01-05-2012 04:07 PM#3Pimplebutt
ESRI Customer
- Join Date
- Jun 2010
- Posts
- 38
- Points
- 0
- Answers Provided
- 0
0![]()
Re: How can I get a layer's DataSource properties.
Originally Posted by renon
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. ![]()
Reply With QuoteTopBottom
- 01-17-2012 07:08 AM#4abridle
Andy Bridle
- Join Date
- Jan 2012
- Posts
- 3
- Points
- 0
- Answers Provided
- 0
0![]()
Re: How can I get a layer's DataSource properties. have you got a sample of this working? I'm trying to do exactly thesame 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 ![]()
Reply With QuoteTopBottom
- 01-17-2012 07:31 AM#5sshetty
Swapna Shetty
- Join Date
- Jun 2011
- Posts
- 111
- Points
- 30
- Answers Provided
- 4
0![]()
Re: How can I get a layer's DataSource properties. You can use pfeatureclass.FeatureDataset if the feature class is storedinside feature dataset. if not use below statement to convertifeatureclass to idataset and then get the connection properties.
IDataset pdataset = pfeatureclass as IDataset; ![]()
Reply With QuoteTopBottom
- 01-17-2012 10:39 AM#6ldonahue
Leo Donahue
- Join Date
- Apr 2010
- Posts
- 233
- Points
- 1
- Answers Provided
- 0
0![]()
Re: How can I get a layer's DataSource properties. 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/a...0p29000000.htm
Java
FeatureLayer.getDataDetails()
http://help.arcgis.com/en/sdk/10.0/j...tureLayer.html
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...

How can I get a layer's DataSource properties. 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 theinformation that is displayed in a layer properties Source tab. (Seeattached pic)
Keep in mind, these are ALREADY loaded layers. I'm not attempting norable 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
Attached Thumbnails

Reply With Quote


Bing ZHENG
0
Originally Posted by renon
浙公网安备 33010602011771号