| org.geotools.data.jdbc.JDBCDataStore org.geotools.data.postgis.PostgisDataStore
All known Subclasses: org.geotools.data.postgis.WrappedPostgisDataStore,
PostgisDataStore | public class PostgisDataStore extends JDBCDataStore implements DataStore(Code) | | Postgis DataStore implementation.
This datastore by default will read/write geometries in WKT format.
Optionally use of WKB can be turned on, in which case you may want to turn
on also the use of the bytea function, that fasten the data trasfer, but
that it's available only from version 0.7.2 onwards.
author: Chris Holmes, TOPP author: Andrea Aime author: Paolo Rizzi version: $Id: PostgisDataStore.java 29506 2008-02-29 09:27:36Z aaime $ |
Field Summary | |
final protected static Logger | LOGGER The logger for the postgis module. | public int | OPTIMIZE_MODE | final public static int | OPTIMIZE_SAFE | final public static int | OPTIMIZE_SQL | protected boolean | WKBEnabled | protected boolean | byteaEnabled | protected boolean | byteaWKB postgis 1.0 changed the way WKB is handled, this needs to be
set if version >1. | protected PostgisDBInfo | dbInfo PostGIS version information (persisted here so we don't have to keep asking the database what version it is, in perpituity. | protected boolean | estimatedExtent set to true if the bounds for a table should be computed using the
estimated_extent' function, but beware that this function is less accurate
and in some cases *far* less accurate if the data within the actual bounds
does not follow a uniform distribution. | protected static GeometryFactory | geometryFactory Factory for producing geometries (from JTS). | protected static WKTReader | geometryReader Well Known Text reader (from JTS). | protected boolean | looseBbox If true then the bounding box filters will use the && postgis operator,
which uses the spatial index and performs against the envelope of the
geom, leading to greater speed and slightly less accuracy. | protected boolean | schemaEnabled | protected boolean | useGeos |
Method Summary | |
protected boolean | allowTable(String tablename) | protected String[] | attributeNames(FeatureType featureType, Filter filter) Gets the list of attribute names required for both featureType and
filter
Parameters: featureType - The FeatureType to get attribute names for. Parameters: filter - The filter which needs attributes to filter. | protected AttributeType | buildAttributeType(ResultSet metadataRs) Constructs an AttributeType from a row in a ResultSet. | protected FIDMapper | buildFIDMapper(String typeName, FIDMapperFactory factory) | protected FIDMapperFactory | buildFIDMapperFactory(JDBCDataStoreConfig config) | protected FeatureType | buildSchema(String typeName, FIDMapper mapper) Override this method to perform a few permission checks before the super
class has a chance to do its thing. | public PostgisFeatureLocking | createFeatureLockingInternal(PostgisDataStore ds, FeatureType type) | protected JDBCFeatureWriter | createFeatureWriter(FeatureReader fReader, QueryData queryData) | protected LockingManager | createLockingManager() Allows subclass to create LockingManager to support their needs. | protected PostgisSQLBuilder | createSQLBuilder() | public void | createSchema(FeatureType featureType) Creates a FeatureType in this instance of the PostgisDataStore. | protected int | determineSRID(String tableName, String geometryColumnName) | protected int | getConcurrency(boolean forWrite) | public PostgisDBInfo | getDBInfo() Obtains database specific information, such as version, supported
functions, etc. | public DataSource | getDataSource() Obtains the postgis datastore connection pool. | public Envelope | getEnvelope(String typeName) Retrieve approx bounds of all Features. | public FeatureReader | getFeatureReader(FeatureType requestType, Filter filter, Transaction transaction) This is a public entry point to the DataStore. | public FeatureSource | getFeatureSource(String typeName) Default implementation based on getFeatureReader and getFeatureWriter. | public FeatureWriter | getFeatureWriter(String typeName, Transaction transaction) Retrieve a FeatureWriter over entire dataset. | public FeatureWriter | getFeatureWriterAppend(String typeName, Transaction transaction) Retrieve a FeatureWriter for creating new content.
Subclass may wish to implement an optimized featureWriter for this
operation. | AttributeType | getGeometryAttribute(String tableName, String columnName, boolean nillable) Returns an attribute type for a geometry column in a feature table. | protected AttributeIO | getGeometryAttributeIO(AttributeType type, QueryData queryData) | public int | getOptimizeMode() | protected int | getResultSetType(boolean forWrite) | int | getSRID(String typeName, String geomColName) | public FeatureType | getSchema(String arg0) | public SQLBuilder | getSqlBuilder(String typeName) | public Set | getSupportedHints() | public String[] | getTypeNames() | protected void | guessDataStoreOptions() Attempts to figure out some optimization options, based on some postgis
metadata. | protected void | initBuilder(PostgisSQLBuilder builder) | public boolean | isByteaEnabled() | public boolean | isByteaWKB() | public boolean | isEstimatedExtent() | public boolean | isLooseBbox() Whether the bounding boxes issued against this postgis datastore are on
the envelope of the geometry or the actual geometry. | public boolean | isWKBEnabled() | protected static String | schema(String schema) Simple helper method to ensure that a schema is always set. | public void | setByteaEnabled(boolean byteaEnabled) Enables the use of bytea function for WKB data transfer (will improve
performance). | public void | setByteaWKB(boolean byteaWKB) | public void | setEstimatedExtent(boolean estimatedExtent) Enables the use of the 'estimated_extent' function for bounds computation. | public void | setLooseBbox(boolean isLooseBbox) Sets this postgis instance to use a less strict but faster bounding box
query. | public void | setOptimizeMode(int mode) Sets the optimization mode for the datastore. | public void | setWKBEnabled(boolean enabled) | public void | updateSchema(String typeName, FeatureType featureType) |
LOGGER | final protected static Logger LOGGER(Code) | | The logger for the postgis module.
|
OPTIMIZE_SAFE | final public static int OPTIMIZE_SAFE(Code) | | OPTIMIZE_MODE constants
|
OPTIMIZE_SQL | final public static int OPTIMIZE_SQL(Code) | | |
WKBEnabled | protected boolean WKBEnabled(Code) | | If true, WKB format is used instead of WKT
|
byteaEnabled | protected boolean byteaEnabled(Code) | | If true, the bytea function will be used to optimize even further data
loading when using WKB format
|
byteaWKB | protected boolean byteaWKB(Code) | | postgis 1.0 changed the way WKB is handled, this needs to be
set if version >1.
(it affects the way you send WKB to the database)
|
dbInfo | protected PostgisDBInfo dbInfo(Code) | | PostGIS version information (persisted here so we don't have to keep asking the database what version it is, in perpituity.
|
estimatedExtent | protected boolean estimatedExtent(Code) | | set to true if the bounds for a table should be computed using the
estimated_extent' function, but beware that this function is less accurate
and in some cases *far* less accurate if the data within the actual bounds
does not follow a uniform distribution.
|
geometryFactory | protected static GeometryFactory geometryFactory(Code) | | Factory for producing geometries (from JTS).
|
geometryReader | protected static WKTReader geometryReader(Code) | | Well Known Text reader (from JTS).
|
looseBbox | protected boolean looseBbox(Code) | | If true then the bounding box filters will use the && postgis operator,
which uses the spatial index and performs against the envelope of the
geom, leading to greater speed and slightly less accuracy.
|
schemaEnabled | protected boolean schemaEnabled(Code) | | Flag indicating whether schema support *
|
useGeos | protected boolean useGeos(Code) | | Enables the use of geos operators
|
allowTable | protected boolean allowTable(String tablename)(Code) | | |
attributeNames | protected String[] attributeNames(FeatureType featureType, Filter filter) throws IOException(Code) | | Gets the list of attribute names required for both featureType and
filter
Parameters: featureType - The FeatureType to get attribute names for. Parameters: filter - The filter which needs attributes to filter. The list of attribute names required by a filter. throws: IOException - If we can't get the schema. |
buildAttributeType | protected AttributeType buildAttributeType(ResultSet metadataRs) throws IOException(Code) | | Constructs an AttributeType from a row in a ResultSet. The ResultSet
contains the information retrieved by a call to getColumns() on the
DatabaseMetaData object. This information can be used to construct an
Attribute Type.
This implementation construct an AttributeType using the default JDBC
type mappings defined in JDBCDataStore. These type mappings only handle
native Java classes and SQL standard column types. If a geometry type
is found then getGeometryAttribute is called.
Note: Overriding methods must never move the current row pointer in the
result set.
Parameters: metadataRs - The ResultSet containing the result of aDatabaseMetaData.getColumns call. The AttributeType built from the ResultSet. throws: IOException - If an error occurs processing the ResultSet. |
createLockingManager | protected LockingManager createLockingManager()(Code) | | Allows subclass to create LockingManager to support their needs.
|
createSQLBuilder | protected PostgisSQLBuilder createSQLBuilder()(Code) | | Creates a new sql builder for encoding raw sql statements;
|
createSchema | public void createSchema(FeatureType featureType) throws IOException(Code) | | Creates a FeatureType in this instance of the PostgisDataStore. Since we
don't yet know which attribute in the FeatureType is the primary key, we
will create our own called "fid_tablename", which has its own sequence
called "tablename_fid_seq". The user should not interact with this
column, although its value will be the FID. This method currently assumes
there are only 2 dimensions.
throws: IOException - if something goes horribly wrong or the table already exists See Also: org.geotools.data.DataStore.createSchema(org.geotools.feature.FeatureType) |
getConcurrency | protected int getConcurrency(boolean forWrite)(Code) | | |
getDBInfo | public PostgisDBInfo getDBInfo()(Code) | | Obtains database specific information, such as version, supported
functions, etc.
|
getDataSource | public DataSource getDataSource()(Code) | | Obtains the postgis datastore connection pool.
ConnectionPool |
getEnvelope | public Envelope getEnvelope(String typeName)(Code) | | Retrieve approx bounds of all Features.
This result is suitable for a quick map display, illustrating the data.
This value is often stored as metadata in databases such as oraclespatial.
null as a generic implementation is not provided. |
getGeometryAttribute | AttributeType getGeometryAttribute(String tableName, String columnName, boolean nillable) throws IOException(Code) | | Returns an attribute type for a geometry column in a feature table.
Parameters: tableName - The feature table name. Parameters: columnName - The geometry column name. Parameters: nillable - Geometric attribute. throws: IOException - DOCUMENT ME! |
getOptimizeMode | public int getOptimizeMode()(Code) | | |
getResultSetType | protected int getResultSetType(boolean forWrite)(Code) | | |
getSupportedHints | public Set getSupportedHints()(Code) | | |
guessDataStoreOptions | protected void guessDataStoreOptions() throws IOException(Code) | | Attempts to figure out some optimization options, based on some postgis
metadata. If the version is later than 0.7.2 then bytea will be used
to read geometries if WKB is enabled. And it will read if GEOS is
enabled from the version string as well.
throws: IOException - |
isByteaEnabled | public boolean isByteaEnabled()(Code) | | Returns true if the data store is using the bytea function to fasten WKB
data transfer, false otherwise
|
isByteaWKB | public boolean isByteaWKB()(Code) | | |
isLooseBbox | public boolean isLooseBbox()(Code) | | Whether the bounding boxes issued against this postgis datastore are on
the envelope of the geometry or the actual geometry.
true if the bounding box is 'loose', against theenvelope instead of the actual geometry. |
isWKBEnabled | public boolean isWKBEnabled()(Code) | | Returns true if the WKB format is used to transfer geometries, false
otherwise
|
schema | protected static String schema(String schema)(Code) | | Simple helper method to ensure that a schema is always set.
|
setByteaEnabled | public void setByteaEnabled(boolean byteaEnabled)(Code) | | Enables the use of bytea function for WKB data transfer (will improve
performance). Note this function need not be set by the programmer, as
the datastore will use it to optimize performance whenever it can (when
postGIS is 0.7.2 or later)
Parameters: byteaEnabled - |
setByteaWKB | public void setByteaWKB(boolean byteaWKB)(Code) | | |
setEstimatedExtent | public void setEstimatedExtent(boolean estimatedExtent)(Code) | | Enables the use of the 'estimated_extent' function for bounds computation.
Beware that this function is an approximation and is dependent on the
degree to with the data in the actual bounds follows a uniform distribution.
|
setLooseBbox | public void setLooseBbox(boolean isLooseBbox)(Code) | | Sets this postgis instance to use a less strict but faster bounding box
query. Setting this to true will have PostGIS issue bounding
box queries against the envelope of the geometry, so some may be
slighty wrong, but will perform much faster. The intersects
function can still be used to obtain the exact query.
Parameters: isLooseBbox - true if this should have a loose Bbox. |
setWKBEnabled | public void setWKBEnabled(boolean enabled)(Code) | | If turned on, WKB will be used to transfer geometry data instead of WKT
Parameters: enabled - |
|
|