<?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 Re: Getting the geodatabase directory path in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-the-geodatabase-directory-path/m-p/1123238#M7422</link>
    <description>&lt;P&gt;Either of the following should work for you.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;System.IO.Path.GetDirectoryName(MULayer.GetPath().ToString());&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;or&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;MULayer.GetFeatureClass().GetDatastore().GetPath().ToString()&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Tue, 07 Dec 2021 03:27:19 GMT</pubDate>
    <dc:creator>DanielHuantes</dc:creator>
    <dc:date>2021-12-07T03:27:19Z</dc:date>
    <item>
      <title>Getting the geodatabase directory path</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-the-geodatabase-directory-path/m-p/1123231#M7420</link>
      <description>&lt;P&gt;I would like to get the path directory of a geodatabase, gSSURGO_CA.gdb. Inside the gSSURGO_CA. gdb is a feature layer, MUPOLYGON. shp. How would I change this script to get the path directory for the geodatabase, instead of the feature layer, MUPOLYGON&amp;nbsp; directory?&amp;nbsp;&lt;/P&gt;&lt;P&gt;var MULayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().Where(fl =&amp;gt; fl.Name.Contains("MUPOLYGON")).FirstOrDefault();&lt;BR /&gt;var gdbPath = MULayer.GetPath();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 02:27:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-the-geodatabase-directory-path/m-p/1123231#M7420</guid>
      <dc:creator>ThiPham12</dc:creator>
      <dc:date>2021-12-07T02:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the geodatabase directory path</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-the-geodatabase-directory-path/m-p/1123238#M7422</link>
      <description>&lt;P&gt;Either of the following should work for you.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;System.IO.Path.GetDirectoryName(MULayer.GetPath().ToString());&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;or&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;MULayer.GetFeatureClass().GetDatastore().GetPath().ToString()&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 07 Dec 2021 03:27:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-the-geodatabase-directory-path/m-p/1123238#M7422</guid>
      <dc:creator>DanielHuantes</dc:creator>
      <dc:date>2021-12-07T03:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the geodatabase directory path</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-the-geodatabase-directory-path/m-p/1123529#M7438</link>
      <description>&lt;P&gt;You can cast your MULayer to the type BasicFeatureLayer and then use the GetDataConnection method to get the data connection properties:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic11921.html" target="_blank"&gt;ArcGIS Pro 2.9 API Reference Guide - GetDataConnection Method—ArcGIS Pro&lt;/A&gt;&lt;/P&gt;&lt;P&gt;GetDataConnection returns&amp;nbsp;&lt;SPAN&gt;CIMDataConnection&amp;nbsp;which can be directly used to create layers, standalone tables etc. in the same geodatabase.&amp;nbsp; You can cast&amp;nbsp;CIMDataConnection&amp;nbsp; to&amp;nbsp;CIMStandardDataConnection in order to view the detail about the connection,&amp;nbsp; Here is a sample button:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override void OnClick()
        {
            var TestLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;BasicFeatureLayer&amp;gt;().FirstOrDefault();
            if (TestLayer == null) return;
            QueuedTask.Run(() =&amp;gt;
            {
                var cimDataConnection = TestLayer.GetDataConnection() as CIMStandardDataConnection;
                if (cimDataConnection == null) return;
                System.Diagnostics.Trace.WriteLine(cimDataConnection.WorkspaceConnectionString);
            });
        }&lt;/LI-CODE&gt;&lt;P&gt;and the output for&amp;nbsp;cimDataConnection.WorkspaceConnectionString in my sample is:&lt;/P&gt;&lt;P&gt;DATABASE=C:\Data\Interacting with Maps\Interacting with Maps.gdb&lt;/P&gt;&lt;P&gt;which in essence is the path to the file geodatabase.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 19:59:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-the-geodatabase-directory-path/m-p/1123529#M7438</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-12-07T19:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the geodatabase directory path</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-the-geodatabase-directory-path/m-p/1123693#M7440</link>
      <description>&lt;P&gt;Hi Daniel,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help! It worked. I was hoping you can help with a related question. How can I get the gdb path directory without the feature class, but with the gdb name instead? Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 03:20:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-the-geodatabase-directory-path/m-p/1123693#M7440</guid>
      <dc:creator>ThiPham12</dc:creator>
      <dc:date>2021-12-08T03:20:13Z</dc:date>
    </item>
  </channel>
</rss>

