geodesic.boson.dataset.Dataset.from_tabular_data#
- static Dataset.from_tabular_data(name, url=None, filepath=None, feature_limit=10000, datetime_field=None, s3_region=None, s3_endpoint=None, credential=None, crs=None, region=None, middleware={}, cache={}, tile_options={}, domain='*', category='*', type='*', **kwargs)[source]#
Create a new Dataset from a vector file in cloud storage.
This can be a Shapefile, GeoJSON Feature Collection, FlatGeobuf, and several others
- Parameters:
name (str) – name of the Dataset to create
url (str | None) – the URL/URI of the data. Can be a cloud storage URI such as s3://<bucket>/key, gs://
filepath (str | None) – a path to a local tabular file to upload. If the file consists of multiple files (e.g. shapefiles), this be a glob pattern that matches all the files to upload
feature_limit (int) – the max number of features this will return per page
datetime_field (str | None) – if the data is time enabled, this is the name of the datetime field. The datetime field must RFC3339 formatted.
s3_region (str | None) – for S3 buckets, the region where the bucket is
s3_endpoint (str | None) – for S3 buckets, the endpoint to use (e.g. https://data.source.coop).
credential (str | None) – the name of the credential object needed to access this data.
crs (str | None) – a string coordinate reference for the data.
region (deprecated) – for S3 buckets, the region where the bucket is. Deprecated, use s3_region instead.
middleware (MiddlewareConfig | list) – configure any boson middleware to be applied to the new dataset.
cache (CacheConfig) – configure caching for this dataset
tile_options (TileOptions) – configure tile options for this dataset
domain (str) – domain of the resulting
Datasetcategory (str) – category of the resulting
Datasettype (str) – the type of the resulting
Dataset**kwargs – additional properties to set on the new
Dataset
- Returns:
a new Dataset.
- Return type:
Examples
>>> # Create a dataset from a GeoJSON file in a cloud storage bucket >>> ds = geodesic.Dataset.from_tabular_data( ... name='uscb-pop-centers', ... url='gs://geodesic-public-data/CenPop2020_Mean_CO.geojson', ) >>> ds.stage() >>> # Staging is optional, but is a useful tool for validating configuration >>> ds.save()
>>> # Create a dataset from a Shapefile in a cloud storage bucket >>> ds = geodesic.Dataset.from_tabular_data( ... name='uscb-pop-centers', ... url='gs://geodesic-public-data/CenPopShp/CenPop2020_Mean_CO.shp', ... ) >>> ds.stage() >>> # Staging is optional, but is a useful tool for validating configuration >>> ds.save()
>>> # Create a dataset from a GeoPackage in a cloud storage bucket >>> ds = geodesic.Dataset.from_tabular_data( ... name='uscb-pop-centers', ... url='gs://geodesic-public-data/CenPop2020_Mean_CO.gpkg', ... ) >>> ds.stage() >>> # Staging is optional, but is a useful tool for validating configuration >>> ds.save()
>>> # Create a dataset from a geodatabase file in a cloud storage bucket >>> ds = geodesic.Dataset.from_tabular_data( ... name='uscb-pop-centers', ... url='gs://geodesic-public-data/CenPop2020_Mean_CO.gdb', ... ) >>> ds.stage() >>> # Staging is optional, but is a useful tool for validating configuration >>> ds.save()
>>> # Create a dataset in the GML format in a cloud storage bucket >>> ds = geodesic.Dataset.from_tabular_data( ... name='uscb-pop-centers', ... url='gs://geodesic-public-data/CenPop2020_Mean_CO.gml', ... ) >>> ds.stage() >>> # Staging is optional, but is a useful tool for validating configuration >>> ds.save()
>>> # Create a dataset from a FlatGeobuf file in a cloud storage bucket >>> ds = geodesic.Dataset.from_tabular_data( ... name='uscb-pop-centers', ... url='gs://geodesic-public-data/CenPop2020_Mean_CO.fgb', ) >>> ds.stage() >>> # Staging is optional, but is a useful tool for validating configuration ... ds.save()