Fetch multiple features by type and ID
$client->elements->batch(list<Element> elements): FeatureCollection
POST/api/v1/features/batch
Fetch multiple features by type and ID
Fetch multiple features by type and ID
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
$client = new Client(apiKey: 'My API Key', environment: 'local');
$featureCollection = $client->elements->batch(
elements: [
['id' => 21154906, 'type' => 'node'], ['id' => 4589123, 'type' => 'way']
],
);
var_dump($featureCollection);{
"features": [
{
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"@id": "bar",
"@type": "bar",
"amenity": "bar",
"cuisine": "bar",
"name": "bar"
},
"type": "Feature",
"id": "node/21154906"
}
],
"type": "FeatureCollection"
}Returns Examples
{
"features": [
{
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"@id": "bar",
"@type": "bar",
"amenity": "bar",
"cuisine": "bar",
"name": "bar"
},
"type": "Feature",
"id": "node/21154906"
}
],
"type": "FeatureCollection"
}