SE_stream_set_spatial_constraints

Sets spatial constraints

Usage syntax

LONG SE_stream_set_spatial_constraints
(SE_STREAM stream,
SHORT search_order,
BOOL calc_masks,
SHORT num_filters,
const SE_FILTER *filters);

Parameters
stream The stream handle
search_order How to search the data
calc_masks If TRUE, returns the spatial masks when fetching data
num_filters The number of spatial filters in the array
filters An array of spatial filters
Description

SE_stream_set_spatial_constraints sets spatial constraints on the current query. It takes a search order and a set of spatial filters as input. On execution, the search constraints are applied to the spatial data, and only those features meeting all of the supplied constraints are returned to the client application.

The search order tells the server whether to process the spatial or attribute portions of the query first. The options are:

SE_ATTRIBUTE_FIRST

Process any SQL WHERE clause prior to applying spatial constraints

SE_SPATIAL_FIRST

Process any spatial query prior to processing an SQL WHERE clause

SE_OPTIMIZE

The ArcSDE server will determine whether to process spatial or attribute components of a query first. If a spatial constraint must be TRUE to select a feature, the spatial component is processed first; otherwise, the attribute component is processed first.

Note: An error occurs if the application specifies an SE_SPATIAL_FIRST search order and none of the filters is set to TRUE.

The spatial filters are supplied to the function using an SE_FILTER structure

typedef struct {

  CHAR table[SE_QUALIFIED_TABLE_NAME]; /* The spatial table name */

  CHAR column[SE_MAX_COLUMN_LEN];      /* The spatial column name */

  LONG filter_type;                    /* The type of spatial filter */

  union  {

    SE_SHAPE  shape;                   /* A shape object */

    struct {

      LONG  id;                        /* An ID for a shape's SDE_ROW_ID */

      CHAR  table[SE_QUALIFIED_TABLE_NAME]; /* The shape's spatial table */

    } id;

  } filter;

  LONG   method;          /* The search method to satisfy */

  BOOL   truth;           /* TRUE to pass method, FALSE if it must NOT pass */

  CHAR  *cbm_source;      /* Set only if the method is SM_CBM */

  UCHAR *cbm_object_code; /* Internal system use only */

} SE_FILTER;

 

filter_type:

SE_SHAPE_FILTER

SE_ID_FILTER

 

Search method (in sg.h):

SM_ENVP            /* Envelopes overlap */

SM_ENVP_BY_GRID    /* Envelopes overlap (returns shapes in spatial index storage order) */

SM_CP              /* Common point */

SM_LCROSS          /* Line cross */

SM_COMMON          /* Common edge/line */

SM_CP_OR_LCROSS    /* Common point or line cross */

SM_LCROSS_OR_CP    /* Common point or line cross */

SM_ET_OR_AI        /* Edge touch or area intersect */

SM_AI_OR_ET        /* Edge touch or area intersect */

SM_ET_OR_II        /* Edge touch or interior intersect */

SM_II_OR_ET        /* Edge touch or interior intersect */

SM_AI              /* Area intersect */

SM_II              /* Interior intersect */

SM_AI_NO_ET        /* Area intersect and no edge touch */

SM_II_NO_ET        /* Interior intersect and no edge touch */

SM_PC              /* Primary contained in secondary */

SM_SC              /* Secondary contained in primary */

SM_PC_NO_ET        /* Primary contained and no edge touch */

SM_SC_NO_ET        /* Secondary contained and no edge touch */

SM_PIP             /* First point in primary in sec */

SM_IDENTICAL       /* Identical */

SM_CBM             /* Calculus-based method [Clementini] */

You can call this function only after initializing the stream with a layer or log file query and before calling SE_stream_execute.

If calc_masks is TRUE, all spatial masks are returned. If calc_masks is FALSE, a call to SE_stream_get_spatial_masks returns an SE_NO_SPATIAL_MASKS error. It is much more efficient to set calc_masks to FALSE. Do not set it to TRUE unless your application truly needs the spatial mask information. If you have an SM_ENVP search method on a spatial filter, setting calc_masks to TRUE causes ArcSDE to examine the full feature geometry which loses any performance benefits of the SM_ENVP search method.

Call SE_stream_set_spatial_constraints with zero filters to cancel previously set filters.

Returns

SE_SUCCESS
SE_CONNECTION_IN_USE

SE_CONNECTION_LOCKED

SE_DB_IO_ERROR

SE_ROW_NOEXIST

SE_FUNCTION_SEQUENCE_ERROR

SE_INCOMPATIBLE_COORDREFS

SE_INVALID_FILTER_TYPE

SE_INVALID_SHAPE_OBJECT

SE_INVALID_LAYER_NUMBER

SE_INVALID_PARAM_VALUE

SE_INVALID_POINTER

SE_INVALID_SPATIAL_CONSTRAINT

SE_LAYER_MISMATCH

SE_LOAD_ONLY_LAYER

SE_MULTIPLE_SPATIAL_COLS

SE_NO_LAYER_SPECIFIED

SE_NET_FAILURE

SE_OUT_OF_CLMEM

SE_OUT_OF_SVMEM

SE_SDE_NOT_STARTED

SE_STREAM_IN_PROGRESS

SE_INVALID_SEARCH_METHOD