geodesic.boson.dataset.Dataset.join#

Dataset.join(name, right_dataset, field=None, right_field=None, spatial_join=False, drop_fields=[], right_drop_fields=[], suffix='_left', right_suffix='_right', use_geometry='right', skip_initialize=False, feature_limit=1000, max_left_page_queries=10, right_collection=None, left_collection=None, project=None, middleware={}, cache={}, tile_options={}, domain='*', category='*', type='*', **kwargs)[source]#

Creates a left join of this dataset with another dataset.

See: geodesic.boson.dataset.new_join_dataset()

Parameters:
  • name (str) – the name of the new Dataset

  • right_dataset (Dataset) – the dataset to join with

  • field (str | None) – the name of the field in this dataset to join on. This key must exist for there to be output. An error will be thrown if the key does not exist for 50% of the features in a query.

  • right_field (str | None) – the name of the field in the right dataset to join on.

  • spatial_join (bool) – if True, will perform a spatial join instead of an attribute join

  • drop_fields (List[str]) – a list of fields to drop from this dataset

  • right_drop_fields (List[str]) – a list of fields to drop from the right dataset

  • suffix (str) – the suffix to append to fields from this dataset

  • right_suffix (str) – the suffix to append to fields from the right dataset

  • use_geometry (str) – which geometry to use in the join. “left” will use the left dataset’s geometry, “right” will use the right dataset’s geometry

  • skip_initialize (bool) – if True, will not initialize the right provider. This is necessary if the right provider is particularly large - all joins will then be dynamic.

  • feature_limit (int) – the max size of a results page from a query/search

  • max_left_page_queries (int) – the max number of queries a single join request will make to the left provider. The default is 10. This limit is in place to prevent inefficient join requests. Before adjusting this, consider increasing the max page size of the left provider.

  • right_collection (str | None) – if the right dataset has multiple collections, the name of the collection to use.

  • left_collection (str | None) – if the left dataset has multiple collections, the name of the collection to use.

  • project (Project | str | None) – the name of the project this will be assigned to

  • 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 Object

  • category (str) – category of the resulting Object

  • type (str) – the type of the resulting Object

  • **kwargs – additional properties to set on the new Dataset

Returns:

a new Dataset that is a join of this dataset with the right dataset

Return type:

Dataset

Examples

>>> # Create an attribute join on h3_9
>>> ds_1 = geodesic.get_dataset('lighthouses-kaggle')
>>> ds_2 = geodesic.get_dataset('aton-lighthouses-h3')
>>> join_ds = ds_1.join(name="new-join-ds",
...                     right_dataset=ds_2,
...                     field="h3_9",
...                     right_field="h3_9",
...                     )
>>> join_ds.save()
>>> # Create a spatial join on the geometry
>>> ds_1 = geodesic.get_dataset('aton-lighthouses-me')
>>> ds_2 = geodesic.get_dataset("maine-towns")
>>> spatial_join_ds = ds_1.join(
...                 name="spatial-join",
...                 right_dataset=ds_2,
...                 spatial_join=True,
...                 )
>>> spatial_join_ds.save()s