<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Retrieving data from a CIMFeatureLayer (no Desktop namespace) in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieving-data-from-a-cimfeaturelayer-no-desktop/m-p/1013066#M5904</link>
    <description>&lt;P&gt;My team is working on removing Desktop namespace references throughout our code in order to create a standalone application that doesn't rely on the Arc Pro GUI. One of the things we need to do is get data from map layers.&lt;/P&gt;&lt;P&gt;We can pull in the CIMMap and associated CIMFeatureLayers from a CIMLayoutDocument that describes the layout we want to render. Since we're not using the Desktop namespace, however (and since our starting point is a CIMLayoutDocument, not a Map), we can't use the FeatureLayer class's search functions.&lt;/P&gt;&lt;P&gt;I know Core.Data contains the Database class (along with Geodatabase and other children of Datastore). These classes seem to offer some of the functionality that we need, but we also have a home-grown class that reads through a Geodatabase given a path - either .gdb or .sde. For a layer added via a geodatabase, this makes things simple - just get the gdb path from the CIMFeatureLayer's FeatureTable's DataConnection, and use it to instantiate said home-grown class.&lt;/P&gt;&lt;P&gt;However, I'm wondering what to do when features from a SQL or Oracle database have been added to the map. Creating that connection in the Arc Pro Catalog automatically creates an SDE file, but when I look at the corresponding CIMFeatureLayer object in the corresponding CIMLayoutDocument, I don't see a direct reference to that .sde. Instead I see the WorkspaceConnectionString, which contains what appear to be all the necessary connection properties to instantiate a Core.Data Database object.&lt;/P&gt;&lt;P&gt;Let's say I just wanted to grab the .sde path associated with the enterprise database used to add that feature layer to the map....Would I need to create a Database object with the constructor that calls for a DatabaseConnectionProperties object? If so, is there a built-in way to parse the WorkspaceConnectionString into a set of DB connection properties? It seems rather roundabout, but what I would be doing is:&lt;/P&gt;&lt;P&gt;-parse the WorkspaceConnectionString for the Oracle / SQL (SDE) connection into its constituent properties&lt;/P&gt;&lt;P&gt;-create a DatabaseConnectionProperties object using those parsed properties&lt;/P&gt;&lt;P&gt;-Instantiate a Database object using that DatabaseConnectionProperties object&lt;/P&gt;&lt;P&gt;-Call GetPath() on the newly instantiated Database, which hopefully would give me some path to the .sde I need.&lt;/P&gt;&lt;P&gt;Is there a simpler way to do this?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Dec 2020 21:45:57 GMT</pubDate>
    <dc:creator>DavidLaMartina</dc:creator>
    <dc:date>2020-12-30T21:45:57Z</dc:date>
    <item>
      <title>Retrieving data from a CIMFeatureLayer (no Desktop namespace)</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieving-data-from-a-cimfeaturelayer-no-desktop/m-p/1013066#M5904</link>
      <description>&lt;P&gt;My team is working on removing Desktop namespace references throughout our code in order to create a standalone application that doesn't rely on the Arc Pro GUI. One of the things we need to do is get data from map layers.&lt;/P&gt;&lt;P&gt;We can pull in the CIMMap and associated CIMFeatureLayers from a CIMLayoutDocument that describes the layout we want to render. Since we're not using the Desktop namespace, however (and since our starting point is a CIMLayoutDocument, not a Map), we can't use the FeatureLayer class's search functions.&lt;/P&gt;&lt;P&gt;I know Core.Data contains the Database class (along with Geodatabase and other children of Datastore). These classes seem to offer some of the functionality that we need, but we also have a home-grown class that reads through a Geodatabase given a path - either .gdb or .sde. For a layer added via a geodatabase, this makes things simple - just get the gdb path from the CIMFeatureLayer's FeatureTable's DataConnection, and use it to instantiate said home-grown class.&lt;/P&gt;&lt;P&gt;However, I'm wondering what to do when features from a SQL or Oracle database have been added to the map. Creating that connection in the Arc Pro Catalog automatically creates an SDE file, but when I look at the corresponding CIMFeatureLayer object in the corresponding CIMLayoutDocument, I don't see a direct reference to that .sde. Instead I see the WorkspaceConnectionString, which contains what appear to be all the necessary connection properties to instantiate a Core.Data Database object.&lt;/P&gt;&lt;P&gt;Let's say I just wanted to grab the .sde path associated with the enterprise database used to add that feature layer to the map....Would I need to create a Database object with the constructor that calls for a DatabaseConnectionProperties object? If so, is there a built-in way to parse the WorkspaceConnectionString into a set of DB connection properties? It seems rather roundabout, but what I would be doing is:&lt;/P&gt;&lt;P&gt;-parse the WorkspaceConnectionString for the Oracle / SQL (SDE) connection into its constituent properties&lt;/P&gt;&lt;P&gt;-create a DatabaseConnectionProperties object using those parsed properties&lt;/P&gt;&lt;P&gt;-Instantiate a Database object using that DatabaseConnectionProperties object&lt;/P&gt;&lt;P&gt;-Call GetPath() on the newly instantiated Database, which hopefully would give me some path to the .sde I need.&lt;/P&gt;&lt;P&gt;Is there a simpler way to do this?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 21:45:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieving-data-from-a-cimfeaturelayer-no-desktop/m-p/1013066#M5904</guid>
      <dc:creator>DavidLaMartina</dc:creator>
      <dc:date>2020-12-30T21:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving data from a CIMFeatureLayer (no Desktop namespace)</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieving-data-from-a-cimfeaturelayer-no-desktop/m-p/1013092#M5905</link>
      <description>&lt;P&gt;When you add a featurelayer that references an sde featureclass, it copies the properties from the .sde file into the featurelayer's definition - it does not retain the path to the original .sde file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When connecting via DatabaseConnectionProperties, calling GetPath() on the resulting Geodatabase returns a path to a scratch .sde file (i.e.&amp;nbsp;C:\Users\username\AppData\Local\Temp\34f33d39a4b968aa75a6079324b8ebce.sde)&lt;/P&gt;&lt;P&gt;To be able to parse the connection string, you'll need to use OS Auth connections - you (hopefully) won't be able to decrypt the password found in the connection string that's there when using DBMS auth.&lt;/P&gt;&lt;P&gt;If you really need to keep track of sde file paths, you might consider storing it in the layer's description.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 23:27:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieving-data-from-a-cimfeaturelayer-no-desktop/m-p/1013092#M5905</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2020-12-30T23:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving data from a CIMFeatureLayer (no Desktop namespace)</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieving-data-from-a-cimfeaturelayer-no-desktop/m-p/1013271#M5910</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/201161"&gt;@KirkKuykendall1&lt;/a&gt;&amp;nbsp;thanks so much for the help. Do you know what you'd do in the case of a FeatureLayer based on a Shapefile?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2020 19:53:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieving-data-from-a-cimfeaturelayer-no-desktop/m-p/1013271#M5910</guid>
      <dc:creator>DavidLaMartina</dc:creator>
      <dc:date>2020-12-31T19:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving data from a CIMFeatureLayer (no Desktop namespace)</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieving-data-from-a-cimfeaturelayer-no-desktop/m-p/1013338#M5911</link>
      <description>&lt;P&gt;Featurelayers based on shapefiles use a&amp;nbsp;CIMStandardDataConnection, whose JSON can be parsed to get the info needed to open via a FileSystemDatastore:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static void OpenShapefile()
{
    var folder = @"D:\tests\myfolder";
    var shpName = "myshapefile";
    var connPath = new FileSystemConnectionPath(
        new Uri(folder), FileSystemDatastoreType.Shapefile);
    using (var store = new FileSystemDatastore(connPath))
    {
        using (var fc = store.OpenDataset&amp;lt;FeatureClass&amp;gt;(shpName))
        {
            Debug.Print($"{fc.GetCount()}");
        };
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2021 16:57:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/retrieving-data-from-a-cimfeaturelayer-no-desktop/m-p/1013338#M5911</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2021-01-01T16:57:54Z</dc:date>
    </item>
  </channel>
</rss>

