# Search ## Search OSM features by name `FeatureCollection search().query(SearchQueryParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/api/v1/search` Search OSM features by name ### Parameters - `SearchQueryParams params` - `String q` Search query string - `Optional cursor` Cursor for pagination - `Optional limit` Maximum results (default 25, max 100) - `Optional outputFields` Comma-separated property fields to include - `Optional outputInclude` Extra computed fields: bbox, distance, center - `Optional outputPrecision` Coordinate decimal precision (1-15, default 7) - `Optional outputSort` Sort by: distance, name, osm_id ### 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`. - `List features` Array of GeoJSON Feature objects - `GeoJsonGeometry geometry` 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")` - `Optional id` Compound identifier in `type/osm_id` format - `Type type` Always `FeatureCollection` - `FEATURE_COLLECTION("FeatureCollection")` ### Example ```java package com.plazafyi.example; import com.plazafyi.client.PlazaClient; import com.plazafyi.client.okhttp.PlazaOkHttpClient; import com.plazafyi.models.FeatureCollection; import com.plazafyi.models.search.SearchQueryParams; public final class Main { private Main() {} public static void main(String[] args) { PlazaClient client = PlazaOkHttpClient.fromEnv(); SearchQueryParams params = SearchQueryParams.builder() .q("q") .build(); FeatureCollection featureCollection = client.search().query(params); } } ``` #### 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" } ``` ## Search OSM features by name `FeatureCollection search().queryPost(SearchQueryPostParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/api/v1/search` Search OSM features by name ### Parameters - `SearchQueryPostParams params` - `String q` Search query string - `Optional cursor` Cursor for pagination - `Optional limit` Maximum results (default 25, max 100) - `Optional outputFields` Comma-separated property fields to include - `Optional outputInclude` Extra computed fields: bbox, distance, center - `Optional outputPrecision` Coordinate decimal precision (1-15, default 7) - `Optional outputSort` Sort by: distance, name, osm_id ### 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`. - `List features` Array of GeoJSON Feature objects - `GeoJsonGeometry geometry` 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")` - `Optional id` Compound identifier in `type/osm_id` format - `Type type` Always `FeatureCollection` - `FEATURE_COLLECTION("FeatureCollection")` ### Example ```java package com.plazafyi.example; import com.plazafyi.client.PlazaClient; import com.plazafyi.client.okhttp.PlazaOkHttpClient; import com.plazafyi.models.FeatureCollection; import com.plazafyi.models.search.SearchQueryPostParams; public final class Main { private Main() {} public static void main(String[] args) { PlazaClient client = PlazaOkHttpClient.fromEnv(); SearchQueryPostParams params = SearchQueryPostParams.builder() .q("q") .build(); FeatureCollection featureCollection = client.search().queryPost(params); } } ``` #### 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" } ```