Skip to content
GuidesPlaygroundDashboard

Fetch multiple features by type and ID

elements().batch(ElementBatchParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : FeatureCollection
POST/api/v1/features/batch

Fetch multiple features by type and ID

ParametersExpand Collapse
params: ElementBatchParams
batchRequest: BatchRequest
ReturnsExpand Collapse
class FeatureCollection:

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

features: List<GeoJsonFeature>
geometry: GeoJsonGeometry
coordinates: Coordinates

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
List<Double>
List<List<Double>>
List<List<List<Double>>>
List<List<List<List<Double>>>>
type: Type
One of the following:
POINT("Point")
LINE_STRING("LineString")
POLYGON("Polygon")
MULTI_POINT("MultiPoint")
MULTI_LINE_STRING("MultiLineString")
MULTI_POLYGON("MultiPolygon")
properties: Properties
type: Type
id: Optional<String>

Feature identifier (type/osm_id)

osmId: Optional<Long>

OpenStreetMap ID

type: Type

Fetch multiple features by type and ID

package com.plazafyi.example

import com.plazafyi.client.PlazaClient
import com.plazafyi.client.okhttp.PlazaOkHttpClient
import com.plazafyi.models.FeatureCollection
import com.plazafyi.models.elements.BatchRequest
import com.plazafyi.models.elements.ElementBatchParams

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

    val params: BatchRequest = BatchRequest.builder()
        .addElement(BatchRequest.Element.builder()
            .id(0L)
            .type(BatchRequest.Element.Type.NODE)
            .build())
        .build()
    val featureCollection: FeatureCollection = client.elements().batch(params)
}
Returns Examples