Skip to content
GuidesPlaygroundDashboard

Get feature by type and ID

client.elements.retrieve(numberid, ElementRetrieveParams { type } params, RequestOptionsoptions?): GeoJsonFeature { geometry, properties, type, 2 more }
GET/api/v1/features/{type}/{id}

Get feature by type and ID

ParametersExpand Collapse
id: number
params: ElementRetrieveParams { type }
type: string

Element type (node, way, relation)

ReturnsExpand Collapse
GeoJsonFeature { geometry, properties, type, 2 more }
geometry: GeoJsonGeometry { coordinates, type }
coordinates: Array<number> | Array<Array<number>> | Array<Array<Array<number>>> | Array<Array<Array<Array<number>>>>

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array<number>
Array<Array<number>>
Array<Array<Array<number>>>
Array<Array<Array<Array<number>>>>
type: "Point" | "LineString" | "Polygon" | 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: Record<string, unknown>
type: "Feature"
id?: string

Feature identifier (type/osm_id)

osm_id?: number

OpenStreetMap ID

Get feature by type and ID

import Plaza from '@plazafyi/sdk';

const client = new Plaza({
  apiKey: process.env['PLAZA_API_KEY'], // This is the default and can be omitted
});

const geoJsonFeature = await client.elements.retrieve(0, { type: 'type' });

console.log(geoJsonFeature.id);
Returns Examples