Package ch.so.agi.filegdb
Class FileGeodatabase
java.lang.Object
ch.so.agi.filegdb.FileGeodatabase
- All Implemented Interfaces:
AutoCloseable
Entry point for reading a file geodatabase (an Esri
.gdb directory).
try (FileGeodatabase gdb = FileGeodatabase.open(Path.of("transport.gdb"))) {
for (Dataset dataset : gdb.datasets()) {
System.out.println(dataset.name());
}
try (FileGdbTable roads = gdb.featureClass("roads")) {
for (FileGdbRow row : roads) {
System.out.println(row.get("name") + " " + row.geometry());
}
}
}
-
Method Summary
Modifier and TypeMethodDescriptionappendFeatures(String name, boolean createSpatialIndex) appendRows(String name) catalog()voidclose()static FileGeodatabaseCreates a new file geodatabase directory with its system tables.voidcreateDomain(Domain domain) Creates an attribute domain in the catalog.createFeatureClass(FeatureClassDefinition definition) Creates a feature class with the given definition.voidcreateRelationship(RelationshipDefinition definition) Creates a relationship class in the catalog.createTable(TableDefinition definition) Creates a plain attribute table in the catalog.datasets()All datasets (feature classes and tables) declared in the catalog.domains()Attribute domains declared in the catalog.static FileGdbEditSessionStarts an exclusive, recoverable edit of an existing geodatabase.featureClass(String name) booleanitems()Raw catalog items; used for domains and relationship classes.static FileGeodatabasestatic FileGeodatabaseopenWritable(Path directory) Opens an existing geodatabase for writing (append, update, delete).path()Relationship classes declared in the catalog.tables()voidvalidateAppend(String name)
-
Method Details
-
open
- Throws:
IOException
-
create
Creates a new file geodatabase directory with its system tables.The returned instance is writable: feature classes can be created with
createFeatureClass(FeatureClassDefinition). The catalog snapshot does not include datasets created afterwards; close and reopen the database for reading.- Throws:
IOException
-
edit
Starts an exclusive, recoverable edit of an existing geodatabase.- Throws:
IOException
-
openWritable
Opens an existing geodatabase for writing (append, update, delete).The caller must close the database before other applications access it.
- Throws:
IOException
-
appendFeatures
- Throws:
IOException
-
validateAppend
- Throws:
IOException
-
appendRows
- Throws:
IOException
-
isWritable
public boolean isWritable() -
createFeatureClass
Creates a feature class with the given definition.Close the returned writer before closing the database.
- Throws:
IOException
-
createDomain
Creates an attribute domain in the catalog.- Throws:
IOException
-
createTable
Creates a plain attribute table in the catalog.- Throws:
IOException
-
createRelationship
Creates a relationship class in the catalog.- Throws:
IOException
-
path
-
datasets
All datasets (feature classes and tables) declared in the catalog. -
featureClasses
-
tables
-
dataset
-
items
Raw catalog items; used for domains and relationship classes. -
catalog
-
domains
Attribute domains declared in the catalog. -
domain
-
relationships
Relationship classes declared in the catalog. -
featureClass
- Throws:
IOException
-
table
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-