ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data Namespace / FileSystemDatastore Class / FileSystemDatastore Constructor
The folder that contains datasets of a specific Type.
Example

In This Topic
    FileSystemDatastore Constructor
    In This Topic
    Opens a folder that contains datasets of type Type. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function New( _
       ByVal connectionPath As FileSystemConnectionPath _
    )
    public FileSystemDatastore( 
       FileSystemConnectionPath connectionPath
    )

    Parameters

    connectionPath
    The folder that contains datasets of a specific Type.
    Exceptions
    ExceptionDescription
    connectionPath is null.
    The directory corresponding to connectionPath does not exist.
    The path to the file-system data store is invalid or the data store cannot be opened.
    A geodatabase-related exception has occurred.
    This object must be created within the lambda or delegate passed to QueuedTask.Run, or on a compatible STA thread.
    Example
    Opening a FeatureClass from a ShapeFile Datastore
    {
      await QueuedTask.Run(() =>
      {
        FileSystemConnectionPath fileConnection = new FileSystemConnectionPath(new Uri("path\\to\\folder\\containing\\shapefiles"),
            FileSystemDatastoreType.Shapefile);
        using (FileSystemDatastore shapefile = new FileSystemDatastore(fileConnection))
        {
          FeatureClass taxLotsFeatureClass = shapefile.OpenDataset<FeatureClass>("TaxLots");
    
          // Can use the .shp extension, but its not needed.
          FeatureClass manHolesFeatureClass = shapefile.OpenDataset<FeatureClass>("ManHoles.shp");
    
          Table taxDetailsTableWithoutExtension = shapefile.OpenDataset<Table>("TaxDetails");
          Table taxDetailsTable = shapefile.OpenDataset<Table>("TaxDetails.dbf");
        }
      });
    }
    Opening a CAD Datastore
    {
      await QueuedTask.Run(() =>
      {
        FileSystemConnectionPath fileConnection = new FileSystemConnectionPath(new Uri("path\\to\\folder\\containing\\CAD"), FileSystemDatastoreType.Cad);
        using (FileSystemDatastore cadDatastore = new FileSystemDatastore(fileConnection))
        {
          //Note: Extension is required
          FeatureClass cadDataset = cadDatastore.OpenDataset<FeatureClass>("hatchplayboundaries.dwg");
    
          // Take note of the pattern for referencing a feature class. 
          FeatureClass cadfeatureClass = cadDatastore.OpenDataset<FeatureClass>("hatchplayboundaries.dwg:Polyline");
    
          int numRows = 0;
          using (RowCursor cursor = cadfeatureClass.Search())
          {
            while (cursor.MoveNext())
              numRows++;
          }
        }
      });
    }
    Open raster dataset in a folder
    // Create a FileSystemConnectionPath using the folder path.
    FileSystemConnectionPath connectionPath = new(new System.Uri(@"C:\Temp"), FileSystemDatastoreType.Raster);
    // Create a new FileSystemDatastore using the FileSystemConnectionPath.
    FileSystemDatastore dataStore = new(connectionPath);
    // Open the raster dataset.
    RasterDataset fileRasterDataset = dataStore.OpenDataset<RasterDataset>("Sample.tif");
    Open a TIN Dataset
    {
      //Note: This snippet requires to be run on the MCT (Main CIM Thread)
      string path = @"d:\Data\Tin";
      var fileConnection = new FileSystemConnectionPath(new Uri(path), FileSystemDatastoreType.Tin);
    
      using (FileSystemDatastore dataStore = new FileSystemDatastore(fileConnection))
      {
        // TIN is in a folder at d:\Data\Tin\TinDataset
    
        string dsName = "TinDataset";
    
        using (var dataset = dataStore.OpenDataset<ArcGIS.Core.Data.Analyst3D.TinDataset>(dsName))
        {
          //Do something with the dataset
        }
      }
    }
    Get a TIN Defintion
    {
      //Note: This snippet requires to be run on the MCT (Main CIM Thread)
      string path = @"d:\Data\Tin";
      var fileConnection = new FileSystemConnectionPath(new Uri(path), FileSystemDatastoreType.Tin);
    
      using (FileSystemDatastore dataStore = new FileSystemDatastore(fileConnection))
      {
        // TIN is in a folder at d:\Data\Tin\TinDataset
    
        string dsName = "TinDataset";
    
        using (var def = dataStore.GetDefinition<ArcGIS.Core.Data.Analyst3D.TinDatasetDefinition>(dsName))
        {
          //Do something with the definition
        }
      }
    }
    Open a LAS Dataset
    {
      //Note: Use QueuedTask.Run to run on the MCT 
    
      string path = @"d:\Data\LASDataset";
      var fileConnection = new FileSystemConnectionPath(new Uri(path), FileSystemDatastoreType.LasDataset);
    
      using (FileSystemDatastore dataStore = new FileSystemDatastore(fileConnection))
      {
        string name = "utrecht_tile.lasd";      // can specify with or without the .lasd extension
    
        using (var dataset = dataStore.OpenDataset<ArcGIS.Core.Data.Analyst3D.LasDataset>(name))
        {
    
        }
      }
    }
    Get a LAS Dataset Defintion
    {
      //Note: Use QueuedTask.Run to run on the MCT
      string path = @"d:\Data\LASDataset";
      var fileConnection = new FileSystemConnectionPath(new Uri(path), FileSystemDatastoreType.LasDataset);
    
      using (FileSystemDatastore dataStore = new FileSystemDatastore(fileConnection))
      {
        string name = "utrecht_tile.lasd";      // can specify with or without the .lasd extension
    
        using (var dataset = dataStore.GetDefinition<ArcGIS.Core.Data.Analyst3D.LasDatasetDefinition>(name))
        {
          //Use the dataset
        }
      }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also