# Search ## Search OSM features by name `client.Search.Query(ctx, query) (*FeatureCollection, error)` **get** `/api/v1/search` Search OSM features by name ### Parameters - `query SearchQueryParams` - `Q param.Field[string]` Search query string - `Cursor param.Field[string]` Cursor for pagination - `Limit param.Field[int64]` Maximum results (default 25, max 100) - `OutputFields param.Field[string]` Comma-separated property fields to include - `OutputInclude param.Field[string]` Extra computed fields: bbox, distance, center - `OutputPrecision param.Field[int64]` Coordinate decimal precision (1-15, default 7) - `OutputSort param.Field[string]` Sort by: distance, name, osm_id ### Returns - `type FeatureCollection struct{…}` 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 []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 GeoJsonGeometryCoordinatesUnion` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `type GeoJsonGeometryCoordinatesPoint []float64` [longitude, latitude] or [longitude, latitude, elevation] - `type GeoJsonGeometryCoordinatesLineStringOrMultiPoint [][]float64` Array of [lng, lat] positions - `type GeoJsonGeometryCoordinatesPolygonOrMultiLineString [][][]float64` Array of linear rings / line strings - `type GeoJsonGeometryCoordinatesMultiPolygon [][][][]float64` Array of polygons - `Type GeoJsonGeometryType` Geometry type - `const GeoJsonGeometryTypePoint GeoJsonGeometryType = "Point"` - `const GeoJsonGeometryTypeLineString GeoJsonGeometryType = "LineString"` - `const GeoJsonGeometryTypePolygon GeoJsonGeometryType = "Polygon"` - `const GeoJsonGeometryTypeMultiPoint GeoJsonGeometryType = "MultiPoint"` - `const GeoJsonGeometryTypeMultiLineString GeoJsonGeometryType = "MultiLineString"` - `const GeoJsonGeometryTypeMultiPolygon GeoJsonGeometryType = "MultiPolygon"` - `Properties map[string, unknown]` 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 GeoJsonFeatureType` Always `Feature` - `const GeoJsonFeatureTypeFeature GeoJsonFeatureType = "Feature"` - `ID string` Compound identifier in `type/osm_id` format - `Type FeatureCollectionType` Always `FeatureCollection` - `const FeatureCollectionTypeFeatureCollection FeatureCollectionType = "FeatureCollection"` ### Example ```go package main import ( "context" "fmt" "github.com/plazafyi/plaza-go" "github.com/plazafyi/plaza-go/option" ) func main() { client := githubcomplazafyiplazago.NewClient( option.WithAPIKey("My API Key"), ) featureCollection, err := client.Search.Query(context.TODO(), githubcomplazafyiplazago.SearchQueryParams{ Q: githubcomplazafyiplazago.F("q"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", featureCollection.Features) } ``` #### 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 `client.Search.QueryPost(ctx, body) (*FeatureCollection, error)` **post** `/api/v1/search` Search OSM features by name ### Parameters - `body SearchQueryPostParams` - `Q param.Field[string]` Search query string - `Cursor param.Field[string]` Cursor for pagination - `Limit param.Field[int64]` Maximum results (default 25, max 100) - `OutputFields param.Field[string]` Comma-separated property fields to include - `OutputInclude param.Field[string]` Extra computed fields: bbox, distance, center - `OutputPrecision param.Field[int64]` Coordinate decimal precision (1-15, default 7) - `OutputSort param.Field[string]` Sort by: distance, name, osm_id ### Returns - `type FeatureCollection struct{…}` 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 []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 GeoJsonGeometryCoordinatesUnion` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `type GeoJsonGeometryCoordinatesPoint []float64` [longitude, latitude] or [longitude, latitude, elevation] - `type GeoJsonGeometryCoordinatesLineStringOrMultiPoint [][]float64` Array of [lng, lat] positions - `type GeoJsonGeometryCoordinatesPolygonOrMultiLineString [][][]float64` Array of linear rings / line strings - `type GeoJsonGeometryCoordinatesMultiPolygon [][][][]float64` Array of polygons - `Type GeoJsonGeometryType` Geometry type - `const GeoJsonGeometryTypePoint GeoJsonGeometryType = "Point"` - `const GeoJsonGeometryTypeLineString GeoJsonGeometryType = "LineString"` - `const GeoJsonGeometryTypePolygon GeoJsonGeometryType = "Polygon"` - `const GeoJsonGeometryTypeMultiPoint GeoJsonGeometryType = "MultiPoint"` - `const GeoJsonGeometryTypeMultiLineString GeoJsonGeometryType = "MultiLineString"` - `const GeoJsonGeometryTypeMultiPolygon GeoJsonGeometryType = "MultiPolygon"` - `Properties map[string, unknown]` 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 GeoJsonFeatureType` Always `Feature` - `const GeoJsonFeatureTypeFeature GeoJsonFeatureType = "Feature"` - `ID string` Compound identifier in `type/osm_id` format - `Type FeatureCollectionType` Always `FeatureCollection` - `const FeatureCollectionTypeFeatureCollection FeatureCollectionType = "FeatureCollection"` ### Example ```go package main import ( "context" "fmt" "github.com/plazafyi/plaza-go" "github.com/plazafyi/plaza-go/option" ) func main() { client := githubcomplazafyiplazago.NewClient( option.WithAPIKey("My API Key"), ) featureCollection, err := client.Search.QueryPost(context.TODO(), githubcomplazafyiplazago.SearchQueryPostParams{ Q: githubcomplazafyiplazago.F("q"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", featureCollection.Features) } ``` #### 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" } ```