deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.io.sdeapi
Class SpatialQuery

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

public class SpatialQuery
extends java.lang.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(java.lang.String server, int port, java.lang.String database, java.lang.String user, java.lang.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(java.lang.String server, int port, java.lang.String database, java.lang.String user, java.lang.String password)
          Connect to the ArcSDE server
throws SeException
 Table runSpatialQuery(java.lang.String[] cols)
          Runs a spatial query against the opened layer using the specified spatial filter.
 void setLayer(java.lang.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(java.lang.String server,
                    int port,
                    java.lang.String database,
                    java.lang.String user,
                    java.lang.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(java.lang.String server,
                           int port,
                           java.lang.String database,
                           java.lang.String user,
                           java.lang.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(java.lang.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(java.lang.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.5 (2011/06/29 09:44 build-8-official)

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