public FileSystemDatastore( FileSystemConnectionPath connectionPath )
Public Function New( _ ByVal connectionPath As FileSystemConnectionPath _ )
Parameters
- connectionPath
- The folder that contains datasets of a specific Type.
public FileSystemDatastore( FileSystemConnectionPath connectionPath )
Public Function New( _ ByVal connectionPath As FileSystemConnectionPath _ )
Exception | Description |
---|---|
System.ArgumentNullException | connectionPath is null. |
System.ArgumentException | The directory corresponding to connectionPath does not exist. |
System.InvalidOperationException | The path to the file-system data store is invalid or the data store cannot be opened. |
ArcGIS.Core.Data.Exceptions.GeodatabaseException | A geodatabase-related exception has occurred. |
ArcGIS.Core.ConstructedOnWrongThreadException | This object must be created within the lambda or delegate passed to QueuedTask.Run, or on a compatible STA thread. |
public async Task OpenTinDataset() { try { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { 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)) { } } }); } catch (GeodatabaseNotFoundOrOpenedException exception) { // Handle Exception. } }
public async Task GetTinDatasetDefinition() { try { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { 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)) { } } }); } catch (GeodatabaseNotFoundOrOpenedException exception) { // Handle Exception. } }
public async Task OpenLasDataset() { try { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { 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)) { } } }); } catch (GeodatabaseNotFoundOrOpenedException exception) { // Handle Exception. } }
public async Task GetLasDatasetDefinition() { try { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { 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)) { } } }); } catch (GeodatabaseNotFoundOrOpenedException exception) { // Handle Exception. } }
public async Task OpenShapefileFeatureClass() { await ArcGIS.Desktop.Framework.Threading.Tasks.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"); FeatureClass manHolesFeatureClass = shapefile.OpenDataset<FeatureClass>("ManHoles.shp"); // Can use the .shp extension, but its not needed. Table taxDetailsTableWithoutExtension = shapefile.OpenDataset<Table>("TaxDetails"); Table taxDetailsTable = shapefile.OpenDataset<Table>("TaxDetails.dbf"); } }); }
public async Task OpenCADFeatureClass() { await ArcGIS.Desktop.Framework.Threading.Tasks.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++; } } }); }
// Create a FileSystemConnectionPath using the folder path. FileSystemConnectionPath connectionPath = new FileSystemConnectionPath(new System.Uri(@"C:\Temp"), FileSystemDatastoreType.Raster); // Create a new FileSystemDatastore using the FileSystemConnectionPath. FileSystemDatastore dataStore = new FileSystemDatastore(connectionPath); // Open the raster dataset. RasterDataset fileRasterDataset = dataStore.OpenDataset<RasterDataset>("Sample.tif");
Target Platforms: Windows 11, Windows 10