<?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: How to create a feature class? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503650#M11845</link>
    <description>&lt;P&gt;Not sure what you mean by "&lt;SPAN&gt;Are you trying to refer to the feature class inside from a geodatabase&lt;/SPAN&gt;". I try this: I have my PostGIS/postgresql database with vectors. I can list these vectors in my dockpane and select one, e.g. schema.name. The code snippet is me trying to add that dataset schema.name to the active map as feature class like we had in our old database (ArcSDE)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nadja_swiss_parks_0-1720627670359.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109336iD97C37496293662B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nadja_swiss_parks_0-1720627670359.png" alt="nadja_swiss_parks_0-1720627670359.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;or which is default from a file geodatabase&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nadja_swiss_parks_1-1720627712419.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109337iB57EF98AE1ADA921/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nadja_swiss_parks_1-1720627712419.png" alt="nadja_swiss_parks_1-1720627712419.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(not as query feature class&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nadja_swiss_parks_2-1720627767504.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109338i0D683EF21E4BF06B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nadja_swiss_parks_2-1720627767504.png" alt="nadja_swiss_parks_2-1720627767504.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;).&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2024 16:09:34 GMT</pubDate>
    <dc:creator>nadja</dc:creator>
    <dc:date>2024-07-10T16:09:34Z</dc:date>
    <item>
      <title>How to create a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503032#M11836</link>
      <description>&lt;P&gt;This might appear really basic, but I only manage to create a query feature class from my dockpane using this code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;await QueuedTask.Run(() =&amp;gt; LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(flyrCreatnParam, MapView.Active.Map));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; that's nice, but query feature class don't show the area and length of a feature. however we need that, which is why we want to create a feature class instead. the data lies on a postgis/postgresql database. how can I create a feature class using the ArcGIS Pro .NET SDK?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 15:06:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503032#M11836</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2024-07-09T15:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503047#M11837</link>
      <description>&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#creating-a-feature-class" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase#creating-a-feature-class&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I think this might help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 15:28:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503047#M11837</guid>
      <dc:creator>AbhijeetNandeshwar1</dc:creator>
      <dc:date>2024-07-09T15:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503182#M11838</link>
      <description>&lt;P&gt;You can use&amp;nbsp;&lt;STRONG&gt;FeatureClass featureClass = featureLayer.GetFeatureClass()&lt;/STRONG&gt; to access the feature class from a feature layer. &lt;A href="https://pro.arcgis.com/en/pro-app/3.2/sdk/api-reference/topic11591.html" target="_self"&gt;Please refer to the API&amp;nbsp;&lt;/A&gt;for more info.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 18:41:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503182#M11838</guid>
      <dc:creator>Aashis</dc:creator>
      <dc:date>2024-07-09T18:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503407#M11840</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/221628"&gt;@Aashis&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/750572"&gt;@AbhijeetNandeshwar1&lt;/a&gt;&amp;nbsp;for your answers.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/221628"&gt;@Aashis&lt;/a&gt;&amp;nbsp;I tried that, but no matter what I do, it won't add the data as FeatureClass to my Active Map, it always adds a Query Feature Class to my map or throws an error that that method is not implemented even if I'm using the code from &lt;A title="here" href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase" target="_self"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-Geodatabase&lt;/A&gt;&amp;nbsp;or the API.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(flyrCreatnParam, MapView.Active.Map)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;how do I add the created feature class to my active map?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 09:14:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503407#M11840</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2024-07-10T09:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503570#M11841</link>
      <description>&lt;P&gt;Could you post your complete code snippet and provide additional details about the error? I have difficulty understanding "it won't add the data as FeatureClass to my Active Map; it always adds a Query Feature Class to my map." and the error you got.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 14:16:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503570#M11841</guid>
      <dc:creator>Aashis</dc:creator>
      <dc:date>2024-07-10T14:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503607#M11842</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/221628"&gt;@Aashis&lt;/a&gt;&amp;nbsp;of course, sorry. I hope I got all relevant snippets.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private async Task AddVectorToMapMethod()
{
    await QueuedTask.Run(async () =&amp;gt;
    {
        try
        {
            // Use the Dispatcher to access UI elements from the UI thread
            TreeViewItem selectedNode = null;
            vector_gdbTreeView.Dispatcher.Invoke(() =&amp;gt;
            {
                selectedNode = vector_gdbTreeView.SelectedItem as TreeViewItem;
            });
            if (selectedNode != null)
            {
                string data_path = null;
                string name = null;
                selectedNode.Dispatcher.Invoke(() =&amp;gt;
                {
                    data_path = selectedNode.Tag.ToString();
                    string[] parts = data_path.Split('.');
                    name = parts[1] + "." + parts[2];
                });
                string layer_path = sde_path + "\\" + data_path;
               
                // C:\Users\xyzx\AppData\Roaming\Esri\ArcGISPro\Favorites\db_connection.sde\yyy.schema.name
                if (selectedNode != null &amp;amp; !layer_path.EndsWith(".sde"))
                {
                    // creates the feature layer parameters
                    var flyrCreatnParam = new FeatureLayerCreationParams(new Uri(layer_path))
                    {
                        Name = name
                    };

                    // Access the active map
                    if (MapView.Active != null)
                    {
                     using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri(sde_path))))
{

        // Create the FeatureLayer
    FeatureLayer featureLayer = LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(flyrCreatnParam, MapView.Active.Map);

    // Access the FeatureClass from the created FeatureLayer
    FeatureClass featureClass = featureLayer.GetTable() as FeatureClass;

    string featureClassName = featureClass.GetDefinition().GetName();
    FeatureClassDefinition featureClassDefinition = geodatabase.GetDefinition&amp;lt;FeatureClassDefinition&amp;gt;(featureClassName);

    using (FeatureClass fc = geodatabase.OpenDataset&amp;lt;FeatureClass&amp;gt;(featureClassName))
    {
        // Create the feature layer creation parameters
        FeatureLayerCreationParams layerCreationParams = new FeatureLayerCreationParams(featureClass)
        {
            // Optionally set additional properties
            Name = name,
            IsVisible = true
        };


        // Create the feature layer and add it to the active map
        LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(layerCreationParams, MapView.Active.Map);
        // FeatureLayer fl = LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(layerCreationParams, MapView.Active.Map);
        
    }
   
}  
                    else
                    {
                       
                        // do sth else
                        
                    }
                }
                else
                {
                    ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("No item selected.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }


        }
        catch (Exception ex)
        {
            // Handle exceptions
            ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ex.Message, "Error: Adding vectors to map not possible");
        }
    });

}         &lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Jul 2024 15:04:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503607#M11842</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2024-07-10T15:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503635#M11844</link>
      <description>&lt;P&gt;Line # 52:&amp;nbsp; FeatureLayerCreationParams layerCreationParams = new FeatureLayerCreationParams(featureClass). Are you trying to refer to the feature class inside from a geodatabase? Then it should be&amp;nbsp;&amp;nbsp;FeatureLayerCreationParams layerCreationParams = new FeatureLayerCreationParams(fc)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 15:47:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503635#M11844</guid>
      <dc:creator>Aashis</dc:creator>
      <dc:date>2024-07-10T15:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503650#M11845</link>
      <description>&lt;P&gt;Not sure what you mean by "&lt;SPAN&gt;Are you trying to refer to the feature class inside from a geodatabase&lt;/SPAN&gt;". I try this: I have my PostGIS/postgresql database with vectors. I can list these vectors in my dockpane and select one, e.g. schema.name. The code snippet is me trying to add that dataset schema.name to the active map as feature class like we had in our old database (ArcSDE)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nadja_swiss_parks_0-1720627670359.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109336iD97C37496293662B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nadja_swiss_parks_0-1720627670359.png" alt="nadja_swiss_parks_0-1720627670359.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;or which is default from a file geodatabase&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nadja_swiss_parks_1-1720627712419.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109337iB57EF98AE1ADA921/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nadja_swiss_parks_1-1720627712419.png" alt="nadja_swiss_parks_1-1720627712419.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(not as query feature class&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nadja_swiss_parks_2-1720627767504.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109338i0D683EF21E4BF06B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nadja_swiss_parks_2-1720627767504.png" alt="nadja_swiss_parks_2-1720627767504.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;).&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 16:09:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503650#M11845</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2024-07-10T16:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a feature class?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503671#M11846</link>
      <description>&lt;P&gt;never mind, I found half of the solution:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri(sde_path))))
{

    //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(featureClassDefinition.ToString(), "featureClassDefinition");
    using (FeatureClass fc = geodatabase.OpenDataset&amp;lt;FeatureClass&amp;gt;("parcs."+name))
    {
        // Create the feature layer creation parameters
        FeatureLayerCreationParams layerCreationParams = new FeatureLayerCreationParams(fc)
        {
            // Optionally set additional properties
            Name = name
        };


        // Create the feature layer and add it to the active map
        await QueuedTask.Run(() =&amp;gt; LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(layerCreationParams, MapView.Active.Map));
    }
}&lt;/LI-CODE&gt;&lt;P&gt;only thing is, it doesnt really behave like a Enterprise Geodatabase Feature Class. Neither the attribute Shape_Length nor Shape_Area are in the attribute table and there still is a strange query in the layer properties (SELECT attr1,attr2,attr3,...,attrn FROM schema.name).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 16:47:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-create-a-feature-class/m-p/1503671#M11846</guid>
      <dc:creator>nadja</dc:creator>
      <dc:date>2024-07-10T16:47:23Z</dc:date>
    </item>
  </channel>
</rss>

