DK for Java | tatukgis.jdk.TGIS_LayerVector.FindFirst | Overloads | Constructors | Fields | Methods | Properties | Events
Finds the first shape that matches both the specified spatial extent and the SQL-like attribute query, using an R-Tree index when available.
// Java public TGIS_Shape FindFirst( TGIS_Extent _extent, java.lang.String _query );
// Oxygene public function FindFirst( _extent : TGIS_Extent; _query : String ) : TGIS_Shape; virtual;
| Name | Type | Description |
|---|---|---|
| _extent | TGIS_Extent | Bounding extent used for spatial filtering. If the layer is attached to a Viewer, the extent is interpreted in Viewer coordinate space; otherwise it is interpreted in the layer's native coordinate space. |
| _query | java.lang.String String | SQL (Structured Query Language)-like WHERE expression that must be satisfied by the shape attributes, for example 'AGE >= 18'. An empty string disables attribute filtering. |
| Type | Description |
|---|---|
| TGIS_Shape | First shape matching both the spatial and attribute filters, or nil if no matching shape is found. Retrieve subsequent matches by calling FindNext. |
PURPOSE: Begin a combined spatial and attribute query for vector features within an extent and satisfying a field-based condition.
BEHAVIOR: Calls the most specific overload with the given extent and query, no reference shape, an empty DE-9IM mask, and _skipDeleted set to True. Returns the first match and initializes cursor state for continued retrieval through FindNext.
USAGE:
shape = layer.FindFirst(extent, 'AREA > 1000') while shape != nil ProcessShape(shape) shape = layer.FindNext()
CONSTRAINTS: The extent uses Viewer or layer coordinates depending on context. Cursor state can be invalidated by layer changes.
See: FindNext
Use this method to find to the first shape in the layer matching given criteria. Using _query param we can narrow the result of the shape searching down to the minimum. This should speed up our process of locating a desired shape.
To locate a shape, simply choose an existing layer and use FindFirst method of with a proper extent and a SQL query as a WHERE clause.