Skip to content
GuidesBlogPlaygroundDashboard

Get feature by type and ID

client.Elements.Lookup(ctx) (*GeoJsonFeature, error)
POST/api/v1/features/lookup

Get feature by type and ID

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

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.

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

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

ID stringoptional

Compound identifier in type/osm_id format

Get feature by type and ID

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)
}
{
  "geometry": {
    "coordinates": [
      2.3522,
      48.8566
    ],
    "type": "Point"
  },
  "properties": {
    "@id": "bar",
    "@type": "bar",
    "amenity": "bar",
    "cuisine": "bar",
    "name": "bar"
  },
  "type": "Feature",
  "id": "node/21154906"
}
Returns Examples
{
  "geometry": {
    "coordinates": [
      2.3522,
      48.8566
    ],
    "type": "Point"
  },
  "properties": {
    "@id": "bar",
    "@type": "bar",
    "amenity": "bar",
    "cuisine": "bar",
    "name": "bar"
  },
  "type": "Feature",
  "id": "node/21154906"
}