A Workspace that is a Database.
A Database subclass can add a SQL query as a Layer:
Database db = new H2("acme", "target/h2") Layer statesLayer = h2.add(shp, 'states') String sql = """select st_centroid("the_geom") as "the_geom", "STATE_NAME" FROM "states"""" Layer statesCentroidLayer = h2.createView("states_centroids", sql, new Field("the_geom", "Point", "EPSG:4326"))
Type Params | Return Type | Name and description |
---|---|---|
|
void |
createIndex(java.lang.String layerName, java.lang.String indexName, java.lang.String fieldName, boolean unique) Create an index
|
|
void |
createIndex(java.lang.String layerName, java.lang.String indexName, List fieldNames, boolean unique) Create an index
|
|
Layer |
createView(Map options, java.lang.String layerName, java.lang.String sql, Field geometryField) Create a Layer from a SQL View
|
|
void |
deleteIndex(java.lang.String layerName, java.lang.String indexName) Delete an index
|
|
void |
deleteView(java.lang.String name) Delete a SQL View Layer
|
|
javax.sql.DataSource |
getDataSource() Get the javax.sql.DataSource
|
|
List |
getIndexes(java.lang.String layerName) Get a List of indexes for a layer or table by name
|
|
Sql |
getSql() Get a groovy.sql.Sql object that provides direct access to the underlying database
|
|
void |
remove(java.lang.String layerName) Remove the layer from the database
|
Methods inherited from class | Name |
---|---|
class Workspace |
add, add, close, create, create, get, getAt, getFormat, getLayers, getNames, getParameters, getWorkspace, getWorkspace, getWorkspaceNames, getWorkspaceParameters, has, readFeatures, remove, remove, withWorkspace, withWorkspace, withWorkspace, wrap |
Create a new Database wrapping a GeoTools JDBCDataStore
The
- GeoTools DataStoreCreate an index
layerName
- The layer or table nameindexName
- The index namefieldName
- The field nameunique
- Whether the index is unique or notCreate an index
layerName
- The layer or table nameindexName
- The index namefieldNames
- A List of field namesunique
- Whether the index is unique or notCreate a Layer from a SQL View
options
- The named parameters
layerName
- The layer namesql
- The SQLgeometryField
- The geometry FieldDelete an index
layerName
- The layer or table nameindexName
- The index nameDelete a SQL View Layer
name
- The name of the SQL View LayerGet the javax.sql.DataSource
Get a List of indexes for a layer or table by name
layerName
- The layer or table nameGet a groovy.sql.Sql object that provides direct access to the underlying database
Remove the layer from the database
layerName
- The layer name