## Query features by spatial predicate, bounding box, or H3 cell `elements().queryPost(ElementQueryPostParamsparams = ElementQueryPostParams.none(), RequestOptionsrequestOptions = RequestOptions.none()) : FeatureCollection` **post** `/api/v1/features` Query features by spatial predicate, bounding box, or H3 cell ### Parameters - `params: ElementQueryPostParams` - `bbox: Optional` Legacy shorthand. Bounding box: south,west,north,east. Use spatial predicates (near, within, intersects) instead. - `contains: Optional` Geometry that features must contain - `crosses: Optional` Geometry that features must cross - `cursor: Optional` Cursor for pagination - `format: Optional` Response format. json (default) returns paginated GeoJSON. geojson/csv/ndjson stream via chunked transfer encoding. - `h3: Optional` Legacy shorthand. H3 cell index. Use spatial predicates instead. - `intersects: Optional` Geometry that features must intersect - `limit: Optional` Maximum results (default 100, max 10000) - `near: Optional` Point geometry for proximity search (lat,lng). Requires radius. - `outputBuffer: Optional` Buffer geometry by meters - `outputCentroid: Optional` Replace geometry with centroid - `outputFields: Optional` Comma-separated property fields to include - `outputGeometry: Optional` Include geometry (default true) - `outputInclude: Optional` Extra computed fields: bbox, distance, center - `outputPrecision: Optional` Coordinate decimal precision (1-15, default 7) - `outputSimplify: Optional` Simplify geometry tolerance in meters - `outputSort: Optional` Sort by: distance, name, osm_id - `radius: Optional` Search radius in meters (for near) or buffer distance (for other predicates) - `touches: Optional` Geometry that features must touch - `type: Optional` Element types (comma-separated: node,way,relation) - `within: Optional` Geometry that features must be within ### Returns - `class FeatureCollection:` GeoJSON FeatureCollection (RFC 7946). For paginated endpoints, metadata is returned in HTTP response headers rather than the body: | Header | Description | | --------------- | ------------------------------------------------ | | `X-Limit` | Requested result limit | | `X-Has-More` | `true` if more results exist | | `X-Next-Cursor` | Opaque cursor for next page (cursor pagination) | | `X-Next-Offset` | Numeric offset for next page (offset pagination) | | `Link` | RFC 8288 `rel="next"` link to the next page | Content-Type is `application/geo+json`. - `features: List` Array of GeoJSON Feature objects - `geometry: GeoJsonGeometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `coordinates: Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `List` - `List>` - `List>>` - `List>>>` - `type: Type` Geometry type - `POINT("Point")` - `LINE_STRING("LineString")` - `POLYGON("Polygon")` - `MULTI_POINT("MultiPoint")` - `MULTI_LINE_STRING("MultiLineString")` - `MULTI_POLYGON("MultiPolygon")` - `properties: Properties` OSM tags flattened as key-value pairs, plus `@type` (node/way/relation) and `@id` (OSM ID) metadata fields. May include `distance_m` for proximity queries. - `type: Type` Always `Feature` - `FEATURE("Feature")` - `id: Optional` Compound identifier in `type/osm_id` format - `type: Type` Always `FeatureCollection` - `FEATURE_COLLECTION("FeatureCollection")` ### Example ```kotlin package com.plazafyi.example import com.plazafyi.client.PlazaClient import com.plazafyi.client.okhttp.PlazaOkHttpClient import com.plazafyi.models.FeatureCollection import com.plazafyi.models.elements.ElementQueryPostParams fun main() { val client: PlazaClient = PlazaOkHttpClient.fromEnv() val featureCollection: FeatureCollection = client.elements().queryPost() } ``` #### Response ```json { "features": [ { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ], "type": "FeatureCollection" } ```