deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.io.sdeapi
Class SpatialQuery

java.lang.Object
  extended by org.deegree.io.sdeapi.SpatialQuery

public class SpatialQuery
extends Object

This class handles a complete ArcSDE request: If instanciated, the class can open a connection/instance of the specified ArcSDE server, set a bounding box as a spatial filter to query the defined layer. The resultset of the query contains the geometries as well as the tabular data associated with them. The table is stored as a deegree Table object whereas the geometries are stored as an array of deegree GM_Objects. Depending on the datatype of the geometries, the array of GM_Objects might be GM_Point, GM_Curve etc.

Some bits of sample code to create a query:

SpatialQuery sq = new SpatialQuery();
try {
 sq.openConnection(server, instance, database, user, password);
 sq.setLayer(layer);
 sq.setSpatialFilter(minX, minY, maxX, maxY);
 sp.runSpatialQuery();
 GM_Object[] deegree_gm_obj = sq.getGeometries();
 Table deegree_table = sq.getTable();
 sq.closeConnection();
} catch ( SeException sexp ) {
}

Version:
$Revision: 18195 $ $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Markus Bedel, Andreas Poth

Constructor Summary
SpatialQuery(String server, int port, String database, String user, String password)
          Creates a new SpatialQuery object.
 
Method Summary
 void closeConnection()
          Close the current connection to the ArcSDE server
throws SeException
 Geometry[] getGeometries()
          Get GM_Object[] containing the queried Geometries
returns null if no query has been done yet.
 com.esri.sde.sdk.client.SeLayer getLayer()
          Get the current SDE layer
returns null if it not yet set.
 com.esri.sde.sdk.client.SeShape getSpatialFilter()
          Get the current Spatial Filter
returns null if it not yet set.
 void openConnection(String server, int port, String database, String user, String password)
          Connect to the ArcSDE server
throws SeException
 Table runSpatialQuery(String[] cols)
          Runs a spatial query against the opened layer using the specified spatial filter.
 void setLayer(String layername)
          Set a SDE layer to work on and appropriate table
throws SeException
 void setSpatialFilter(double minx, double miny, double maxx, double maxy)
          Set a SpatialFilter to Query (BoundingBox)
throws SeException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpatialQuery

public SpatialQuery(String server,
                    int port,
                    String database,
                    String user,
                    String password)
             throws com.esri.sde.sdk.client.SeException
Creates a new SpatialQuery object.

Parameters:
server -
port -
database -
user -
password -
Throws:
com.esri.sde.sdk.client.SeException
Method Detail

openConnection

public void openConnection(String server,
                           int port,
                           String database,
                           String user,
                           String password)
                    throws com.esri.sde.sdk.client.SeException
Connect to the ArcSDE server
throws SeException

Parameters:
server -
port -
database -
user -
password -
Throws:
com.esri.sde.sdk.client.SeException

closeConnection

public void closeConnection()
                     throws com.esri.sde.sdk.client.SeException
Close the current connection to the ArcSDE server
throws SeException

Throws:
com.esri.sde.sdk.client.SeException

setLayer

public void setLayer(String layername)
              throws com.esri.sde.sdk.client.SeException
Set a SDE layer to work on and appropriate table
throws SeException

Parameters:
layername -
Throws:
com.esri.sde.sdk.client.SeException

getLayer

public com.esri.sde.sdk.client.SeLayer getLayer()
Get the current SDE layer
returns null if it not yet set.

Returns:
null if it not yet set.

setSpatialFilter

public void setSpatialFilter(double minx,
                             double miny,
                             double maxx,
                             double maxy)
                      throws com.esri.sde.sdk.client.SeException
Set a SpatialFilter to Query (BoundingBox)
throws SeException

Parameters:
minx -
miny -
maxx -
maxy -
Throws:
com.esri.sde.sdk.client.SeException

getSpatialFilter

public com.esri.sde.sdk.client.SeShape getSpatialFilter()
Get the current Spatial Filter
returns null if it not yet set.

Returns:
null if it not yet set.

getGeometries

public Geometry[] getGeometries()
Get GM_Object[] containing the queried Geometries
returns null if no query has been done yet.

Returns:
null if no query has been done yet.

runSpatialQuery

public Table runSpatialQuery(String[] cols)
                      throws com.esri.sde.sdk.client.SeException,
                             DeegreeSeException
Runs a spatial query against the opened layer using the specified spatial filter.
throws SeException

Parameters:
cols -
Returns:
the resulting table
Throws:
com.esri.sde.sdk.client.SeException
DeegreeSeException

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org