geodesic.boson.dataset.Dataset.share_as_ogc_tiles_service#
- Dataset.share_as_ogc_tiles_service(alias=None, description=None, ttl=None, pin_version=False, extra_settings={}, create_new=False, referer_allowlist=None, referer_blocklist=None)[source]#
Share a dataset as a OGC Tiles service.
- Parameters:
alias (str | None) – An optional alias/nickname for the token. This is used to help users identify and find tokens in their token list. If not provided, a default alias will be used.
description (str | None) – An optional description of the token. This is used to help users understand the token’s purpose and usage context. If not provided, a default description will be used.
ttl (timedelta | int | float | None) – The time until the dataset’s token should expire. Can be either a timedelta object or an integer/float representing seconds. Defaults to -1 (no expiration) if not provided. Use this for temporary access or testing scenarios.
pin_version (bool) – If True, will pin the version of the dataset to the token. This means that the token will always return the same version of the dataset, even if the dataset is updated or modified. Useful for ensuring consistency in production environments.
extra_settings (dict) – A dictionary of additional settings to pass to scope this token. This is an advanced parameter - only use if you need specific token configurations not covered by other parameters.
create_new (bool) – If True, will create a new token even if one already exists with the same parameters. If ttl is greater than 0, this will always create a new token regardless of this setting.
referer_allowlist (list | None) – A list of allowed referer URLs for the token. If set, only HTTP requests from these referers will be allowed to access the service. The ‘Referer’ header is checked using exact prefix matching.
referer_blocklist (list | None) – A list of blocked referer URLs for the token. If set, HTTP requests from these referers will be denied access to the service. The ‘Referer’ header is checked using exact prefix matching.
- Raises:
requests.HTTPError – If the user is not permitted to access the dataset or if an error occurred
- Returns:
a share token and its corresponding data
- Return type:
Examples
>>> # Basic OGC Tiles service sharing for 1 hour >>> uscb_data = geodesic.get_datasets(search='uscb-pop-centers')[0] >>> uscb_token = uscb_data.share_as_ogc_tiles_service( ... alias="Population Centers Tiles", ... description="Vector tiles for population centers visualization", ... ttl=3600 ... ) >>> uscb_url = uscb_token.get_ogc_vector_tile_url()
>>> # Share with security restrictions for web mapping >>> import datetime >>> secure_token = uscb_data.share_as_ogc_tiles_service( ... alias="Secure Tile Service", ... description="Restricted tile access for internal mapping applications", ... ttl=datetime.timedelta(hours=12), ... pin_version=True, ... referer_allowlist=["https://internal-maps.company.com", "https://dashboard.company.com"], ... referer_blocklist=["https://external-site.com"] ... )
>>> # Create persistent tile service for production mapping >>> production_token = uscb_data.share_as_ogc_tiles_service( ... alias="Production Tile Service", ... description="Long-term tile service for production web maps", ... pin_version=True ... ) # No TTL for permanent access