Hi,
Following Uma Harano code on Drag & Drop into a DockPane , I am attempting to get the name and catalogue path of the payload that have been drag from the content pane.
if it possible to get the full catalogue path to the item selected?
Thanks
Solved! Go to Solution.
Hi Victor
To get the underlying featureclass path from a feature layer you'll have to concatenate the datastore path and the featureclass name. A code snippet like this worked for me:
var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
QueuedTask.Run( () => {
//get the underlying featureclass path for the layer
var fc = lyr.GetFeatureClass();
//get the datastore for the featureclass
var datastore = fc.GetDatastore();
//concat hydrant path (datastore and featureclass name)
var hydPath = datastore.GetPath().AbsolutePath + @"/" + fc.GetName();
});
Thanks
Uma
Hi,
The property to use is "CatalogPath".
The Drag and Drop sample is available here in the community sample repo: Drag and Drop sample
Thanks
Uma
Hi Uma,
thats great if
dropInfo.Data is List<ClipboardItem> clipboardItems
however what if if it is a mapMember or layer?
var mm = dropInfo.GetTOCContent();//extension method - returns all MapMembers being dropped
//get just feature layers, for example
var layers = dropInfo.GetTOCContentOfType<FeatureLayer>()
I tried with the following:
layers[0].getFeatureClass().getDataStore().getPath() however I get a funny temporary sde connection in my temp folder.
Thanks in advance
Hi Victor
To get the underlying featureclass path from a feature layer you'll have to concatenate the datastore path and the featureclass name. A code snippet like this worked for me:
var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
QueuedTask.Run( () => {
//get the underlying featureclass path for the layer
var fc = lyr.GetFeatureClass();
//get the datastore for the featureclass
var datastore = fc.GetDatastore();
//concat hydrant path (datastore and featureclass name)
var hydPath = datastore.GetPath().AbsolutePath + @"/" + fc.GetName();
});
Thanks
Uma
Thanks Uma,
Might be the environment I am working on. There must be something funky going on in the background as my sde connection seem to point to a temporary sde conn as I am positive that is not the right sde connection.
Name | Value | Type | |
---|---|---|---|
layer.GetFeatureClass().GetDatastore().GetPath().AbsolutePath | "C:/Users/XXXXX/AppData/Local/Temp/5/ArcGISPro22300/f169296daa50ef0d20200577ae327cf5.sde" | string |
Hi Victor,
Here are the exact steps to use to get the fully qualified path:
1. Get the Datastore from the Dataset using Dataset.GetDatastore()
2. Get the path to the Datastore using Datastore.GetPath()
3. Append a \ character
4. Append the name of the dataset (Dataset.GetName())
Thanks!
Uma