# Datasets ## List all datasets `datasets().list(DatasetListParamsparams = DatasetListParams.none(), RequestOptionsrequestOptions = RequestOptions.none()) : DatasetList` **get** `/api/v1/datasets` List all datasets ### Parameters - `params: DatasetListParams` ### Returns - `class DatasetList:` List of all available datasets. - `datasets: List` Array of dataset metadata objects - `id: String` Dataset UUID - `insertedAt: LocalDateTime` Creation timestamp (UTC) - `name: String` Human-readable dataset name - `slug: String` URL-friendly identifier - `updatedAt: LocalDateTime` Last update timestamp (UTC) - `attribution: Optional` Required attribution text - `description: Optional` Dataset description - `license: Optional` License identifier (e.g. CC-BY-4.0) - `sourceUrl: Optional` URL of the original data source ### Example ```kotlin package com.plazafyi.example import com.plazafyi.client.PlazaClient import com.plazafyi.client.okhttp.PlazaOkHttpClient import com.plazafyi.models.datasets.DatasetList import com.plazafyi.models.datasets.DatasetListParams fun main() { val client: PlazaClient = PlazaOkHttpClient.fromEnv() val datasetList: DatasetList = client.datasets().list() } ``` #### Response ```json { "datasets": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "inserted_at": "2019-12-27T18:11:19.117Z", "name": "NYC Bike Lanes", "slug": "nyc-bike-lanes", "updated_at": "2019-12-27T18:11:19.117Z", "attribution": "attribution", "description": "description", "license": "license", "source_url": "https://example.com" } ] } ``` ## Create a new dataset (admin only) `datasets().create(DatasetCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : Dataset` **post** `/api/v1/datasets` Create a new dataset (admin only) ### Parameters - `params: DatasetCreateParams` - `name: String` Human-readable dataset name - `slug: String` URL-friendly identifier (lowercase, hyphens, no spaces) - `attribution: Optional` Required attribution text - `description: Optional` Dataset description - `license: Optional` License identifier (e.g. CC-BY-4.0) - `sourceUrl: Optional` Source data URL ### Returns - `class Dataset:` Metadata for a custom dataset. Datasets contain user-uploaded geospatial features separate from the OSM data. - `id: String` Dataset UUID - `insertedAt: LocalDateTime` Creation timestamp (UTC) - `name: String` Human-readable dataset name - `slug: String` URL-friendly identifier - `updatedAt: LocalDateTime` Last update timestamp (UTC) - `attribution: Optional` Required attribution text - `description: Optional` Dataset description - `license: Optional` License identifier (e.g. CC-BY-4.0) - `sourceUrl: Optional` URL of the original data source ### Example ```kotlin package com.plazafyi.example import com.plazafyi.client.PlazaClient import com.plazafyi.client.okhttp.PlazaOkHttpClient import com.plazafyi.models.datasets.Dataset import com.plazafyi.models.datasets.DatasetCreateParams fun main() { val client: PlazaClient = PlazaOkHttpClient.fromEnv() val params: DatasetCreateParams = DatasetCreateParams.builder() .name("NYC Bike Lanes") .slug("nyc-bike-lanes") .build() val dataset: Dataset = client.datasets().create(params) } ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "inserted_at": "2019-12-27T18:11:19.117Z", "name": "NYC Bike Lanes", "slug": "nyc-bike-lanes", "updated_at": "2019-12-27T18:11:19.117Z", "attribution": "attribution", "description": "description", "license": "license", "source_url": "https://example.com" } ``` ## Get dataset by ID `datasets().retrieve(DatasetRetrieveParamsparams = DatasetRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none()) : Dataset` **get** `/api/v1/datasets/{id}` Get dataset by ID ### Parameters - `params: DatasetRetrieveParams` - `id: Optional` ### Returns - `class Dataset:` Metadata for a custom dataset. Datasets contain user-uploaded geospatial features separate from the OSM data. - `id: String` Dataset UUID - `insertedAt: LocalDateTime` Creation timestamp (UTC) - `name: String` Human-readable dataset name - `slug: String` URL-friendly identifier - `updatedAt: LocalDateTime` Last update timestamp (UTC) - `attribution: Optional` Required attribution text - `description: Optional` Dataset description - `license: Optional` License identifier (e.g. CC-BY-4.0) - `sourceUrl: Optional` URL of the original data source ### Example ```kotlin package com.plazafyi.example import com.plazafyi.client.PlazaClient import com.plazafyi.client.okhttp.PlazaOkHttpClient import com.plazafyi.models.datasets.Dataset import com.plazafyi.models.datasets.DatasetRetrieveParams fun main() { val client: PlazaClient = PlazaOkHttpClient.fromEnv() val dataset: Dataset = client.datasets().retrieve("id") } ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "inserted_at": "2019-12-27T18:11:19.117Z", "name": "NYC Bike Lanes", "slug": "nyc-bike-lanes", "updated_at": "2019-12-27T18:11:19.117Z", "attribution": "attribution", "description": "description", "license": "license", "source_url": "https://example.com" } ``` ## Delete a dataset `datasets().delete(DatasetDeleteParamsparams = DatasetDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/api/v1/datasets/{id}` Delete a dataset ### Parameters - `params: DatasetDeleteParams` - `id: Optional` ### Example ```kotlin package com.plazafyi.example import com.plazafyi.client.PlazaClient import com.plazafyi.client.okhttp.PlazaOkHttpClient import com.plazafyi.models.datasets.DatasetDeleteParams fun main() { val client: PlazaClient = PlazaOkHttpClient.fromEnv() client.datasets().delete("id") } ``` ## Query features in a dataset `datasets().features(DatasetFeaturesParamsparams = DatasetFeaturesParams.none(), RequestOptionsrequestOptions = RequestOptions.none()) : FeatureCollection` **get** `/api/v1/datasets/{id}/features` Query features in a dataset ### Parameters - `params: DatasetFeaturesParams` - `id: Optional` - `cursor: Optional` Cursor for pagination - `limit: Optional` Maximum results - `outputBuffer: Optional` Buffer geometry by meters - `outputCentroid: Optional` Replace geometry with centroid - `outputFields: Optional` Comma-separated property fields to include - `outputGeometry: Optional` Include geometry (default true) - `outputInclude: Optional` Extra computed fields: bbox, distance, center - `outputPrecision: Optional` Coordinate decimal precision (1-15, default 7) - `outputSimplify: Optional` Simplify geometry tolerance in meters - `outputSort: Optional` Sort by: distance, name, osm_id ### Returns - `class FeatureCollection:` GeoJSON FeatureCollection (RFC 7946). For paginated endpoints, metadata is returned in HTTP response headers rather than the body: | Header | Description | | --------------- | ------------------------------------------------ | | `X-Limit` | Requested result limit | | `X-Has-More` | `true` if more results exist | | `X-Next-Cursor` | Opaque cursor for next page (cursor pagination) | | `X-Next-Offset` | Numeric offset for next page (offset pagination) | | `Link` | RFC 8288 `rel="next"` link to the next page | Content-Type is `application/geo+json`. - `features: List` Array of GeoJSON Feature objects - `geometry: GeoJsonGeometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `coordinates: Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `List` - `List>` - `List>>` - `List>>>` - `type: Type` Geometry type - `POINT("Point")` - `LINE_STRING("LineString")` - `POLYGON("Polygon")` - `MULTI_POINT("MultiPoint")` - `MULTI_LINE_STRING("MultiLineString")` - `MULTI_POLYGON("MultiPolygon")` - `properties: Properties` OSM tags flattened as key-value pairs, plus `@type` (node/way/relation) and `@id` (OSM ID) metadata fields. May include `distance_m` for proximity queries. - `type: Type` Always `Feature` - `FEATURE("Feature")` - `id: Optional` Compound identifier in `type/osm_id` format - `type: Type` Always `FeatureCollection` - `FEATURE_COLLECTION("FeatureCollection")` ### Example ```kotlin package com.plazafyi.example import com.plazafyi.client.PlazaClient import com.plazafyi.client.okhttp.PlazaOkHttpClient import com.plazafyi.models.FeatureCollection import com.plazafyi.models.datasets.DatasetFeaturesParams fun main() { val client: PlazaClient = PlazaOkHttpClient.fromEnv() val featureCollection: FeatureCollection = client.datasets().features("id") } ``` #### Response ```json { "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" } ``` ## Domain Types ### Dataset - `class Dataset:` Metadata for a custom dataset. Datasets contain user-uploaded geospatial features separate from the OSM data. - `id: String` Dataset UUID - `insertedAt: LocalDateTime` Creation timestamp (UTC) - `name: String` Human-readable dataset name - `slug: String` URL-friendly identifier - `updatedAt: LocalDateTime` Last update timestamp (UTC) - `attribution: Optional` Required attribution text - `description: Optional` Dataset description - `license: Optional` License identifier (e.g. CC-BY-4.0) - `sourceUrl: Optional` URL of the original data source ### Dataset List - `class DatasetList:` List of all available datasets. - `datasets: List` Array of dataset metadata objects - `id: String` Dataset UUID - `insertedAt: LocalDateTime` Creation timestamp (UTC) - `name: String` Human-readable dataset name - `slug: String` URL-friendly identifier - `updatedAt: LocalDateTime` Last update timestamp (UTC) - `attribution: Optional` Required attribution text - `description: Optional` Dataset description - `license: Optional` License identifier (e.g. CC-BY-4.0) - `sourceUrl: Optional` URL of the original data source