# Datasets ## List all datasets `datasets.list() -> DatasetList` **get** `/api/v1/datasets` List all datasets ### Returns - `class DatasetList: …` List of all available datasets. - `datasets: List[Dataset]` Array of dataset metadata objects - `id: str` Dataset UUID - `inserted_at: datetime` Creation timestamp (UTC) - `name: str` Human-readable dataset name - `slug: str` URL-friendly identifier - `updated_at: datetime` Last update timestamp (UTC) - `attribution: Optional[str]` Required attribution text - `description: Optional[str]` Dataset description - `license: Optional[str]` License identifier (e.g. CC-BY-4.0) - `source_url: Optional[str]` URL of the original data source ### Example ```python import os from plaza import Plaza client = Plaza( api_key=os.environ.get("PLAZA_API_KEY"), # This is the default and can be omitted ) dataset_list = client.datasets.list() print(dataset_list.datasets) ``` #### 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(DatasetCreateParams**kwargs) -> Dataset` **post** `/api/v1/datasets` Create a new dataset (admin only) ### Parameters - `name: str` Human-readable dataset name - `slug: str` URL-friendly identifier (lowercase, hyphens, no spaces) - `attribution: Optional[str]` Required attribution text - `description: Optional[str]` Dataset description - `license: Optional[str]` License identifier (e.g. CC-BY-4.0) - `source_url: Optional[str]` Source data URL ### Returns - `class Dataset: …` Metadata for a custom dataset. Datasets contain user-uploaded geospatial features separate from the OSM data. - `id: str` Dataset UUID - `inserted_at: datetime` Creation timestamp (UTC) - `name: str` Human-readable dataset name - `slug: str` URL-friendly identifier - `updated_at: datetime` Last update timestamp (UTC) - `attribution: Optional[str]` Required attribution text - `description: Optional[str]` Dataset description - `license: Optional[str]` License identifier (e.g. CC-BY-4.0) - `source_url: Optional[str]` URL of the original data source ### Example ```python import os from plaza import Plaza client = Plaza( api_key=os.environ.get("PLAZA_API_KEY"), # This is the default and can be omitted ) dataset = client.datasets.create( name="NYC Bike Lanes", slug="nyc-bike-lanes", ) print(dataset.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" } ``` ## Get dataset by ID `datasets.retrieve(strid) -> Dataset` **get** `/api/v1/datasets/{id}` Get dataset by ID ### Parameters - `id: str` ### Returns - `class Dataset: …` Metadata for a custom dataset. Datasets contain user-uploaded geospatial features separate from the OSM data. - `id: str` Dataset UUID - `inserted_at: datetime` Creation timestamp (UTC) - `name: str` Human-readable dataset name - `slug: str` URL-friendly identifier - `updated_at: datetime` Last update timestamp (UTC) - `attribution: Optional[str]` Required attribution text - `description: Optional[str]` Dataset description - `license: Optional[str]` License identifier (e.g. CC-BY-4.0) - `source_url: Optional[str]` URL of the original data source ### Example ```python import os from plaza import Plaza client = Plaza( api_key=os.environ.get("PLAZA_API_KEY"), # This is the default and can be omitted ) dataset = client.datasets.retrieve( "id", ) print(dataset.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(strid)` **delete** `/api/v1/datasets/{id}` Delete a dataset ### Parameters - `id: str` ### Example ```python import os from plaza import Plaza client = Plaza( api_key=os.environ.get("PLAZA_API_KEY"), # This is the default and can be omitted ) client.datasets.delete( "id", ) ``` ## Query features in a dataset `datasets.features(strid, DatasetFeaturesParams**kwargs) -> FeatureCollection` **get** `/api/v1/datasets/{id}/features` Query features in a dataset ### Parameters - `id: str` - `cursor: Optional[str]` Cursor for pagination - `limit: Optional[int]` Maximum results - `output_buffer: Optional[float]` Buffer geometry by meters - `output_centroid: Optional[bool]` Replace geometry with centroid - `output_fields: Optional[str]` Comma-separated property fields to include - `output_geometry: Optional[bool]` Include geometry (default true) - `output_include: Optional[str]` Extra computed fields: bbox, distance, center - `output_precision: Optional[int]` Coordinate decimal precision (1-15, default 7) - `output_simplify: Optional[float]` Simplify geometry tolerance in meters - `output_sort: Optional[str]` 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[GeoJsonFeature]` 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: Union[List[float], List[List[float]], List[List[List[float]]], List[List[List[List[float]]]]]` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `List[float]` [longitude, latitude] or [longitude, latitude, elevation] - `List[List[float]]` Array of [lng, lat] positions - `List[List[List[float]]]` Array of linear rings / line strings - `List[List[List[List[float]]]]` Array of polygons - `type: Literal["Point", "LineString", "Polygon", 3 more]` Geometry type - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: Dict[str, object]` 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: Literal["Feature"]` Always `Feature` - `"Feature"` - `id: Optional[str]` Compound identifier in `type/osm_id` format - `type: Literal["FeatureCollection"]` Always `FeatureCollection` - `"FeatureCollection"` ### Example ```python import os from plaza import Plaza client = Plaza( api_key=os.environ.get("PLAZA_API_KEY"), # This is the default and can be omitted ) feature_collection = client.datasets.features( id="id", ) print(feature_collection.features) ``` #### 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: str` Dataset UUID - `inserted_at: datetime` Creation timestamp (UTC) - `name: str` Human-readable dataset name - `slug: str` URL-friendly identifier - `updated_at: datetime` Last update timestamp (UTC) - `attribution: Optional[str]` Required attribution text - `description: Optional[str]` Dataset description - `license: Optional[str]` License identifier (e.g. CC-BY-4.0) - `source_url: Optional[str]` URL of the original data source ### Dataset List - `class DatasetList: …` List of all available datasets. - `datasets: List[Dataset]` Array of dataset metadata objects - `id: str` Dataset UUID - `inserted_at: datetime` Creation timestamp (UTC) - `name: str` Human-readable dataset name - `slug: str` URL-friendly identifier - `updated_at: datetime` Last update timestamp (UTC) - `attribution: Optional[str]` Required attribution text - `description: Optional[str]` Dataset description - `license: Optional[str]` License identifier (e.g. CC-BY-4.0) - `source_url: Optional[str]` URL of the original data source