# Search ## Search OSM features by name `search.query(**kwargs) -> FeatureCollection` **get** `/api/v1/search` Search OSM features by name ### Parameters - `q: String` Search query string - `cursor: String` Cursor for pagination - `limit: Integer` Maximum results (default 25, max 100) - `output_fields: String` Comma-separated property fields to include - `output_include: String` Extra computed fields: bbox, distance, center - `output_precision: Integer` Coordinate decimal precision (1-15, default 7) - `output_sort: String` 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`. - `features: Array[GeoJsonFeature]` 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: Array[Float] | Array[Array[Float]] | Array[Array[Array[Float]]] | Array[Array[Array[Array[Float]]]]` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `Array[Float]` [longitude, latitude] or [longitude, latitude, elevation] - `Array[Array[Float]]` Array of [lng, lat] positions - `Array[Array[Array[Float]]]` Array of linear rings / line strings - `Array[Array[Array[Array[Float]]]]` Array of polygons - `type: :Point | :LineString | :Polygon | 3 more` Geometry type - `:Point` - `:LineString` - `:Polygon` - `:MultiPoint` - `:MultiLineString` - `:MultiPolygon` - `properties: Hash[Symbol, untyped]` 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: :Feature` Always `Feature` - `:Feature` - `id: String` Compound identifier in `type/osm_id` format - `type: :FeatureCollection` Always `FeatureCollection` - `:FeatureCollection` ### Example ```ruby require "plaza" plaza = Plaza::Client.new( api_key: "My API Key", environment: "local" # defaults to "production" ) feature_collection = plaza.search.query(q: "q") puts(feature_collection) ``` #### 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 `search.query_post(**kwargs) -> FeatureCollection` **post** `/api/v1/search` Search OSM features by name ### Parameters - `q: String` Search query string - `cursor: String` Cursor for pagination - `limit: Integer` Maximum results (default 25, max 100) - `output_fields: String` Comma-separated property fields to include - `output_include: String` Extra computed fields: bbox, distance, center - `output_precision: Integer` Coordinate decimal precision (1-15, default 7) - `output_sort: String` 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`. - `features: Array[GeoJsonFeature]` 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: Array[Float] | Array[Array[Float]] | Array[Array[Array[Float]]] | Array[Array[Array[Array[Float]]]]` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `Array[Float]` [longitude, latitude] or [longitude, latitude, elevation] - `Array[Array[Float]]` Array of [lng, lat] positions - `Array[Array[Array[Float]]]` Array of linear rings / line strings - `Array[Array[Array[Array[Float]]]]` Array of polygons - `type: :Point | :LineString | :Polygon | 3 more` Geometry type - `:Point` - `:LineString` - `:Polygon` - `:MultiPoint` - `:MultiLineString` - `:MultiPolygon` - `properties: Hash[Symbol, untyped]` 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: :Feature` Always `Feature` - `:Feature` - `id: String` Compound identifier in `type/osm_id` format - `type: :FeatureCollection` Always `FeatureCollection` - `:FeatureCollection` ### Example ```ruby require "plaza" plaza = Plaza::Client.new( api_key: "My API Key", environment: "local" # defaults to "production" ) feature_collection = plaza.search.query_post(q: "q") puts(feature_collection) ``` #### 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" } ```