# Elements ## Query features by spatial predicate, bounding box, or H3 cell `client.Elements.Query(ctx, query) (*FeatureCollection, error)` **get** `/api/v1/features` Query features by spatial predicate, bounding box, or H3 cell ### Parameters - `query ElementQueryParams` - `Bbox param.Field[string]` Legacy shorthand. Bounding box: south,west,north,east. Use spatial predicates (near, within, intersects) instead. - `Contains param.Field[string]` Geometry that features must contain - `Crosses param.Field[string]` Geometry that features must cross - `Cursor param.Field[string]` Cursor for pagination - `H3 param.Field[string]` Legacy shorthand. H3 cell index. Use spatial predicates instead. - `Intersects param.Field[string]` Geometry that features must intersect - `Limit param.Field[int64]` Maximum results (default 100, max 10000) - `Near param.Field[string]` Point geometry for proximity search (lat,lng). Requires radius. - `OutputBuffer param.Field[float64]` Buffer geometry by meters - `OutputCentroid param.Field[bool]` Replace geometry with centroid - `OutputFields param.Field[string]` Comma-separated property fields to include - `OutputGeometry param.Field[bool]` Include geometry (default true) - `OutputInclude param.Field[string]` Extra computed fields: bbox, distance, center - `OutputPrecision param.Field[int64]` Coordinate decimal precision (1-15, default 7) - `OutputSimplify param.Field[float64]` Simplify geometry tolerance in meters - `OutputSort param.Field[string]` Sort by: distance, name, osm_id - `Radius param.Field[float64]` Search radius in meters (for near) or buffer distance (for other predicates) - `Touches param.Field[string]` Geometry that features must touch - `Type param.Field[string]` Element types (comma-separated: node,way,relation) - `Within param.Field[string]` Geometry that features must be within ### 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.Elements.Query(context.TODO(), githubcomplazafyiplazago.ElementQueryParams{ }) 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" } ``` ## Query features by spatial predicate, bounding box, or H3 cell `client.Elements.QueryPost(ctx, body) (*FeatureCollection, error)` **post** `/api/v1/features` Query features by spatial predicate, bounding box, or H3 cell ### Parameters - `body ElementQueryPostParams` - `Bbox param.Field[string]` Legacy shorthand. Bounding box: south,west,north,east. Use spatial predicates (near, within, intersects) instead. - `Contains param.Field[string]` Geometry that features must contain - `Crosses param.Field[string]` Geometry that features must cross - `Cursor param.Field[string]` Cursor for pagination - `H3 param.Field[string]` Legacy shorthand. H3 cell index. Use spatial predicates instead. - `Intersects param.Field[string]` Geometry that features must intersect - `Limit param.Field[int64]` Maximum results (default 100, max 10000) - `Near param.Field[string]` Point geometry for proximity search (lat,lng). Requires radius. - `OutputBuffer param.Field[float64]` Buffer geometry by meters - `OutputCentroid param.Field[bool]` Replace geometry with centroid - `OutputFields param.Field[string]` Comma-separated property fields to include - `OutputGeometry param.Field[bool]` Include geometry (default true) - `OutputInclude param.Field[string]` Extra computed fields: bbox, distance, center - `OutputPrecision param.Field[int64]` Coordinate decimal precision (1-15, default 7) - `OutputSimplify param.Field[float64]` Simplify geometry tolerance in meters - `OutputSort param.Field[string]` Sort by: distance, name, osm_id - `Radius param.Field[float64]` Search radius in meters (for near) or buffer distance (for other predicates) - `Touches param.Field[string]` Geometry that features must touch - `Type param.Field[string]` Element types (comma-separated: node,way,relation) - `Within param.Field[string]` Geometry that features must be within ### 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.Elements.QueryPost(context.TODO(), githubcomplazafyiplazago.ElementQueryPostParams{ }) 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" } ``` ## Get feature by type and ID `client.Elements.Get(ctx, type_, id) (*GeoJsonFeature, error)` **get** `/api/v1/features/{type}/{id}` Get feature by type and ID ### Parameters - `type_ string` - `id int64` ### Returns - `type GeoJsonFeature struct{…}` GeoJSON Feature representing an OSM element. Tags from the original OSM element are flattened directly into `properties` (not nested under a `tags` key). Metadata fields `@type` and `@id` identify the OSM element type and ID within properties. - `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 ### 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"), ) geoJsonFeature, err := client.Elements.Get( context.TODO(), "type", int64(0), ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", geoJsonFeature.ID) } ``` #### Response ```json { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ``` ## Get feature by type and ID `client.Elements.Lookup(ctx) (*GeoJsonFeature, error)` **post** `/api/v1/features/lookup` Get feature by type and ID ### Returns - `type GeoJsonFeature struct{…}` GeoJSON Feature representing an OSM element. Tags from the original OSM element are flattened directly into `properties` (not nested under a `tags` key). Metadata fields `@type` and `@id` identify the OSM element type and ID within properties. - `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 ### 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"), ) geoJsonFeature, err := client.Elements.Lookup(context.TODO()) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", geoJsonFeature.ID) } ``` #### Response ```json { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ``` ## Fetch multiple features by type and ID `client.Elements.Batch(ctx, body) (*FeatureCollection, error)` **post** `/api/v1/features/batch` Fetch multiple features by type and ID ### Parameters - `body ElementBatchParams` - `BatchRequest param.Field[BatchRequest]` Fetch multiple OSM elements by their type and ID in a single request. Maximum 100 elements per batch. ### 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.Elements.Batch(context.TODO(), githubcomplazafyiplazago.ElementBatchParams{ BatchRequest: githubcomplazafyiplazago.BatchRequestParam{ Elements: githubcomplazafyiplazago.F([]githubcomplazafyiplazago.BatchRequestElementParam{githubcomplazafyiplazago.BatchRequestElementParam{ ID: githubcomplazafyiplazago.F(int64(21154906)), Type: githubcomplazafyiplazago.F(githubcomplazafyiplazago.BatchRequestElementsTypeNode), }, githubcomplazafyiplazago.BatchRequestElementParam{ ID: githubcomplazafyiplazago.F(int64(4589123)), Type: githubcomplazafyiplazago.F(githubcomplazafyiplazago.BatchRequestElementsTypeWay), }}), }, }) 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" } ``` ## Find features near a geographic point `client.Elements.Nearby(ctx, query) (*FeatureCollection, error)` **get** `/api/v1/features/nearby` Find features near a geographic point ### Parameters - `query ElementNearbyParams` - `Lat param.Field[float64]` Legacy shorthand. Latitude (-90 to 90). Use near param instead. - `Limit param.Field[int64]` Maximum results (default 20, max 100) - `Lng param.Field[float64]` Legacy shorthand. Longitude (-180 to 180). Use near param instead. - `Near param.Field[string]` Point geometry for proximity search (lat,lng or GeoJSON). Alternative to lat/lng params. - `OutputBuffer param.Field[float64]` Buffer geometry by meters - `OutputCentroid param.Field[bool]` Replace geometry with centroid - `OutputFields param.Field[string]` Comma-separated property fields to include - `OutputGeometry param.Field[bool]` Include geometry (default true) - `OutputInclude param.Field[string]` Extra computed fields: bbox, distance, center - `OutputPrecision param.Field[int64]` Coordinate decimal precision (1-15, default 7) - `OutputSimplify param.Field[float64]` Simplify geometry tolerance in meters - `OutputSort param.Field[string]` Sort by: distance, name, osm_id - `Radius param.Field[int64]` Search radius in meters (default 500, max 10000) ### 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.Elements.Nearby(context.TODO(), githubcomplazafyiplazago.ElementNearbyParams{ }) 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" } ``` ## Find features near a geographic point `client.Elements.NearbyPost(ctx, body) (*FeatureCollection, error)` **post** `/api/v1/features/nearby` Find features near a geographic point ### Parameters - `body ElementNearbyPostParams` - `Lat param.Field[float64]` Legacy shorthand. Latitude (-90 to 90). Use near param instead. - `Limit param.Field[int64]` Maximum results (default 20, max 100) - `Lng param.Field[float64]` Legacy shorthand. Longitude (-180 to 180). Use near param instead. - `Near param.Field[string]` Point geometry for proximity search (lat,lng or GeoJSON). Alternative to lat/lng params. - `OutputBuffer param.Field[float64]` Buffer geometry by meters - `OutputCentroid param.Field[bool]` Replace geometry with centroid - `OutputFields param.Field[string]` Comma-separated property fields to include - `OutputGeometry param.Field[bool]` Include geometry (default true) - `OutputInclude param.Field[string]` Extra computed fields: bbox, distance, center - `OutputPrecision param.Field[int64]` Coordinate decimal precision (1-15, default 7) - `OutputSimplify param.Field[float64]` Simplify geometry tolerance in meters - `OutputSort param.Field[string]` Sort by: distance, name, osm_id - `Radius param.Field[int64]` Search radius in meters (default 500, max 10000) ### 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.Elements.NearbyPost(context.TODO(), githubcomplazafyiplazago.ElementNearbyPostParams{ }) 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" } ``` ## Domain Types ### Batch Request - `type BatchRequest struct{…}` Fetch multiple OSM elements by their type and ID in a single request. Maximum 100 elements per batch. - `Elements []BatchRequestElement` Array of element references to fetch - `ID int64` OSM element ID - `Type BatchRequestElementsType` OSM element type - `const BatchRequestElementsTypeNode BatchRequestElementsType = "node"` - `const BatchRequestElementsTypeWay BatchRequestElementsType = "way"` - `const BatchRequestElementsTypeRelation BatchRequestElementsType = "relation"`