Skip to content
GuidesPlaygroundDashboard

Fetch multiple features by type and ID

elements.batch(**kwargs) -> FeatureCollection { features, type }
POST/api/v1/features/batch

Fetch multiple features by type and ID

ParametersExpand Collapse
elements: Array[{ id, type}]
id: Integer
type: :node | :way | :relation
One of the following:
:node
:way
:relation
ReturnsExpand Collapse
class FeatureCollection { features, type }

Bare GeoJSON FeatureCollection. Pagination metadata is returned in HTTP headers (X-Limit, X-Has-More, X-Next-Cursor, X-Next-Offset, Link).

features: Array[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

type: :FeatureCollection

Fetch multiple features by type and ID

require "plaza"

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

feature_collection = plaza.elements.batch(elements: [{id: 0, type: :node}])

puts(feature_collection)
Returns Examples