Skip to content
GuidesBlogPlaygroundDashboard

Query features by spatial predicate, bounding box, or H3 cell

FeatureCollection elements().queryPost(ElementQueryPostParamsparams = ElementQueryPostParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
POST/api/v1/features

Query features by spatial predicate, bounding box, or H3 cell

ParametersExpand Collapse
ElementQueryPostParams params
Optional<String> bbox

Legacy shorthand. Bounding box: south,west,north,east. Use spatial predicates (near, within, intersects) instead.

Optional<String> contains

Geometry that features must contain

Optional<String> crosses

Geometry that features must cross

Optional<String> cursor

Cursor for pagination

Optional<String> format

Response format. json (default) returns paginated GeoJSON. geojson/csv/ndjson stream via chunked transfer encoding.

Optional<String> h3

Legacy shorthand. H3 cell index. Use spatial predicates instead.

Optional<String> intersects

Geometry that features must intersect

Optional<Long> limit

Maximum results (default 100, max 10000)

Optional<String> near

Point geometry for proximity search (lat,lng). Requires radius.

Optional<Double> outputBuffer

Buffer geometry by meters

Optional<Boolean> outputCentroid

Replace geometry with centroid

Optional<String> outputFields

Comma-separated property fields to include

Optional<Boolean> outputGeometry

Include geometry (default true)

Optional<String> outputInclude

Extra computed fields: bbox, distance, center

Optional<Long> outputPrecision

Coordinate decimal precision (1-15, default 7)

Optional<Double> outputSimplify

Simplify geometry tolerance in meters

Optional<String> outputSort

Sort by: distance, name, osm_id

Optional<Double> radius

Search radius in meters (for near) or buffer distance (for other predicates)

Optional<String> touches

Geometry that features must touch

Optional<String> type

Element types (comma-separated: node,way,relation)

Optional<String> within

Geometry that features must be within

ReturnsExpand Collapse
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.

List<GeoJsonFeature> features

Array of GeoJSON Feature objects

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.

One of the following:
List<double>
List<List<double>>
List<List<List<double>>>
List<List<List<List<double>>>>
Type type

Geometry type

One of the following:
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

Optional<String> id

Compound identifier in type/osm_id format

Type type

Always FeatureCollection

Query features by spatial predicate, bounding box, or H3 cell

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;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        PlazaClient client = PlazaOkHttpClient.fromEnv();

        FeatureCollection featureCollection = client.elements().queryPost();
    }
}
{
  "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"
}
Returns Examples
{
  "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"
}