Skip to content
GuidesPlaygroundDashboard

Get feature by type and ID

elements.retrieve(id, **kwargs) -> GeoJsonFeature { geometry, properties, type, 2 more }
GET/api/v1/features/{type}/{id}

Get feature by type and ID

ParametersExpand Collapse
type: String
id: Integer
ReturnsExpand Collapse
class GeoJsonFeature { geometry, properties, type, 2 more }
geometry: GeoJsonGeometry { coordinates, type }
coordinates: Array[Float] | Array[Array[Float]] | Array[Array[Array[Float]]] | Array[Array[Array[Array[Float]]]]

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
Array[Float]
Array[Array[Float]]
Array[Array[Array[Float]]]
Array[Array[Array[Array[Float]]]]
type: :Point | :LineString | :Polygon | 3 more
One of the following:
:Point
:LineString
:Polygon
:MultiPoint
:MultiLineString
:MultiPolygon
properties: Hash[Symbol, untyped]
type: :Feature
id: String

Feature identifier (type/osm_id)

osm_id: Integer

OpenStreetMap ID

Get feature by type and ID

require "plaza"

plaza = Plaza::Client.new(
  api_key: "My API Key",
  environment: "local" # defaults to "production"
)

geo_json_feature = plaza.elements.retrieve(0, type: "type")

puts(geo_json_feature)
Returns Examples