geodesic.boson.dataset.Dataset.from_csv#
- static Dataset.from_csv(name, url=None, filepath=None, x_field='CoordX', y_field='CoordY', z_field='CoordZ', geom_field='WKT', datetime_field=None, feature_limit=10000, s3_region=None, s3_endpoint=None, crs=None, credential=None, region=None, middleware={}, cache={}, tile_options={}, domain='*', category='*', type='*', **kwargs)[source]#
Create a new Dataset from a CSV file in cloud storage.
- 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 CSV file to upload
x_field (str) – the field name for the x fields
y_field (str) – the field name for the y fields
z_field (str) – the field name for the z fields
geom_field (str) – the field name containing the geometry in well known text (WKT) or hex encoded well known binary (WKB).
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 must be 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).
crs (str | None) – a string coordinate reference for the data
credential (str | None) – the name of the credential object needed to access this data.
region (str | None) – (DEPRECATED) for S3 buckets, the region where the bucket is
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:
Example
>>> # Create a geodesic dataset from a CSV file in a cloud storage bucket >>> ds = geodesic.Dataset.from_csv( ... name='uscb-pop-centers', ... url='gs://geodesic-public-data/CenPop2020_Mean_CO.csv', ... crs='EPSG:4326', ... x_field='LONGITUDE', ... y_field='LATITUDE' ... ) >>> ds.stage() >>> # Staging is optional, but is a useful tool for validating configuration >>> ds.save()