|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gdal.ogr.DataSource
public class DataSource
This class represents a data source.
The DataSource class is a binding for the C++ OGRDataSource class.
A data source potentially consists of many layers (Layer). A data source normally consists of one, or a related set of files, though the name doesn't have to be a real item in the file system. When an DataSource is destroyed, all it's associated Layer objects are also destroyed.
Method Summary | |
---|---|
Layer |
CopyLayer(Layer src_layer,
String new_name)
Duplicate an existing layer. |
Layer |
CopyLayer(Layer src_layer,
String new_name,
Vector options)
Duplicate an existing layer. |
Layer |
CreateLayer(String name)
Create a new layer on the data source with the indicated name. |
Layer |
CreateLayer(String name,
SpatialReference srs)
Create a new layer on the data source with the indicated name, coordinate system. |
Layer |
CreateLayer(String name,
SpatialReference srs,
int geom_type)
Create a new layer on the data source with the indicated name, coordinate system, geometry type. |
Layer |
CreateLayer(String name,
SpatialReference srs,
int geom_type,
Vector options)
Create a new layer on the data source with the indicated name, coordinate system, geometry type. |
void |
delete()
Frees the native resource associated to a DataSource object and close the file. |
int |
DeleteLayer(int index)
Delete the indicated layer from the datasource. |
boolean |
equals(Object obj)
|
Layer |
ExecuteSQL(String statement)
Execute an SQL statement against the data store. |
Layer |
ExecuteSQL(String statement,
Geometry spatialFilter)
Execute an SQL statement against the data store. |
Layer |
ExecuteSQL(String statement,
Geometry spatialFilter,
String dialect)
Execute an SQL statement against the data store. |
Driver |
GetDriver()
Returns the driver that the dataset was opened with. |
Layer |
GetLayer(int index)
Fetch a layer by index. |
Layer |
GetLayer(String layer_name)
Fetch a layer by name. |
Layer |
GetLayerByIndex(int index)
Fetch a layer by index. |
Layer |
GetLayerByName(String layer_name)
Fetch a layer by name. |
int |
GetLayerCount()
Get the number of layers in this data source. |
String |
getName()
Returns the name of the data source. |
String |
GetName()
Returns the name of the data source. |
int |
GetRefCount()
Fetch reference count. |
int |
GetSummaryRefCount()
Fetch reference count of datasource and all owned layers. |
int |
hashCode()
|
void |
ReleaseResultSet(Layer layer)
Release results of ExecuteSQL(). |
boolean |
TestCapability(String cap)
Test if capability is available. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void delete()
The delete() method must be called when a datasource has been opened in update or creation mode, otherwise data might not be properly flushed to the disk. You cannot rely on the finalization to call delete().
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public Layer GetLayer(int index)
index
- a layer number between 0 and GetLayerCount()-1.
public Layer GetLayer(String layer_name)
layer_name
- the layer name of the layer to fetch.
public String getName()
public int GetRefCount()
public int GetSummaryRefCount()
public int GetLayerCount()
public Driver GetDriver()
public String GetName()
public int DeleteLayer(int index)
index
- the index of the layer to delete.
public Layer CreateLayer(String name, SpatialReference srs, int geom_type, Vector options)
Example:
Layer layer; Vector options = new Vector(); if( !ds.TestCapability( ogr.ODsCCreateLayer ) ) { ... } options.add("DIM=2"); layer = ds.CreateLayer( "NewLayer", null, ogr.wkbUnknown, options ); if( layer == null ) { ... }
name
- the name for the new layer. This should ideally not
match any existing layer on the datasource.srs
- the coordinate system to use for the new layer, or null if
no coordinate system is available.geom_type
- the geometry type for the layer. Use ogr.wkbUnknown if there
are no constraints on the types geometry to be written.options
- a vector of strings of the format name=value. Options are driver
specific, and driver information can be found at the following url:
OGR Formats
public Layer CreateLayer(String name, SpatialReference srs, int geom_type)
CreateLayer(String name, SpatialReference srs, int geom_type, java.util.Vector options)
public Layer CreateLayer(String name, SpatialReference srs)
CreateLayer(String name, SpatialReference srs, int geom_type, java.util.Vector options)
public Layer CreateLayer(String name)
CreateLayer(String name, SpatialReference srs, int geom_type, java.util.Vector options)
public Layer CopyLayer(Layer src_layer, String new_name, Vector options)
src_layer
- source layer.new_name
- the name of the layer to create.options
- a StringList of name=value options. Options are driver
specific, and driver information can be found at the following url:
OGR Formats
public Layer CopyLayer(Layer src_layer, String new_name)
CopyLayer(Layer src_layer, String new_name, java.util.Vector options)
public Layer GetLayerByIndex(int index)
index
- a layer number between 0 and GetLayerCount()-1.
public Layer GetLayerByName(String layer_name)
layer_name
- the layer name of the layer to fetch.
public boolean TestCapability(String cap)
The constant forms of the capability names should be used in preference to the strings themselves to avoid mispelling.
cap
- the capability to test.
public Layer ExecuteSQL(String statement, Geometry spatialFilter, String dialect)
For more information on the SQL dialect supported internally by OGR review the OGR SQL document. Some drivers (ie. Oracle and PostGIS) pass the SQL directly through to the underlying RDBMS.
statement
- the SQL statement to execute.spatialFilter
- geometry which represents a spatial filter.dialect
- allows control of the statement dialect. By default it
is assumed to be "generic" SQL, whatever that is.
public Layer ExecuteSQL(String statement, Geometry spatialFilter)
ExecuteSQL(String statement, Geometry spatialFilter, String dialect)
public Layer ExecuteSQL(String statement)
ExecuteSQL(String statement, Geometry spatialFilter, String dialect)
public void ReleaseResultSet(Layer layer)
layer
- the result of a previous ExecuteSQL() call.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |