Skip to content
GuidesBlogPlaygroundDashboard

Get feature by type and ID

elements().lookup(ElementLookupParamsparams = ElementLookupParams.none(), RequestOptionsrequestOptions = RequestOptions.none()) : GeoJsonFeature
POST/api/v1/features/lookup

Get feature by type and ID

ParametersExpand Collapse
params: ElementLookupParams
ReturnsExpand Collapse
class GeoJsonFeature:

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: Coordinates

Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc.

One of the following:
List<Double>
List<List<Double>>
List<List<List<Double>>>
List<List<List<List<Double>>>>
type: Type

Geometry type

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

id: Optional<String>

Compound identifier in type/osm_id format

Get feature by type and ID

package com.plazafyi.example

import com.plazafyi.client.PlazaClient
import com.plazafyi.client.okhttp.PlazaOkHttpClient
import com.plazafyi.models.GeoJsonFeature
import com.plazafyi.models.elements.ElementLookupParams

fun main() {
    val client: PlazaClient = PlazaOkHttpClient.fromEnv()

    val geoJsonFeature: GeoJsonFeature = client.elements().lookup()
}
{
  "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"
}