<?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: Create FeaturLayer from Shape File without adding it to the Map in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-featurlayer-from-shape-file-without-adding/m-p/1679488#M13402</link>
    <description>&lt;P&gt;This is exactly what I wanted, UmaHarano.&amp;nbsp; Thank you very much!!!&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jan 2026 03:29:51 GMT</pubDate>
    <dc:creator>EugeneStaten</dc:creator>
    <dc:date>2026-01-23T03:29:51Z</dc:date>
    <item>
      <title>Create FeaturLayer from Shape File without adding it to the Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-featurlayer-from-shape-file-without-adding/m-p/1678571#M13386</link>
      <description>&lt;P&gt;Hi....&lt;/P&gt;&lt;P&gt;I am porting and old ArcMap add-in to ArcGIS Pro 3.6 using the SDK.&lt;/P&gt;&lt;P&gt;The previous code loads a FeatureLayer form a shape file without auto adding it to the Map.&lt;/P&gt;&lt;P&gt;Here is the Code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; public static ILayer LoadShapeFile(string path)
 {
     ILayer layer = null;

     try
     {
         if (File.Exists(path))
         {
             string directory = Path.GetDirectoryName(path);
             string name = Path.GetFileNameWithoutExtension(path);

             // Create a new ShapefileWorkspaceFactory CoClass to create a new workspace
             ESRI.ArcGIS.Geodatabase.IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();
             ESRI.ArcGIS.Geodatabase.IFeatureWorkspace featureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)workspaceFactory.OpenFromFile(directory, 0); // Explicit Cast

             ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(name);
             if (featureClass != null)
             {
                 ESRI.ArcGIS.Carto.IGeoFeatureLayer featureLayer = new ESRI.ArcGIS.Carto.FeatureLayerClass();
                 featureLayer.FeatureClass = featureClass;
                 featureLayer.Name = featureClass.AliasName;
                 layer = featureLayer;
             }
         }
     }
     catch (Exception ex)
     {
         DebugLog.Error(ex);
         throw;
     }

     return layer;
 }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ArcGIS Pro 2.6 wont let me do this, it forces me to add the layer to the Map:&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    public FeatureLayer LoadShapeFile(string shapefileFullPath)
    {
        if (File.Exists(shapefileFullPath))
        {
            return null;
        }

        FeatureLayer newLayer = QueuedTask.Run&amp;lt;FeatureLayer&amp;gt;( async () =&amp;gt;
        {
            try
            {
                string directory = Path.GetDirectoryName(shapefileFullPath)!;
                string shapeFileName = Path.GetFileName(shapefileFullPath)!;
                string featureClassName = Path.GetFileNameWithoutExtension(shapefileFullPath)!;

                // Run the geoprocessing tool to add a projection to the shape file
                IGPResult result = DefineShapeFileProjection(shapefileFullPath);
                if (result.IsFailed)
                {
                    return null;
                }
                var connectionPath =
                    new FileSystemConnectionPath(new Uri(directory), FileSystemDatastoreType.Shapefile);
                using (var datastore = new FileSystemDatastore(connectionPath))
                {

                    using (FeatureClass featureClass = datastore.OpenDataset&amp;lt;FeatureClass&amp;gt;(shapeFileName))
                    {
                        FeatureLayerCreationParams layerCreationParams =
                            new FeatureLayerCreationParams(featureClass)
                            {
                                Name = featureClassName, // Set a custom name for the new layer
                            };

                        // Create the layer and (add it to the map):-|
                        return LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(layerCreationParams,
                            MapView.Active.Map);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHandling.ErrorMessage(ex);
                return null;
            }

            return null;
        }).GetAwaiter().GetResult();

        return newLayer;
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The LayerUtils.cs file allow adding a layer or many layers to the Map later.&lt;/P&gt;&lt;P&gt;We first do a little preprocessing before doing so.&lt;/P&gt;&lt;P&gt;Is there a way to create a FeatureLayer without adding it to the map.&lt;/P&gt;&lt;P&gt;send null inplace of the Map container will throw an exception.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2026 02:09:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-featurlayer-from-shape-file-without-adding/m-p/1678571#M13386</guid>
      <dc:creator>EugeneStaten</dc:creator>
      <dc:date>2026-01-19T02:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create FeaturLayer from Shape File without adding it to the Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-featurlayer-from-shape-file-without-adding/m-p/1679086#M13394</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/13540"&gt;@EugeneStaten&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, Check out the &lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Map-Authoring#layer-files-and-layer-packages" target="_self"&gt;Layer files and Layer Package section&lt;/A&gt; of the &lt;A href="https://github.com/ArcGIS/arcgis-pro-sdk/wiki/ProConcepts-Map-Authoring" target="_self"&gt;ProConcepts: Map Authoring wik&lt;/A&gt;i.&lt;BR /&gt;&lt;BR /&gt;Using the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic26514.html" target="_self"&gt;LayerDocument&lt;/A&gt; class, you have the ability to&amp;nbsp;access and modify the contents of a layer file. You can then alter the layer file properties prior to adding it to the map.&lt;/P&gt;&lt;P&gt;Code snippets are provided to show how to accomplish this.&lt;/P&gt;&lt;P&gt;Please reach out if you run into any issues or have questions.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Uma&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2026 18:48:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-featurlayer-from-shape-file-without-adding/m-p/1679086#M13394</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2026-01-21T18:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create FeaturLayer from Shape File without adding it to the Map</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-featurlayer-from-shape-file-without-adding/m-p/1679488#M13402</link>
      <description>&lt;P&gt;This is exactly what I wanted, UmaHarano.&amp;nbsp; Thank you very much!!!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2026 03:29:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/create-featurlayer-from-shape-file-without-adding/m-p/1679488#M13402</guid>
      <dc:creator>EugeneStaten</dc:creator>
      <dc:date>2026-01-23T03:29:51Z</dc:date>
    </item>
  </channel>
</rss>

