| java.lang.Object org.geotools.filter.SQLEncoder org.geotools.filter.SQLEncoderPostgis
All known Subclasses: org.geotools.filter.SQLEncoderPostgisGeos,
SQLEncoderPostgis | public class SQLEncoderPostgis extends SQLEncoder implements org.geotools.filter.FilterVisitor(Code) | | Encodes a filter into a SQL WHERE statement for postgis. This class adds
the ability to turn geometry filters into sql statements if they are
bboxes.
author: Chris Holmes, TOPP |
Field Summary | |
protected boolean | looseBbox | protected boolean | supportsGEOS Whether the installed PostGIS has GEOS support. |
Constructor Summary | |
public | SQLEncoderPostgis() Empty constructor TODO: rethink empty constructor, as BBOXes _need_ an
SRID, must make client set it somehow. | public | SQLEncoderPostgis(boolean looseBbox) | public | SQLEncoderPostgis(int srid) Constructor with srid. |
Method Summary | |
protected FilterCapabilities | createFilterCapabilities() | public boolean | getSupportsGEOS() | public boolean | isLooseBbox() Gets whether the Filter.BBOX query will be strict and use an intersects
or 'loose' and just operate against the geometry envelopes. | public void | setDefaultGeometry(String name) Sets the default geometry, so that filters with null for one of their
expressions can assume that the default geometry is intended. | public void | setLooseBbox(boolean isLooseBbox) Sets whether the Filter.BBOX query should be 'loose', meaning that it
should just doing a bounding box against the envelope. | public void | setSRID(int srid) Sets a spatial reference system ESPG number, so that the geometry can be
properly encoded for postgis. | public void | setSupportsGEOS(boolean supports) | public void | visit(GeometryFilter filter) Turns a geometry filter into the postgis sql bbox statement. | public void | visit(LikeFilter filter) | public void | visit(LiteralExpression expression) Checks to see if the literal is a geometry, and encodes it if it is, if
not just sends to the parent class. | public void | visit(CompareFilter filter) Writes the SQL for a Compare Filter.
DJB: note, postgis overwrites this implementation because of the way
null is handled. | public void | visitLiteralGeometry(LiteralExpression expression) Checks to see if the literal is a geometry, and encodes it if it is, if
not just sends to the parent class. |
looseBbox | protected boolean looseBbox(Code) | | Whether the BBOX filter should be strict (using the exact geom), or
loose (using the envelopes)
|
supportsGEOS | protected boolean supportsGEOS(Code) | | Whether the installed PostGIS has GEOS support. Default is false for
backwards compatibility.
|
SQLEncoderPostgis | public SQLEncoderPostgis()(Code) | | Empty constructor TODO: rethink empty constructor, as BBOXes _need_ an
SRID, must make client set it somehow. Maybe detect when encode is
called?
|
SQLEncoderPostgis | public SQLEncoderPostgis(boolean looseBbox)(Code) | | |
SQLEncoderPostgis | public SQLEncoderPostgis(int srid)(Code) | | Constructor with srid.
Parameters: srid - spatial reference id to encode geometries with. |
getSupportsGEOS | public boolean getSupportsGEOS()(Code) | | |
isLooseBbox | public boolean isLooseBbox()(Code) | | Gets whether the Filter.BBOX query will be strict and use an intersects
or 'loose' and just operate against the geometry envelopes.
true if this encoder is going to do loose filtering. |
setDefaultGeometry | public void setDefaultGeometry(String name)(Code) | | Sets the default geometry, so that filters with null for one of their
expressions can assume that the default geometry is intended.
Parameters: name - the name of the default geometry Attribute. |
setLooseBbox | public void setLooseBbox(boolean isLooseBbox)(Code) | | Sets whether the Filter.BBOX query should be 'loose', meaning that it
should just doing a bounding box against the envelope. If set to
false then the BBOX query will perform a full intersects
against the geometry, ensuring that it is exactly correct. If
true then the query will likely perform faster, but may not
be exactly correct.
Parameters: isLooseBbox - whether the bbox should be loose or strict. |
setSRID | public void setSRID(int srid)(Code) | | Sets a spatial reference system ESPG number, so that the geometry can be
properly encoded for postgis. If geotools starts actually creating
geometries with valid srids then this method will no longer be needed.
Parameters: srid - the integer code for the EPSG spatial reference system. |
setSupportsGEOS | public void setSupportsGEOS(boolean supports)(Code) | | |
visit | public void visit(LiteralExpression expression) throws RuntimeException(Code) | | Checks to see if the literal is a geometry, and encodes it if it is, if
not just sends to the parent class.
Parameters: expression - the expression to visit and encode. throws: RuntimeException - for IO exception (need a better error) |
visit | public void visit(CompareFilter filter) throws RuntimeException(Code) | | Writes the SQL for a Compare Filter.
DJB: note, postgis overwrites this implementation because of the way
null is handled. This is for filters and filters
are handled. They will come here with "property = null".
NOTE:
SELECT * FROM WHERE isnull; -- postgresql
SELECT * FROM WHERE isnull(); -- oracle???
Parameters: filter - the comparison to be turned into SQL. throws: RuntimeException - for io exception with writer
visitLiteralGeometry | public void visitLiteralGeometry(LiteralExpression expression) throws IOException(Code) | | Checks to see if the literal is a geometry, and encodes it if it is, if
not just sends to the parent class.
Parameters: expression - the expression to visit and encode. throws: IOException - for IO exception (need a better error) |
|
|
|