diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 4204a4d75848..d272d4d93462 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -2197,6 +2197,10 @@ "filename": ".github/**/ml/**", "words": ["envml", "paginators"] }, + { + "filename": "sdk/planetarycomputer/azure-planetarycomputer/**", + "words": ["topo", "haline", "Aproperty", "pygen"] + }, { "filename": "sdk/agentserver/azure-ai-agentserver-githubcopilot/**", "words": ["RAPI", "BYOK", "byok", "NCUS", "ncusacr", "fstring", "ename", "valeriepham", "coreai", "Vnext", "PYTHONIOENCODING"] diff --git a/sdk/planetarycomputer/azure-planetarycomputer/CHANGELOG.md b/sdk/planetarycomputer/azure-planetarycomputer/CHANGELOG.md index 4f60234107db..57fba6fd0c2e 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/CHANGELOG.md +++ b/sdk/planetarycomputer/azure-planetarycomputer/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0b1 (Unreleased) +## 1.0.0 (2026-04-14) ### Features Added diff --git a/sdk/planetarycomputer/azure-planetarycomputer/README.md b/sdk/planetarycomputer/azure-planetarycomputer/README.md index 1620d4f94cc0..c3a54040640c 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/README.md +++ b/sdk/planetarycomputer/azure-planetarycomputer/README.md @@ -92,7 +92,7 @@ client = PlanetaryComputerProClient(endpoint=endpoint, credential=credential) - **Ingestion Runs**: Create and monitor ingestion runs with detailed operation tracking - **Partition Configuration**: Configure how data is partitioned and processed during ingestion -#### Shared Access Signature Operations (`client.shared_access_signature`) +#### Shared Access Signature Operations (`client.sas`) - **Token Generation**: Generate SAS tokens with configurable duration for collections to enable secure access - **Asset Signing**: Sign asset HREFs for secure downloads of managed storage assets @@ -102,6 +102,19 @@ client = PlanetaryComputerProClient(endpoint=endpoint, credential=credential) The following section provides several code snippets covering common GeoCatalog workflows. For complete working examples, see the [samples][pc_samples] directory. +- [List STAC collections](#list-stac-collections) +- [Search for STAC items](#search-for-stac-items) +- [Get STAC item details](#get-stac-item-details) +- [Create a STAC collection](#create-stac-collection) +- [Configure collection visualization](#configure-collection-visualization) +- [Register and render mosaic tiles](#register-and-render-mosaic-tiles) +- [Extract point values](#extract-point-values) +- [Generate map tiles](#generate-map-tiles) +- [Set up ingestion sources](#set-up-ingestion-sources) +- [Data ingestion management](#data-ingestion-management) +- [Generate SAS token for secure access](#generate-sas-token-for-secure-access) +- [Async operations](#async-operations) + ### List STAC Collections List all available STAC collections: @@ -115,7 +128,7 @@ endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) # List all collections -collections_response = client.stac.list_collections() +collections_response = client.stac.get_collections() for collection in collections_response.collections: print(f"Collection: {collection.id}") @@ -158,7 +171,7 @@ search_params = StacSearchParameters( limit=10 ) -search_result = client.stac.search_items(body=search_params) +search_result = client.stac.search(body=search_params) print(f"Found {len(search_result.features)} items") ``` @@ -193,38 +206,124 @@ from azure.planetarycomputer import PlanetaryComputerProClient from azure.planetarycomputer.models import ( StacCollection, StacExtensionSpatialExtent, - StacExtensionTemporalExtent, - StacExtent + StacCollectionTemporalExtent, + StacExtensionExtent, ) from azure.identity import DefaultAzureCredential endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) -# Define collection with proper extent -spatial_extent = StacExtensionSpatialExtent(bbox=[[-180.0, -90.0, 180.0, 90.0]]) -temporal_extent = StacExtensionTemporalExtent(interval=[["2023-01-01T00:00:00Z", None]]) - +# Define collection collection = StacCollection( id="my-collection", - type="Collection", - stac_version="1.0.0", description="A collection of geospatial data", license="proprietary", - extent=StacExtent( - spatial=spatial_extent, - temporal=temporal_extent + extent=StacExtensionExtent( + spatial=StacExtensionSpatialExtent(bounding_box=[[-180.0, -90.0, 180.0, 90.0]]), + temporal=StacCollectionTemporalExtent(interval=[[None, None]]), ), - links=[] + links=[], + stac_version="1.0.0", + type="Collection", ) -# Create the collection -created_collection = client.stac.create_or_update_collection( - collection_id="my-collection", - body=collection +# Create the collection (long-running operation) +poller = client.stac.begin_create_collection(body=collection) +poller.result() # Wait for completion + +print(f"Created collection: {collection.id}") +``` + +### Configure Collection Visualization + +Configure render options and tile settings to control how collection data is displayed: + +```python +from azure.planetarycomputer import PlanetaryComputerProClient +from azure.planetarycomputer.models import RenderOption, TileSettings +from azure.identity import DefaultAzureCredential + +endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" +client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) + +collection_id = "my-collection" + +# Add a render option for visualizing data +render_option = RenderOption( + id="true-color", + name="True Color", + type="raster-tile", + options="assets=image&rescale=0,255", +) +client.stac.create_render_option(collection_id=collection_id, body=render_option) + +# Configure tile settings +tile_settings = TileSettings(min_zoom=6, max_items_per_tile=10) +client.stac.replace_tile_settings(collection_id=collection_id, body=tile_settings) + +# List all render options +for option in client.stac.list_render_options(collection_id=collection_id): + print(f"Render option: {option.id} - {option.name}") +``` + +### Register and Render Mosaic Tiles + +Register a STAC search as a mosaic and retrieve tiles from it: + +```python +from azure.planetarycomputer import PlanetaryComputerProClient +from azure.identity import DefaultAzureCredential + +endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" +client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) + +# Register a mosaic search +registration = client.data.register_mosaics_search( + body={ + "collections": ["naip"], + "filter-lang": "cql2-json", + "filter": { + "op": "=", + "args": [{"property": "naip:year"}, "2021"] + }, + } ) +print(f"Search ID: {registration.search_id}") -print(f"Created collection: {created_collection.id}") +# Get TileJSON metadata for the registered mosaic +tile_json = client.data.get_searches_tile_json( + search_id=registration.search_id, + tile_matrix_set_id="WebMercatorQuad", + assets=["image"], +) +print(f"Tile URLs: {tile_json.tiles}") +print(f"Bounds: {tile_json.bounds}") +``` + +### Extract Point Values + +Extract pixel values at a specific geographic coordinate: + +```python +from azure.planetarycomputer import PlanetaryComputerProClient +from azure.identity import DefaultAzureCredential + +endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" +client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) + +# Get pixel values at a coordinate for a specific item +point_data = client.data.get_item_point( + collection_id="naip", + item_id="ga_m_3308421_se_16_060_20211114", + longitude=-84.41, + latitude=33.65, + assets=["image"], +) + +print(f"Coordinates: {point_data.coordinates}") +print(f"Band names: {point_data.band_names}") +print(f"Values: {point_data.values_property}") ``` ### Generate Map Tiles @@ -242,14 +341,15 @@ collection_id = "naip" item_id = "ga_m_3308421_se_16_060_20211114" # Get a specific tile for the item -tile_response = client.data.get_item_tile( +tile_response = client.data.get_tile( collection_id=collection_id, item_id=item_id, tile_matrix_set_id="WebMercatorQuad", z=14, # Zoom level x=4322, # Tile X coordinate y=6463, # Tile Y coordinate - assets=["image"] + assets=["image"], + format="png", ) # Save tile to file @@ -258,37 +358,73 @@ with open("tile.png", "wb") as f: f.write(chunk) ``` +### Set Up Ingestion Sources + +Configure data sources for ingestion using Managed Identity or SAS token authentication: + +```python +from azure.planetarycomputer import PlanetaryComputerProClient +from azure.planetarycomputer.models import ( + ManagedIdentityIngestionSource, + ManagedIdentityConnection, +) +from azure.identity import DefaultAzureCredential + +endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" +client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) + +# Create a Managed Identity ingestion source +source = ManagedIdentityIngestionSource( + id="my-storage-source", + connection_info=ManagedIdentityConnection( + container_uri="https://mystorage.blob.core.windows.net/geospatial-data", + object_id="00000000-0000-0000-0000-000000000000", + ), +) +created_source = client.ingestion.create_source(body=source) +print(f"Created source: {created_source.id}") + +# List available managed identities +for identity in client.ingestion.list_managed_identities(): + print(f"Identity: {identity.object_id} - {identity.resource_id}") + +# List all configured sources +for src in client.ingestion.list_sources(): + print(f"Source: {src.id} ({src.kind})") +``` + ### Data Ingestion Management Manage data ingestion operations: ```python from azure.planetarycomputer import PlanetaryComputerProClient -from azure.planetarycomputer.models import IngestionJob, PartitionType +from azure.planetarycomputer.models import IngestionDefinition, IngestionType from azure.identity import DefaultAzureCredential endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) -# Create an ingestion job -ingestion_job = IngestionJob( - collection_id="my-collection", - partition_type=PartitionType.YEAR_MONTH, - description="Ingestion job for geospatial data" +# Create an ingestion definition +ingestion = IngestionDefinition( + id="my-ingestion-001", + import_type=IngestionType.STATIC_CATALOG, + display_name="My data ingestion", + source_catalog_url="https://example.com/catalog.json", ) -created_job = client.ingestion.create_or_update_job( - job_id="ingestion-job-001", - body=ingestion_job +created = client.ingestion.create( + collection_id="my-collection", + body=ingestion, ) -print(f"Created job: {created_job.id}") -print(f"Status: {created_job.status}") +print(f"Created ingestion: {created.id}") +print(f"Status: {created.status}") -# List all ingestion jobs -jobs = client.ingestion.list_jobs() -for job in jobs.value: - print(f"Job: {job.id} - Status: {job.status}") +# List all ingestions for a collection +ingestions = client.ingestion.list(collection_id="my-collection") +for ing in ingestions: + print(f"Ingestion: {ing.id} - Status: {ing.status}") ``` ### Generate SAS Token for Secure Access @@ -297,46 +433,92 @@ Generate Shared Access Signatures for secure data access: ```python from azure.planetarycomputer import PlanetaryComputerProClient -from azure.planetarycomputer.models import SignedUrlRequest, AccessPermission from azure.identity import DefaultAzureCredential -from datetime import datetime, timedelta endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) -# Generate a SAS token for a collection -sas_request = SignedUrlRequest( - permissions=[AccessPermission.READ], - expires_on=datetime.utcnow() + timedelta(hours=1) +# Generate a SAS token for a collection (valid for 60 minutes) +token_response = client.sas.get_token( + collection_id="naip", + duration_in_minutes=60, ) -sas_response = client.shared_access_signature.generate_collection_signed_url( - collection_id="naip", - body=sas_request +print(f"SAS Token: {token_response.token}") +print(f"Expiry: {token_response.expires_on}") + +# Sign an asset HREF for secure download +signed = client.sas.get_sign( + href="https://storage.blob.core.windows.net/container/path/to/asset.tif", + duration_in_minutes=60, ) -print(f"SAS URL: {sas_response.url}") -print(f"Expires on: {sas_response.expires_on}") +print(f"Signed URL: {signed.href}") +``` + +### Async Operations + +All operations are also available as async. Use `aio` for the async client: + +```python +import asyncio +from azure.planetarycomputer.aio import PlanetaryComputerProClient +from azure.identity.aio import DefaultAzureCredential + +async def main(): + endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" + credential = DefaultAzureCredential() + + async with PlanetaryComputerProClient(endpoint=endpoint, credential=credential) as client: + # List collections + collections_response = await client.stac.get_collections() + for collection in collections_response.collections: + print(f"Collection: {collection.id}") + + # Get a specific item + item = await client.stac.get_item( + collection_id="naip", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(f"Item: {item.id}") + + await credential.close() + +asyncio.run(main()) ``` -### Troubleshooting +## Troubleshooting ### General Planetary Computer client library will raise exceptions defined in [Azure Core][python_azure_core_exceptions]. -Error codes and messages raised by the GeoCatalog service can be found in the service documentation. + +```python +from azure.core.exceptions import HttpResponseError +from azure.planetarycomputer import PlanetaryComputerProClient +from azure.identity import DefaultAzureCredential + +client = PlanetaryComputerProClient( + endpoint="https://your-endpoint.geocatalog.spatio.azure.com", + credential=DefaultAzureCredential(), +) + +try: + client.stac.get_collection(collection_id="non-existent-collection") +except HttpResponseError as e: + print(f"Status code: {e.status_code}") + print(f"Reason: {e.reason}") + print(f"Message: {e.message}") +``` ### Logging This library uses the standard [logging][python_logging] library for logging. - Basic information about HTTP sessions (URLs, headers, etc.) is logged at `INFO` level. Detailed `DEBUG` level logging, including request/response bodies and **unredacted** headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument. -See full SDK logging documentation with examples in the [Azure SDK documentation][sdk_logging_docs]. - ```python import sys import logging @@ -344,22 +526,24 @@ import logging from azure.planetarycomputer import PlanetaryComputerProClient from azure.identity import DefaultAzureCredential -logging.basicConfig(level=logging.DEBUG, - format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', - stream=sys.stdout) +# Enable DEBUG logging for all SDK calls +logging.basicConfig(level=logging.DEBUG, stream=sys.stdout) -endpoint = "https://your-endpoint.geocatalog.spatio.azure.com" -credential = DefaultAzureCredential() -client = PlanetaryComputerProClient(endpoint=endpoint, credential=credential) +client = PlanetaryComputerProClient( + endpoint="https://your-endpoint.geocatalog.spatio.azure.com", + credential=DefaultAzureCredential(), +) -# Enable logging for a specific operation +# Or enable logging for a single operation item = client.stac.get_item( collection_id="naip", item_id="ga_m_3308421_se_16_060_20211114", - logging_enable=True + logging_enable=True, ) ``` +See full SDK logging documentation in the [Azure SDK documentation][sdk_logging_docs]. + ### Optional Configuration Optional keyword arguments can be passed in at the client and per-operation level. @@ -369,7 +553,17 @@ The azure-core [reference documentation][azure_core_ref_docs] describes availabl ### More sample code -See the `samples` directory for several code snippets illustrating common patterns for working with GeoCatalog resources. +For complete working examples, see the individual sample files: + +| Scenario | Sync | Async | +|---|---|---| +| STAC Collection Management | [sample][sample_00] | [async sample][sample_00_async] | +| Ingestion Management | [sample][sample_01] | [async sample][sample_01_async] | +| STAC Specification (Items, Search) | [sample][sample_02] | [async sample][sample_02_async] | +| Shared Access Signatures | [sample][sample_03] | [async sample][sample_03_async] | +| STAC Item Tiler | [sample][sample_04] | [async sample][sample_04_async] | +| Mosaics Tiler | [sample][sample_05] | [async sample][sample_05_async] | +| Map Legends | [sample][sample_06] | [async sample][sample_06_async] | ### Additional documentation @@ -409,6 +603,21 @@ additional questions or comments. [sdk_logging_docs]: https://learn.microsoft.com/azure/developer/python/sdk/azure-sdk-logging [azure_core_ref_docs]: https://aka.ms/azsdk/python/core/docs +[sample_00]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_00_stac_collection.py +[sample_00_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_00_stac_collection_async.py +[sample_01]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_01_ingestion_management.py +[sample_01_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_01_ingestion_management_async.py +[sample_02]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_02_stac_specification.py +[sample_02_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_02_stac_specification_async.py +[sample_03]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_03_shared_access_signature.py +[sample_03_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_03_shared_access_signature_async.py +[sample_04]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_04_stac_item_tiler.py +[sample_04_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_04_stac_item_tiler_async.py +[sample_05]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_05_mosaics_tiler.py +[sample_05_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_05_mosaics_tiler_async.py +[sample_06]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_06_map_legends.py +[sample_06_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_06_map_legends_async.py + [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ [microsoft_cla]: https://cla.microsoft.com [opencode_email]: mailto:opencode@microsoft.com diff --git a/sdk/planetarycomputer/azure-planetarycomputer/_metadata.json b/sdk/planetarycomputer/azure-planetarycomputer/_metadata.json index 7443c6a23ddd..aeb25bf60e3f 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/_metadata.json +++ b/sdk/planetarycomputer/azure-planetarycomputer/_metadata.json @@ -1,6 +1,6 @@ { - "apiVersion": "2025-04-30-preview", + "apiVersion": "2026-04-15", "apiVersions": { - "Microsoft.PlanetaryComputer": "2025-04-30-preview" + "Microsoft.PlanetaryComputer": "2026-04-15" } } \ No newline at end of file diff --git a/sdk/planetarycomputer/azure-planetarycomputer/apiview-properties.json b/sdk/planetarycomputer/azure-planetarycomputer/apiview-properties.json index e7d73c6b5fb4..b71771de6cae 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/apiview-properties.json +++ b/sdk/planetarycomputer/azure-planetarycomputer/apiview-properties.json @@ -10,8 +10,6 @@ "azure.planetarycomputer.models.ErrorInfo": "Microsoft.PlanetaryComputer.ErrorInfo", "azure.planetarycomputer.models.Feature": "Feature", "azure.planetarycomputer.models.Geometry": "Geometry", - "azure.planetarycomputer.models.ImageParameters": "Microsoft.PlanetaryComputer.ImageParameters", - "azure.planetarycomputer.models.ImageResponse": "Microsoft.PlanetaryComputer.ImageResponse", "azure.planetarycomputer.models.IngestionDefinition": "Microsoft.PlanetaryComputer.IngestionDefinition", "azure.planetarycomputer.models.IngestionRun": "Microsoft.PlanetaryComputer.IngestionRun", "azure.planetarycomputer.models.IngestionRunOperation": "Microsoft.PlanetaryComputer.IngestionRunOperation", @@ -70,6 +68,7 @@ "azure.planetarycomputer.models.TileMatrix": "TileMatrix", "azure.planetarycomputer.models.TileMatrixSet": "TileMatrixSet", "azure.planetarycomputer.models.TileMatrixSetBoundingBox": "TileMatrixSetBoundingBox", + "azure.planetarycomputer.models.TileMatrixSetLimitsEntry": "Microsoft.PlanetaryComputer.TileMatrixSetLimitsEntry", "azure.planetarycomputer.models.TilerAssetGeoJson": "Microsoft.PlanetaryComputer.TilerAssetGeoJson", "azure.planetarycomputer.models.TilerCoreModelsResponsesPoint": "Microsoft.PlanetaryComputer.TilerCoreModelsResponsesPoint", "azure.planetarycomputer.models.TilerInfo": "Microsoft.PlanetaryComputer.TilerInfo", @@ -79,6 +78,11 @@ "azure.planetarycomputer.models.TilerStacItemStatistics": "Microsoft.PlanetaryComputer.TilerStacItemStatistics", "azure.planetarycomputer.models.TilerStacSearchDefinition": "Microsoft.PlanetaryComputer.TilerStacSearchDefinition", "azure.planetarycomputer.models.TilerStacSearchRegistration": "Microsoft.PlanetaryComputer.TilerStacSearchRegistration", + "azure.planetarycomputer.models.TileSetBoundingBox": "Microsoft.PlanetaryComputer.TileSetBoundingBox", + "azure.planetarycomputer.models.TileSetEntry": "Microsoft.PlanetaryComputer.TileSetEntry", + "azure.planetarycomputer.models.TileSetLink": "Microsoft.PlanetaryComputer.TileSetLink", + "azure.planetarycomputer.models.TileSetList": "Microsoft.PlanetaryComputer.TileSetList", + "azure.planetarycomputer.models.TileSetMetadata": "Microsoft.PlanetaryComputer.TileSetMetadata", "azure.planetarycomputer.models.TileSettings": "Microsoft.PlanetaryComputer.TileSettings", "azure.planetarycomputer.models.UserCollectionSettings": "Microsoft.PlanetaryComputer.UserCollectionSettings", "azure.planetarycomputer.models.VariableMatrixWidth": "VariableMatrixWidth", @@ -97,14 +101,17 @@ "azure.planetarycomputer.models.StacSearchSortingDirection": "Microsoft.PlanetaryComputer.StacSearchSortingDirection", "azure.planetarycomputer.models.FilterLanguage": "Microsoft.PlanetaryComputer.FilterLanguage", "azure.planetarycomputer.models.TileMatrixCornerOfOrigin": "TileMatrixCornerOfOrigin", - "azure.planetarycomputer.models.Resampling": "Microsoft.PlanetaryComputer.Resampling", + "azure.planetarycomputer.models.MosaicMetadataType": "Microsoft.PlanetaryComputer.MosaicMetadataType", + "azure.planetarycomputer.models.SelMethod": "Microsoft.PlanetaryComputer.SelMethod", + "azure.planetarycomputer.models.WarpKernelResampling": "Microsoft.PlanetaryComputer.WarpKernelResampling", "azure.planetarycomputer.models.TerrainAlgorithm": "Microsoft.PlanetaryComputer.TerrainAlgorithm", + "azure.planetarycomputer.models.TilerImageFormat": "Microsoft.PlanetaryComputer.TilerImageFormat", + "azure.planetarycomputer.models.Resampling": "Microsoft.PlanetaryComputer.Resampling", "azure.planetarycomputer.models.ColorMapNames": "Microsoft.PlanetaryComputer.ColorMapNames", + "azure.planetarycomputer.models.TileMatrixSetId": "Microsoft.PlanetaryComputer.TileMatrixSetId", "azure.planetarycomputer.models.FeatureType": "FeatureType", "azure.planetarycomputer.models.NoDataType": "Microsoft.PlanetaryComputer.NoDataType", - "azure.planetarycomputer.models.TilerImageFormat": "Microsoft.PlanetaryComputer.TilerImageFormat", "azure.planetarycomputer.models.TileAddressingScheme": "Microsoft.PlanetaryComputer.TileAddressingScheme", - "azure.planetarycomputer.models.MosaicMetadataType": "Microsoft.PlanetaryComputer.MosaicMetadataType", "azure.planetarycomputer.models.PixelSelection": "Microsoft.PlanetaryComputer.PixelSelection", "azure.planetarycomputer.operations.IngestionOperations.cancel_operation": "Customizations.Ingestion.cancelOperation", "azure.planetarycomputer.aio.operations.IngestionOperations.cancel_operation": "Customizations.Ingestion.cancelOperation", @@ -162,8 +169,8 @@ "azure.planetarycomputer.aio.operations.StacOperations.list_mosaics": "Customizations.Stac.listMosaics", "azure.planetarycomputer.operations.StacOperations.begin_create_collection": "Customizations.Stac.createCollection", "azure.planetarycomputer.aio.operations.StacOperations.begin_create_collection": "Customizations.Stac.createCollection", - "azure.planetarycomputer.operations.StacOperations.create_or_replace_collection": "Customizations.Stac.createOrReplaceCollection", - "azure.planetarycomputer.aio.operations.StacOperations.create_or_replace_collection": "Customizations.Stac.createOrReplaceCollection", + "azure.planetarycomputer.operations.StacOperations.replace_collection": "Customizations.Stac.replaceCollection", + "azure.planetarycomputer.aio.operations.StacOperations.replace_collection": "Customizations.Stac.replaceCollection", "azure.planetarycomputer.operations.StacOperations.begin_delete_collection": "Customizations.Stac.deleteCollection", "azure.planetarycomputer.aio.operations.StacOperations.begin_delete_collection": "Customizations.Stac.deleteCollection", "azure.planetarycomputer.operations.StacOperations.get_collection": "Customizations.Stac.getCollection", @@ -196,8 +203,8 @@ "azure.planetarycomputer.aio.operations.StacOperations.get_landing_page": "Customizations.Stac.getLandingPage", "azure.planetarycomputer.operations.StacOperations.begin_create_item": "Customizations.Stac.createItem", "azure.planetarycomputer.aio.operations.StacOperations.begin_create_item": "Customizations.Stac.createItem", - "azure.planetarycomputer.operations.StacOperations.begin_create_or_replace_item": "Customizations.Stac.createOrReplaceItem", - "azure.planetarycomputer.aio.operations.StacOperations.begin_create_or_replace_item": "Customizations.Stac.createOrReplaceItem", + "azure.planetarycomputer.operations.StacOperations.begin_replace_item": "Customizations.Stac.replaceItem", + "azure.planetarycomputer.aio.operations.StacOperations.begin_replace_item": "Customizations.Stac.replaceItem", "azure.planetarycomputer.operations.StacOperations.begin_delete_item": "Customizations.Stac.deleteItem", "azure.planetarycomputer.aio.operations.StacOperations.begin_delete_item": "Customizations.Stac.deleteItem", "azure.planetarycomputer.operations.StacOperations.get_item": "Customizations.Stac.getItem", @@ -222,69 +229,177 @@ "azure.planetarycomputer.aio.operations.DataOperations.get_tile_matrix_definitions": "Customizations.Data.getTileMatrixDefinitions", "azure.planetarycomputer.operations.DataOperations.list_tile_matrices": "Customizations.Data.listTileMatrices", "azure.planetarycomputer.aio.operations.DataOperations.list_tile_matrices": "Customizations.Data.listTileMatrices", - "azure.planetarycomputer.operations.DataOperations.get_asset_statistics": "Customizations.Data.getAssetStatistics", - "azure.planetarycomputer.aio.operations.DataOperations.get_asset_statistics": "Customizations.Data.getAssetStatistics", - "azure.planetarycomputer.operations.DataOperations.list_available_assets": "Customizations.Data.listAvailableAssets", - "azure.planetarycomputer.aio.operations.DataOperations.list_available_assets": "Customizations.Data.listAvailableAssets", - "azure.planetarycomputer.operations.DataOperations.get_bounds": "Customizations.Data.getBounds", - "azure.planetarycomputer.aio.operations.DataOperations.get_bounds": "Customizations.Data.getBounds", - "azure.planetarycomputer.operations.DataOperations.crop_geo_json": "Customizations.Data.cropGeoJson", - "azure.planetarycomputer.aio.operations.DataOperations.crop_geo_json": "Customizations.Data.cropGeoJson", - "azure.planetarycomputer.operations.DataOperations.crop_geo_json_with_dimensions": "Customizations.Data.cropGeoJsonWithDimensions", - "azure.planetarycomputer.aio.operations.DataOperations.crop_geo_json_with_dimensions": "Customizations.Data.cropGeoJsonWithDimensions", - "azure.planetarycomputer.operations.DataOperations.get_geo_json_statistics": "Customizations.Data.getGeoJsonStatistics", - "azure.planetarycomputer.aio.operations.DataOperations.get_geo_json_statistics": "Customizations.Data.getGeoJsonStatistics", - "azure.planetarycomputer.operations.DataOperations.get_info_geo_json": "Customizations.Data.getInfoGeoJson", - "azure.planetarycomputer.aio.operations.DataOperations.get_info_geo_json": "Customizations.Data.getInfoGeoJson", - "azure.planetarycomputer.operations.DataOperations.get_item_asset_details": "Customizations.Data.getItemAssetDetails", - "azure.planetarycomputer.aio.operations.DataOperations.get_item_asset_details": "Customizations.Data.getItemAssetDetails", - "azure.planetarycomputer.operations.DataOperations.get_part": "Customizations.Data.getPart", - "azure.planetarycomputer.aio.operations.DataOperations.get_part": "Customizations.Data.getPart", - "azure.planetarycomputer.operations.DataOperations.get_part_with_dimensions": "Customizations.Data.getPartWithDimensions", - "azure.planetarycomputer.aio.operations.DataOperations.get_part_with_dimensions": "Customizations.Data.getPartWithDimensions", - "azure.planetarycomputer.operations.DataOperations.get_point": "Customizations.Data.getPoint", - "azure.planetarycomputer.aio.operations.DataOperations.get_point": "Customizations.Data.getPoint", - "azure.planetarycomputer.operations.DataOperations.get_preview": "Customizations.Data.getPreview", - "azure.planetarycomputer.aio.operations.DataOperations.get_preview": "Customizations.Data.getPreview", - "azure.planetarycomputer.operations.DataOperations.get_preview_with_format": "Customizations.Data.getPreviewWithFormat", - "azure.planetarycomputer.aio.operations.DataOperations.get_preview_with_format": "Customizations.Data.getPreviewWithFormat", - "azure.planetarycomputer.operations.DataOperations.create_static_image": "Customizations.Data.createStaticImage", - "azure.planetarycomputer.aio.operations.DataOperations.create_static_image": "Customizations.Data.createStaticImage", - "azure.planetarycomputer.operations.DataOperations.get_static_image": "Customizations.Data.getStaticImage", - "azure.planetarycomputer.aio.operations.DataOperations.get_static_image": "Customizations.Data.getStaticImage", - "azure.planetarycomputer.operations.DataOperations.list_statistics": "Customizations.Data.listStatistics", - "azure.planetarycomputer.aio.operations.DataOperations.list_statistics": "Customizations.Data.listStatistics", - "azure.planetarycomputer.operations.DataOperations.get_tile_json": "Customizations.Data.getTileJson", - "azure.planetarycomputer.aio.operations.DataOperations.get_tile_json": "Customizations.Data.getTileJson", - "azure.planetarycomputer.operations.DataOperations.get_tile": "Customizations.Data.getTile", - "azure.planetarycomputer.aio.operations.DataOperations.get_tile": "Customizations.Data.getTile", - "azure.planetarycomputer.operations.DataOperations.get_wmts_capabilities": "Customizations.Data.getWmtsCapabilities", - "azure.planetarycomputer.aio.operations.DataOperations.get_wmts_capabilities": "Customizations.Data.getWmtsCapabilities", "azure.planetarycomputer.operations.DataOperations.get_class_map_legend": "Customizations.Data.getClassMapLegend", "azure.planetarycomputer.aio.operations.DataOperations.get_class_map_legend": "Customizations.Data.getClassMapLegend", "azure.planetarycomputer.operations.DataOperations.get_interval_legend": "Customizations.Data.getIntervalLegend", "azure.planetarycomputer.aio.operations.DataOperations.get_interval_legend": "Customizations.Data.getIntervalLegend", "azure.planetarycomputer.operations.DataOperations.get_legend": "Customizations.Data.getLegend", "azure.planetarycomputer.aio.operations.DataOperations.get_legend": "Customizations.Data.getLegend", - "azure.planetarycomputer.operations.DataOperations.get_mosaics_assets_for_point": "Customizations.Data.getMosaicsAssetsForPoint", - "azure.planetarycomputer.aio.operations.DataOperations.get_mosaics_assets_for_point": "Customizations.Data.getMosaicsAssetsForPoint", - "azure.planetarycomputer.operations.DataOperations.get_mosaics_assets_for_tile": "Customizations.Data.getMosaicsAssetsForTile", - "azure.planetarycomputer.aio.operations.DataOperations.get_mosaics_assets_for_tile": "Customizations.Data.getMosaicsAssetsForTile", - "azure.planetarycomputer.operations.DataOperations.get_mosaics_search_info": "Customizations.Data.getMosaicsSearchInfo", - "azure.planetarycomputer.aio.operations.DataOperations.get_mosaics_search_info": "Customizations.Data.getMosaicsSearchInfo", "azure.planetarycomputer.operations.DataOperations.register_mosaics_search": "Customizations.Data.registerMosaicsSearch", "azure.planetarycomputer.aio.operations.DataOperations.register_mosaics_search": "Customizations.Data.registerMosaicsSearch", - "azure.planetarycomputer.operations.DataOperations.get_mosaics_tile_json": "Customizations.Data.getMosaicsTileJson", - "azure.planetarycomputer.aio.operations.DataOperations.get_mosaics_tile_json": "Customizations.Data.getMosaicsTileJson", - "azure.planetarycomputer.operations.DataOperations.get_mosaics_tile": "Customizations.Data.getMosaicsTile", - "azure.planetarycomputer.aio.operations.DataOperations.get_mosaics_tile": "Customizations.Data.getMosaicsTile", - "azure.planetarycomputer.operations.DataOperations.get_mosaics_wmts_capabilities": "Customizations.Data.getMosaicsWmtsCapabilities", - "azure.planetarycomputer.aio.operations.DataOperations.get_mosaics_wmts_capabilities": "Customizations.Data.getMosaicsWmtsCapabilities", - "azure.planetarycomputer.operations.SharedAccessSignatureOperations.get_sign": "Customizations.SharedAccessSignature.getSign", - "azure.planetarycomputer.aio.operations.SharedAccessSignatureOperations.get_sign": "Customizations.SharedAccessSignature.getSign", - "azure.planetarycomputer.operations.SharedAccessSignatureOperations.get_token": "Customizations.SharedAccessSignature.getToken", - "azure.planetarycomputer.aio.operations.SharedAccessSignatureOperations.get_token": "Customizations.SharedAccessSignature.getToken", - "azure.planetarycomputer.operations.SharedAccessSignatureOperations.revoke_token": "Customizations.SharedAccessSignature.revokeToken", - "azure.planetarycomputer.aio.operations.SharedAccessSignatureOperations.revoke_token": "Customizations.SharedAccessSignature.revokeToken" + "azure.planetarycomputer.operations.DataOperations.list_tilesets": "Customizations.Data.listTilesets", + "azure.planetarycomputer.aio.operations.DataOperations.list_tilesets": "Customizations.Data.listTilesets", + "azure.planetarycomputer.operations.DataOperations.get_tileset_metadata": "Customizations.Data.getTilesetMetadata", + "azure.planetarycomputer.aio.operations.DataOperations.get_tileset_metadata": "Customizations.Data.getTilesetMetadata", + "azure.planetarycomputer.operations.DataOperations.get_tile": "Customizations.Data.getTile", + "azure.planetarycomputer.aio.operations.DataOperations.get_tile": "Customizations.Data.getTile", + "azure.planetarycomputer.operations.DataOperations.get_tile_by_format": "Customizations.Data.getTileByFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_tile_by_format": "Customizations.Data.getTileByFormat", + "azure.planetarycomputer.operations.DataOperations.get_tile_by_scale": "Customizations.Data.getTileByScale", + "azure.planetarycomputer.aio.operations.DataOperations.get_tile_by_scale": "Customizations.Data.getTileByScale", + "azure.planetarycomputer.operations.DataOperations.get_tile_by_scale_and_format": "Customizations.Data.getTileByScaleAndFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_tile_by_scale_and_format": "Customizations.Data.getTileByScaleAndFormat", + "azure.planetarycomputer.operations.DataOperations.get_tile_no_tms": "Customizations.Data.getTileNoTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_tile_no_tms": "Customizations.Data.getTileNoTms", + "azure.planetarycomputer.operations.DataOperations.get_tile_no_tms_by_format": "Customizations.Data.getTileNoTmsByFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_tile_no_tms_by_format": "Customizations.Data.getTileNoTmsByFormat", + "azure.planetarycomputer.operations.DataOperations.get_tile_no_tms_by_scale": "Customizations.Data.getTileNoTmsByScale", + "azure.planetarycomputer.aio.operations.DataOperations.get_tile_no_tms_by_scale": "Customizations.Data.getTileNoTmsByScale", + "azure.planetarycomputer.operations.DataOperations.get_tile_no_tms_by_scale_and_format": "Customizations.Data.getTileNoTmsByScaleAndFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_tile_no_tms_by_scale_and_format": "Customizations.Data.getTileNoTmsByScaleAndFormat", + "azure.planetarycomputer.operations.DataOperations.crop_feature_geo_json": "Customizations.Data.cropFeatureGeoJson", + "azure.planetarycomputer.aio.operations.DataOperations.crop_feature_geo_json": "Customizations.Data.cropFeatureGeoJson", + "azure.planetarycomputer.operations.DataOperations.crop_feature_geo_json_format": "Customizations.Data.cropFeatureGeoJsonFormat", + "azure.planetarycomputer.aio.operations.DataOperations.crop_feature_geo_json_format": "Customizations.Data.cropFeatureGeoJsonFormat", + "azure.planetarycomputer.operations.DataOperations.crop_feature_geo_json_width_by_height": "Customizations.Data.cropFeatureGeoJsonWidthByHeight", + "azure.planetarycomputer.aio.operations.DataOperations.crop_feature_geo_json_width_by_height": "Customizations.Data.cropFeatureGeoJsonWidthByHeight", + "azure.planetarycomputer.operations.DataOperations.get_item_bounds": "Customizations.Data.getItemBounds", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_bounds": "Customizations.Data.getItemBounds", + "azure.planetarycomputer.operations.DataOperations.get_item_info": "Customizations.Data.getItemInfo", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_info": "Customizations.Data.getItemInfo", + "azure.planetarycomputer.operations.DataOperations.get_item_info_geo_json": "Customizations.Data.getItemInfoGeoJson", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_info_geo_json": "Customizations.Data.getItemInfoGeoJson", + "azure.planetarycomputer.operations.DataOperations.list_item_available_assets": "Customizations.Data.listItemAvailableAssets", + "azure.planetarycomputer.aio.operations.DataOperations.list_item_available_assets": "Customizations.Data.listItemAvailableAssets", + "azure.planetarycomputer.operations.DataOperations.get_item_asset_statistics": "Customizations.Data.getItemAssetStatistics", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_asset_statistics": "Customizations.Data.getItemAssetStatistics", + "azure.planetarycomputer.operations.DataOperations.list_item_statistics": "Customizations.Data.listItemStatistics", + "azure.planetarycomputer.aio.operations.DataOperations.list_item_statistics": "Customizations.Data.listItemStatistics", + "azure.planetarycomputer.operations.DataOperations.get_item_geo_json_statistics": "Customizations.Data.getItemGeoJsonStatistics", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_geo_json_statistics": "Customizations.Data.getItemGeoJsonStatistics", + "azure.planetarycomputer.operations.DataOperations.get_item_tile_json": "Customizations.Data.getItemTileJson", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_tile_json": "Customizations.Data.getItemTileJson", + "azure.planetarycomputer.operations.DataOperations.get_item_tile_json_tms": "Customizations.Data.getItemTileJsonTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_tile_json_tms": "Customizations.Data.getItemTileJsonTms", + "azure.planetarycomputer.operations.DataOperations.get_item_wmts_capabilities": "Customizations.Data.getItemWmtsCapabilities", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_wmts_capabilities": "Customizations.Data.getItemWmtsCapabilities", + "azure.planetarycomputer.operations.DataOperations.get_item_wmts_capabilities_tms": "Customizations.Data.getItemWmtsCapabilitiesTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_wmts_capabilities_tms": "Customizations.Data.getItemWmtsCapabilitiesTms", + "azure.planetarycomputer.operations.DataOperations.get_item_point": "Customizations.Data.getItemPoint", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_point": "Customizations.Data.getItemPoint", + "azure.planetarycomputer.operations.DataOperations.get_item_preview": "Customizations.Data.getItemPreview", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_preview": "Customizations.Data.getItemPreview", + "azure.planetarycomputer.operations.DataOperations.get_item_preview_with_format": "Customizations.Data.getItemPreviewWithFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_preview_with_format": "Customizations.Data.getItemPreviewWithFormat", + "azure.planetarycomputer.operations.DataOperations.get_item_bbox_crop": "Customizations.Data.getItemBboxCrop", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_bbox_crop": "Customizations.Data.getItemBboxCrop", + "azure.planetarycomputer.operations.DataOperations.get_item_bbox_crop_with_dimensions": "Customizations.Data.getItemBboxCropWithDimensions", + "azure.planetarycomputer.aio.operations.DataOperations.get_item_bbox_crop_with_dimensions": "Customizations.Data.getItemBboxCropWithDimensions", + "azure.planetarycomputer.operations.DataOperations.list_collection_tilesets": "Customizations.Data.listCollectionTilesets", + "azure.planetarycomputer.aio.operations.DataOperations.list_collection_tilesets": "Customizations.Data.listCollectionTilesets", + "azure.planetarycomputer.operations.DataOperations.get_collection_tileset_metadata": "Customizations.Data.getCollectionTilesetMetadata", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tileset_metadata": "Customizations.Data.getCollectionTilesetMetadata", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile_by_scale_and_format": "Customizations.Data.getCollectionTileByScaleAndFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile_by_scale_and_format": "Customizations.Data.getCollectionTileByScaleAndFormat", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile": "Customizations.Data.getCollectionTile", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile": "Customizations.Data.getCollectionTile", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile_by_format": "Customizations.Data.getCollectionTileByFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile_by_format": "Customizations.Data.getCollectionTileByFormat", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile_by_scale": "Customizations.Data.getCollectionTileByScale", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile_by_scale": "Customizations.Data.getCollectionTileByScale", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile_no_tms_by_scale_and_format": "Customizations.Data.getCollectionTileNoTmsByScaleAndFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile_no_tms_by_scale_and_format": "Customizations.Data.getCollectionTileNoTmsByScaleAndFormat", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile_no_tms": "Customizations.Data.getCollectionTileNoTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile_no_tms": "Customizations.Data.getCollectionTileNoTms", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile_no_tms_by_format": "Customizations.Data.getCollectionTileNoTmsByFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile_no_tms_by_format": "Customizations.Data.getCollectionTileNoTmsByFormat", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile_no_tms_by_scale": "Customizations.Data.getCollectionTileNoTmsByScale", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile_no_tms_by_scale": "Customizations.Data.getCollectionTileNoTmsByScale", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile_json": "Customizations.Data.getCollectionTileJson", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile_json": "Customizations.Data.getCollectionTileJson", + "azure.planetarycomputer.operations.DataOperations.get_collection_tile_json_tms": "Customizations.Data.getCollectionTileJsonTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_tile_json_tms": "Customizations.Data.getCollectionTileJsonTms", + "azure.planetarycomputer.operations.DataOperations.get_collection_wmts_capabilities": "Customizations.Data.getCollectionWmtsCapabilities", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_wmts_capabilities": "Customizations.Data.getCollectionWmtsCapabilities", + "azure.planetarycomputer.operations.DataOperations.get_collection_wmts_capabilities_tms": "Customizations.Data.getCollectionWmtsCapabilitiesTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_wmts_capabilities_tms": "Customizations.Data.getCollectionWmtsCapabilitiesTms", + "azure.planetarycomputer.operations.DataOperations.get_collection_assets_for_tile": "Customizations.Data.getCollectionAssetsForTile", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_assets_for_tile": "Customizations.Data.getCollectionAssetsForTile", + "azure.planetarycomputer.operations.DataOperations.get_collection_assets_for_tile_no_tms": "Customizations.Data.getCollectionAssetsForTileNoTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_assets_for_tile_no_tms": "Customizations.Data.getCollectionAssetsForTileNoTms", + "azure.planetarycomputer.operations.DataOperations.get_collection_assets_for_bbox": "Customizations.Data.getCollectionAssetsForBbox", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_assets_for_bbox": "Customizations.Data.getCollectionAssetsForBbox", + "azure.planetarycomputer.operations.DataOperations.get_collection_info": "Customizations.Data.getCollectionInfo", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_info": "Customizations.Data.getCollectionInfo", + "azure.planetarycomputer.operations.DataOperations.get_collection_bbox_crop": "Customizations.Data.getCollectionBboxCrop", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_bbox_crop": "Customizations.Data.getCollectionBboxCrop", + "azure.planetarycomputer.operations.DataOperations.get_collection_bbox_crop_with_dimensions": "Customizations.Data.getCollectionBboxCropWithDimensions", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_bbox_crop_with_dimensions": "Customizations.Data.getCollectionBboxCropWithDimensions", + "azure.planetarycomputer.operations.DataOperations.crop_collection_feature_geo_json": "Customizations.Data.cropCollectionFeatureGeoJson", + "azure.planetarycomputer.aio.operations.DataOperations.crop_collection_feature_geo_json": "Customizations.Data.cropCollectionFeatureGeoJson", + "azure.planetarycomputer.operations.DataOperations.crop_collection_feature_geo_json_format": "Customizations.Data.cropCollectionFeatureGeoJsonFormat", + "azure.planetarycomputer.aio.operations.DataOperations.crop_collection_feature_geo_json_format": "Customizations.Data.cropCollectionFeatureGeoJsonFormat", + "azure.planetarycomputer.operations.DataOperations.crop_collection_feature_geo_json_width_by_height": "Customizations.Data.cropCollectionFeatureGeoJsonWidthByHeight", + "azure.planetarycomputer.aio.operations.DataOperations.crop_collection_feature_geo_json_width_by_height": "Customizations.Data.cropCollectionFeatureGeoJsonWidthByHeight", + "azure.planetarycomputer.operations.DataOperations.get_collection_point": "Customizations.Data.getCollectionPoint", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_point": "Customizations.Data.getCollectionPoint", + "azure.planetarycomputer.operations.DataOperations.get_collection_point_assets": "Customizations.Data.getCollectionPointAssets", + "azure.planetarycomputer.aio.operations.DataOperations.get_collection_point_assets": "Customizations.Data.getCollectionPointAssets", + "azure.planetarycomputer.operations.DataOperations.list_searches_tilesets": "Customizations.Data.listSearchesTilesets", + "azure.planetarycomputer.aio.operations.DataOperations.list_searches_tilesets": "Customizations.Data.listSearchesTilesets", + "azure.planetarycomputer.operations.DataOperations.get_searches_tileset_metadata": "Customizations.Data.getSearchesTilesetMetadata", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tileset_metadata": "Customizations.Data.getSearchesTilesetMetadata", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile_by_scale_and_format": "Customizations.Data.getSearchesTileByScaleAndFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile_by_scale_and_format": "Customizations.Data.getSearchesTileByScaleAndFormat", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile": "Customizations.Data.getSearchesTile", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile": "Customizations.Data.getSearchesTile", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile_by_format": "Customizations.Data.getSearchesTileByFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile_by_format": "Customizations.Data.getSearchesTileByFormat", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile_by_scale": "Customizations.Data.getSearchesTileByScale", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile_by_scale": "Customizations.Data.getSearchesTileByScale", + "azure.planetarycomputer.operations.DataOperations.get_searches_assets_for_tile": "Customizations.Data.getSearchesAssetsForTile", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_assets_for_tile": "Customizations.Data.getSearchesAssetsForTile", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile_json_tms": "Customizations.Data.getSearchesTileJsonTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile_json_tms": "Customizations.Data.getSearchesTileJsonTms", + "azure.planetarycomputer.operations.DataOperations.get_searches_wmts_capabilities_tms": "Customizations.Data.getSearchesWmtsCapabilitiesTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_wmts_capabilities_tms": "Customizations.Data.getSearchesWmtsCapabilitiesTms", + "azure.planetarycomputer.operations.DataOperations.get_searches_info": "Customizations.Data.getSearchesInfo", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_info": "Customizations.Data.getSearchesInfo", + "azure.planetarycomputer.operations.DataOperations.get_searches_bbox_crop": "Customizations.Data.getSearchesBboxCrop", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_bbox_crop": "Customizations.Data.getSearchesBboxCrop", + "azure.planetarycomputer.operations.DataOperations.get_searches_bbox_crop_with_dimensions": "Customizations.Data.getSearchesBboxCropWithDimensions", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_bbox_crop_with_dimensions": "Customizations.Data.getSearchesBboxCropWithDimensions", + "azure.planetarycomputer.operations.DataOperations.get_searches_bbox_assets": "Customizations.Data.getSearchesBboxAssets", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_bbox_assets": "Customizations.Data.getSearchesBboxAssets", + "azure.planetarycomputer.operations.DataOperations.crop_searches_feature_geo_json": "Customizations.Data.cropSearchesFeatureGeoJson", + "azure.planetarycomputer.aio.operations.DataOperations.crop_searches_feature_geo_json": "Customizations.Data.cropSearchesFeatureGeoJson", + "azure.planetarycomputer.operations.DataOperations.crop_searches_feature_geo_json_format": "Customizations.Data.cropSearchesFeatureGeoJsonFormat", + "azure.planetarycomputer.aio.operations.DataOperations.crop_searches_feature_geo_json_format": "Customizations.Data.cropSearchesFeatureGeoJsonFormat", + "azure.planetarycomputer.operations.DataOperations.crop_searches_feature_geo_json_width_by_height": "Customizations.Data.cropSearchesFeatureGeoJsonWidthByHeight", + "azure.planetarycomputer.aio.operations.DataOperations.crop_searches_feature_geo_json_width_by_height": "Customizations.Data.cropSearchesFeatureGeoJsonWidthByHeight", + "azure.planetarycomputer.operations.DataOperations.get_searches_wmts_capabilities": "Customizations.Data.getSearchesWmtsCapabilities", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_wmts_capabilities": "Customizations.Data.getSearchesWmtsCapabilities", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile_json": "Customizations.Data.getSearchesTileJson", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile_json": "Customizations.Data.getSearchesTileJson", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile_no_tms": "Customizations.Data.getSearchesTileNoTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile_no_tms": "Customizations.Data.getSearchesTileNoTms", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile_no_tms_by_format": "Customizations.Data.getSearchesTileNoTmsByFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile_no_tms_by_format": "Customizations.Data.getSearchesTileNoTmsByFormat", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile_no_tms_by_scale": "Customizations.Data.getSearchesTileNoTmsByScale", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile_no_tms_by_scale": "Customizations.Data.getSearchesTileNoTmsByScale", + "azure.planetarycomputer.operations.DataOperations.get_searches_tile_no_tms_by_scale_and_format": "Customizations.Data.getSearchesTileNoTmsByScaleAndFormat", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_tile_no_tms_by_scale_and_format": "Customizations.Data.getSearchesTileNoTmsByScaleAndFormat", + "azure.planetarycomputer.operations.DataOperations.get_searches_assets_for_tile_no_tms": "Customizations.Data.getSearchesAssetsForTileNoTms", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_assets_for_tile_no_tms": "Customizations.Data.getSearchesAssetsForTileNoTms", + "azure.planetarycomputer.operations.DataOperations.get_searches_point": "Customizations.Data.getSearchesPoint", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_point": "Customizations.Data.getSearchesPoint", + "azure.planetarycomputer.operations.DataOperations.get_searches_point_with_assets": "Customizations.Data.getSearchesPointWithAssets", + "azure.planetarycomputer.aio.operations.DataOperations.get_searches_point_with_assets": "Customizations.Data.getSearchesPointWithAssets", + "azure.planetarycomputer.operations.SasOperations.get_sign": "Customizations.SharedAccessSignature.getSign", + "azure.planetarycomputer.aio.operations.SasOperations.get_sign": "Customizations.SharedAccessSignature.getSign", + "azure.planetarycomputer.operations.SasOperations.get_token": "Customizations.SharedAccessSignature.getToken", + "azure.planetarycomputer.aio.operations.SasOperations.get_token": "Customizations.SharedAccessSignature.getToken", + "azure.planetarycomputer.operations.SasOperations.revoke_token": "Customizations.SharedAccessSignature.revokeToken", + "azure.planetarycomputer.aio.operations.SasOperations.revoke_token": "Customizations.SharedAccessSignature.revokeToken" } } \ No newline at end of file diff --git a/sdk/planetarycomputer/azure-planetarycomputer/assets.json b/sdk/planetarycomputer/azure-planetarycomputer/assets.json index c5a61b1df3c7..db79ee77c2af 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/assets.json +++ b/sdk/planetarycomputer/azure-planetarycomputer/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/planetarycomputer/azure-planetarycomputer", - "Tag": "python/planetarycomputer/azure-planetarycomputer_5c0901687d" + "Tag": "python/planetarycomputer/azure-planetarycomputer_52337a546c" } diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_client.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_client.py index 40eb821cb51d..94d2495cdf15 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_client.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_client.py @@ -16,7 +16,7 @@ from ._configuration import PlanetaryComputerProClientConfiguration from ._utils.serialization import Deserializer, Serializer -from .operations import DataOperations, IngestionOperations, SharedAccessSignatureOperations, StacOperations +from .operations import DataOperations, IngestionOperations, SasOperations, StacOperations if TYPE_CHECKING: from azure.core.credentials import TokenCredential @@ -31,16 +31,17 @@ class PlanetaryComputerProClient: :vartype stac: azure.planetarycomputer.operations.StacOperations :ivar data: DataOperations operations :vartype data: azure.planetarycomputer.operations.DataOperations - :ivar shared_access_signature: SharedAccessSignatureOperations operations - :vartype shared_access_signature: - azure.planetarycomputer.operations.SharedAccessSignatureOperations - :param endpoint: Service host. Required. + :ivar sas: SasOperations operations + :vartype sas: azure.planetarycomputer.operations.SasOperations + :param endpoint: GeoCatalog endpoint, e.g. + `https://contoso-catalog.gwhqfdeddydpareu.uksouth.geocatalog.spatio.azure.com + `_. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Known values are - "2025-04-30-preview" and None. Default value is "2025-04-30-preview". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2026-04-15". + Default value is "2026-04-15". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -75,9 +76,7 @@ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) self.ingestion = IngestionOperations(self._client, self._config, self._serialize, self._deserialize) self.stac = StacOperations(self._client, self._config, self._serialize, self._deserialize) self.data = DataOperations(self._client, self._config, self._serialize, self._deserialize) - self.shared_access_signature = SharedAccessSignatureOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.sas = SasOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_configuration.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_configuration.py index c20ae5505446..936350423d07 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_configuration.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_configuration.py @@ -22,18 +22,20 @@ class PlanetaryComputerProClientConfiguration: # pylint: disable=too-many-insta Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: GeoCatalog endpoint, e.g. + `https://contoso-catalog.gwhqfdeddydpareu.uksouth.geocatalog.spatio.azure.com + `_. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: The API version to use for this operation. Known values are - "2025-04-30-preview" and None. Default value is "2025-04-30-preview". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2026-04-15". + Default value is "2026-04-15". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-04-30-preview") + api_version: str = kwargs.pop("api_version", "2026-04-15") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_utils/model_base.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_utils/model_base.py index 4d0183227b6d..eef4e52ed1a0 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_utils/model_base.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_utils/model_base.py @@ -22,7 +22,7 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -515,6 +515,8 @@ def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: return self._data.setdefault(key, default) def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data try: other_model = self.__class__(other) except Exception: @@ -598,54 +600,9 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: for rest_field in self._attr_to_rest_field.values() if rest_field._default is not _UNSET } - if args: # pylint: disable=too-many-nested-blocks + if args: if isinstance(args[0], ET.Element): - existed_attr_keys = [] - model_meta = getattr(self, "_xml", {}) - - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - if prop_meta.get("itemsName"): - xml_name = prop_meta.get("itemsName") - xml_ns = prop_meta.get("itemNs") - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = args[0].findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) - continue - - # text element is primitive type - if prop_meta.get("text", False): - if args[0].text is not None: - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = args[0].find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in args[0]: - if e.tag not in existed_attr_keys: - dict_to_pass[e.tag] = _convert_element(e) + dict_to_pass.update(self._init_from_xml(args[0])) else: dict_to_pass.update( {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} @@ -664,6 +621,69 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: ) super().__init__(dict_to_pass) + def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + model_meta = getattr(self, "_xml", {}) + existed_attr_keys: list[str] = [] + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + def copy(self) -> "Model": return Model(self.__dict__) @@ -694,7 +714,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: } cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint: disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: @@ -730,7 +750,7 @@ def _deserialize(cls, data, exist_discriminators): model_meta = getattr(cls, "_xml", {}) prop_meta = getattr(discriminator, "_xml", {}) xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) if xml_ns: xml_name = "{" + xml_ns + "}" + xml_name @@ -903,6 +923,8 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur # is it optional? try: if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True if len(annotation.__args__) <= 2: # pyright: ignore if_obj_deserializer = _get_deserialize_callable_from_annotation( next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore @@ -995,16 +1017,20 @@ def _deserialize_with_callable( return float(value.text) if value.text else None if deserializer is bool: return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None if deserializer is None: return value if deserializer in [int, float, bool]: return deserializer(value) if isinstance(deserializer, CaseInsensitiveEnumMeta): try: - return deserializer(value) + return deserializer(value.text if isinstance(value, ET.Element) else value) except ValueError: # for unknown value, return raw value - return value + return value.text if isinstance(value, ET.Element) else value if isinstance(deserializer, type) and issubclass(deserializer, Model): return deserializer._deserialize(value, []) return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) @@ -1078,6 +1104,7 @@ def __init__( self._is_discriminator = is_discriminator self._visibility = visibility self._is_model = False + self._is_optional = False self._default = default self._format = format self._is_multipart_file_input = is_multipart_file_input @@ -1196,6 +1223,56 @@ def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore +def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + def _get_element( o: typing.Any, exclude_readonly: bool = False, @@ -1207,10 +1284,16 @@ def _get_element( # if prop is a model, then use the prop element directly, else generate a wrapper of model if wrapped_element is None: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) wrapped_element = _create_xml_element( - model_meta.get("name", o.__class__.__name__), + element_name, model_meta.get("prefix"), - model_meta.get("ns"), + _model_ns, ) readonly_props = [] @@ -1232,7 +1315,9 @@ def _get_element( # additional properties will not have rest field, use the wire name as xml name prop_meta = {"name": k} - # if no ns for prop, use model's + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. if prop_meta.get("ns") is None and model_meta.get("ns"): prop_meta["ns"] = model_meta.get("ns") prop_meta["prefix"] = model_meta.get("prefix") @@ -1244,12 +1329,7 @@ def _get_element( # text could only set on primitive type wrapped_element.text = _get_primitive_type_value(v) elif prop_meta.get("attribute", False): - xml_name = prop_meta.get("name", k) - if prop_meta.get("ns"): - ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore - xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore - # attribute should be primitive type - wrapped_element.set(xml_name, _get_primitive_type_value(v)) + _set_xml_attribute(wrapped_element, k, v, prop_meta) else: # other wrapped prop element wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) @@ -1258,6 +1338,7 @@ def _get_element( return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore if isinstance(o, dict): result = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None for k, v in o.items(): result.append( _get_wrapped_element( @@ -1265,7 +1346,7 @@ def _get_element( exclude_readonly, { "name": k, - "ns": parent_meta.get("ns") if parent_meta else None, + "ns": _dict_ns, "prefix": parent_meta.get("prefix") if parent_meta else None, }, ) @@ -1274,13 +1355,16 @@ def _get_element( # primitive case need to create element based on parent_meta if parent_meta: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(parent_meta) return _get_wrapped_element( o, exclude_readonly, { "name": parent_meta.get("itemsName", parent_meta.get("name")), "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + "ns": _items_ns, }, ) @@ -1292,8 +1376,9 @@ def _get_wrapped_element( exclude_readonly: bool, meta: typing.Optional[dict[str, typing.Any]], ) -> ET.Element: + _meta_ns = _get_xml_ns(meta) if meta else None wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns ) if isinstance(v, (dict, list)): wrapped_element.extend(_get_element(v, exclude_readonly, meta)) @@ -1314,11 +1399,29 @@ def _get_primitive_type_value(v) -> str: return str(v) +def _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: + ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + def _create_xml_element( tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None ) -> ET.Element: if prefix and ns: - ET.register_namespace(prefix, ns) + _safe_register_namespace(prefix, ns) if ns: return ET.Element("{" + ns + "}" + tag) return ET.Element(tag) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_validation.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_validation.py new file mode 100644 index 000000000000..f5af3a4eb8a2 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_validation.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if _index_with_default(method_added_on) > _index_with_default(client_api_version): + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_version.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_version.py index be71c81bd282..0ec13ea52bbf 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_version.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0" diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/_client.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/_client.py index 18f8deda42a5..5b4f909e1c47 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/_client.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/_client.py @@ -16,7 +16,7 @@ from .._utils.serialization import Deserializer, Serializer from ._configuration import PlanetaryComputerProClientConfiguration -from .operations import DataOperations, IngestionOperations, SharedAccessSignatureOperations, StacOperations +from .operations import DataOperations, IngestionOperations, SasOperations, StacOperations if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential @@ -31,16 +31,17 @@ class PlanetaryComputerProClient: :vartype stac: azure.planetarycomputer.aio.operations.StacOperations :ivar data: DataOperations operations :vartype data: azure.planetarycomputer.aio.operations.DataOperations - :ivar shared_access_signature: SharedAccessSignatureOperations operations - :vartype shared_access_signature: - azure.planetarycomputer.aio.operations.SharedAccessSignatureOperations - :param endpoint: Service host. Required. + :ivar sas: SasOperations operations + :vartype sas: azure.planetarycomputer.aio.operations.SasOperations + :param endpoint: GeoCatalog endpoint, e.g. + `https://contoso-catalog.gwhqfdeddydpareu.uksouth.geocatalog.spatio.azure.com + `_. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Known values are - "2025-04-30-preview" and None. Default value is "2025-04-30-preview". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2026-04-15". + Default value is "2026-04-15". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -75,9 +76,7 @@ def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: self.ingestion = IngestionOperations(self._client, self._config, self._serialize, self._deserialize) self.stac = StacOperations(self._client, self._config, self._serialize, self._deserialize) self.data = DataOperations(self._client, self._config, self._serialize, self._deserialize) - self.shared_access_signature = SharedAccessSignatureOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.sas = SasOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/_configuration.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/_configuration.py index a72ad88a8cf1..f6474e52d2e2 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/_configuration.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/_configuration.py @@ -22,18 +22,20 @@ class PlanetaryComputerProClientConfiguration: # pylint: disable=too-many-insta Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: GeoCatalog endpoint, e.g. + `https://contoso-catalog.gwhqfdeddydpareu.uksouth.geocatalog.spatio.azure.com + `_. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: The API version to use for this operation. Known values are - "2025-04-30-preview" and None. Default value is "2025-04-30-preview". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are "2026-04-15". + Default value is "2026-04-15". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-04-30-preview") + api_version: str = kwargs.pop("api_version", "2026-04-15") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/__init__.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/__init__.py index 8ebab4777f3c..77959284ac2c 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/__init__.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/__init__.py @@ -15,7 +15,7 @@ from ._operations import IngestionOperations # type: ignore from ._operations import StacOperations # type: ignore from ._operations import DataOperations # type: ignore -from ._operations import SharedAccessSignatureOperations # type: ignore +from ._operations import SasOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -25,7 +25,7 @@ "IngestionOperations", "StacOperations", "DataOperations", - "SharedAccessSignatureOperations", + "SasOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/_operations.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/_operations.py index 54bc3f1903ec..075e38402045 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/_operations.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from io import IOBase import json from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload @@ -33,40 +33,95 @@ from azure.core.utils import case_insensitive_dict from ... import models as _models +# TODO: Remove pylint disable once pygen emitter fixes unused _deserialize_xml import from ..._utils.model_base import Model as _Model, SdkJSONEncoder, _deserialize, _deserialize_xml # pylint: disable=unused-import from ..._utils.serialization import Deserializer, Serializer from ..._utils.utils import prepare_multipart_form_data from ...operations._operations import ( - build_data_create_static_image_request, - build_data_crop_geo_json_request, - build_data_crop_geo_json_with_dimensions_request, - build_data_get_asset_statistics_request, - build_data_get_bounds_request, + build_data_crop_collection_feature_geo_json_format_request, + build_data_crop_collection_feature_geo_json_request, + build_data_crop_collection_feature_geo_json_width_by_height_request, + build_data_crop_feature_geo_json_format_request, + build_data_crop_feature_geo_json_request, + build_data_crop_feature_geo_json_width_by_height_request, + build_data_crop_searches_feature_geo_json_format_request, + build_data_crop_searches_feature_geo_json_request, + build_data_crop_searches_feature_geo_json_width_by_height_request, build_data_get_class_map_legend_request, - build_data_get_geo_json_statistics_request, - build_data_get_info_geo_json_request, + build_data_get_collection_assets_for_bbox_request, + build_data_get_collection_assets_for_tile_no_tms_request, + build_data_get_collection_assets_for_tile_request, + build_data_get_collection_bbox_crop_request, + build_data_get_collection_bbox_crop_with_dimensions_request, + build_data_get_collection_info_request, + build_data_get_collection_point_assets_request, + build_data_get_collection_point_request, + build_data_get_collection_tile_by_format_request, + build_data_get_collection_tile_by_scale_and_format_request, + build_data_get_collection_tile_by_scale_request, + build_data_get_collection_tile_json_request, + build_data_get_collection_tile_json_tms_request, + build_data_get_collection_tile_no_tms_by_format_request, + build_data_get_collection_tile_no_tms_by_scale_and_format_request, + build_data_get_collection_tile_no_tms_by_scale_request, + build_data_get_collection_tile_no_tms_request, + build_data_get_collection_tile_request, + build_data_get_collection_tileset_metadata_request, + build_data_get_collection_wmts_capabilities_request, + build_data_get_collection_wmts_capabilities_tms_request, build_data_get_interval_legend_request, - build_data_get_item_asset_details_request, + build_data_get_item_asset_statistics_request, + build_data_get_item_bbox_crop_request, + build_data_get_item_bbox_crop_with_dimensions_request, + build_data_get_item_bounds_request, + build_data_get_item_geo_json_statistics_request, + build_data_get_item_info_geo_json_request, + build_data_get_item_info_request, + build_data_get_item_point_request, + build_data_get_item_preview_request, + build_data_get_item_preview_with_format_request, + build_data_get_item_tile_json_request, + build_data_get_item_tile_json_tms_request, + build_data_get_item_wmts_capabilities_request, + build_data_get_item_wmts_capabilities_tms_request, build_data_get_legend_request, - build_data_get_mosaics_assets_for_point_request, - build_data_get_mosaics_assets_for_tile_request, - build_data_get_mosaics_search_info_request, - build_data_get_mosaics_tile_json_request, - build_data_get_mosaics_tile_request, - build_data_get_mosaics_wmts_capabilities_request, - build_data_get_part_request, - build_data_get_part_with_dimensions_request, - build_data_get_point_request, - build_data_get_preview_request, - build_data_get_preview_with_format_request, - build_data_get_static_image_request, - build_data_get_tile_json_request, + build_data_get_searches_assets_for_tile_no_tms_request, + build_data_get_searches_assets_for_tile_request, + build_data_get_searches_bbox_assets_request, + build_data_get_searches_bbox_crop_request, + build_data_get_searches_bbox_crop_with_dimensions_request, + build_data_get_searches_info_request, + build_data_get_searches_point_request, + build_data_get_searches_point_with_assets_request, + build_data_get_searches_tile_by_format_request, + build_data_get_searches_tile_by_scale_and_format_request, + build_data_get_searches_tile_by_scale_request, + build_data_get_searches_tile_json_request, + build_data_get_searches_tile_json_tms_request, + build_data_get_searches_tile_no_tms_by_format_request, + build_data_get_searches_tile_no_tms_by_scale_and_format_request, + build_data_get_searches_tile_no_tms_by_scale_request, + build_data_get_searches_tile_no_tms_request, + build_data_get_searches_tile_request, + build_data_get_searches_tileset_metadata_request, + build_data_get_searches_wmts_capabilities_request, + build_data_get_searches_wmts_capabilities_tms_request, + build_data_get_tile_by_format_request, + build_data_get_tile_by_scale_and_format_request, + build_data_get_tile_by_scale_request, build_data_get_tile_matrix_definitions_request, + build_data_get_tile_no_tms_by_format_request, + build_data_get_tile_no_tms_by_scale_and_format_request, + build_data_get_tile_no_tms_by_scale_request, + build_data_get_tile_no_tms_request, build_data_get_tile_request, - build_data_get_wmts_capabilities_request, - build_data_list_available_assets_request, - build_data_list_statistics_request, + build_data_get_tileset_metadata_request, + build_data_list_collection_tilesets_request, + build_data_list_item_available_assets_request, + build_data_list_item_statistics_request, + build_data_list_searches_tilesets_request, build_data_list_tile_matrices_request, + build_data_list_tilesets_request, build_data_register_mosaics_search_request, build_ingestion_cancel_all_operations_request, build_ingestion_cancel_operation_request, @@ -86,15 +141,13 @@ build_ingestion_list_sources_request, build_ingestion_replace_source_request, build_ingestion_update_request, - build_shared_access_signature_get_sign_request, - build_shared_access_signature_get_token_request, - build_shared_access_signature_revoke_token_request, + build_sas_get_sign_request, + build_sas_get_token_request, + build_sas_revoke_token_request, build_stac_add_mosaic_request, build_stac_create_collection_asset_request, build_stac_create_collection_request, build_stac_create_item_request, - build_stac_create_or_replace_collection_request, - build_stac_create_or_replace_item_request, build_stac_create_queryables_request, build_stac_create_render_option_request, build_stac_delete_collection_asset_request, @@ -120,6 +173,8 @@ build_stac_list_queryables_request, build_stac_list_render_options_request, build_stac_replace_collection_asset_request, + build_stac_replace_collection_request, + build_stac_replace_item_request, build_stac_replace_mosaic_request, build_stac_replace_partition_type_request, build_stac_replace_queryable_request, @@ -206,7 +261,8 @@ async def cancel_operation(self, operation_id: str, **kwargs: Any) -> None: @distributed_trace_async async def cancel_all_operations(self, **kwargs: Any) -> None: - """Cancel all running operations of a geo-catalog collection. + """Cancel all pending and running operations across the entire GeoCatalog instance. This is a + catalog-wide operation and is not scoped to a specific collection. :return: None :rtype: None @@ -283,6 +339,7 @@ async def get_operation(self, operation_id: str, **kwargs: Any) -> _models.Opera } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -300,7 +357,7 @@ async def get_operation(self, operation_id: str, **kwargs: Any) -> _models.Opera raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.Operation, response.json()) @@ -390,7 +447,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -449,6 +509,7 @@ async def create_run(self, collection_id: str, ingestion_id: str, **kwargs: Any) } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -469,7 +530,7 @@ async def create_run(self, collection_id: str, ingestion_id: str, **kwargs: Any) response_headers["location"] = self._deserialize("str", response.headers.get("location")) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.IngestionRun, response.json()) @@ -518,6 +579,7 @@ async def get_run(self, collection_id: str, ingestion_id: str, run_id: str, **kw } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -535,7 +597,7 @@ async def get_run(self, collection_id: str, ingestion_id: str, run_id: str, **kw raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.IngestionRun, response.json()) @@ -624,7 +686,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.IngestionRun], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.IngestionRun], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -754,6 +819,7 @@ async def create( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -774,7 +840,7 @@ async def create( response_headers["location"] = self._deserialize("str", response.headers.get("location")) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.IngestionDefinition, response.json()) @@ -809,6 +875,7 @@ async def _delete_initial(self, collection_id: str, ingestion_id: str, **kwargs: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -828,7 +895,7 @@ async def _delete_initial(self, collection_id: str, ingestion_id: str, **kwargs: response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -930,6 +997,7 @@ async def get(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> _mo } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -947,7 +1015,7 @@ async def get(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> _mo raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.IngestionDefinition, response.json()) @@ -1028,7 +1096,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.IngestionDefinition], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.IngestionDefinition], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1184,6 +1255,7 @@ async def update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1201,7 +1273,7 @@ async def update( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.IngestionDefinition, response.json()) @@ -1304,6 +1376,7 @@ async def create_source( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1324,7 +1397,7 @@ async def create_source( response_headers["location"] = self._deserialize("str", response.headers.get("location")) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.IngestionSource, response.json()) @@ -1436,6 +1509,7 @@ async def replace_source( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1456,7 +1530,7 @@ async def replace_source( response_headers["location"] = self._deserialize("str", response.headers.get("location")) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.IngestionSource, response.json()) @@ -1547,6 +1621,7 @@ async def get_source(self, id: str, **kwargs: Any) -> _models.IngestionSource: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1564,7 +1639,7 @@ async def get_source(self, id: str, **kwargs: Any) -> _models.IngestionSource: raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.IngestionSource, response.json()) @@ -1642,7 +1717,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.IngestionSourceSummary], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.IngestionSourceSummary], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1725,7 +1803,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ManagedIdentityMetadata], deserialized.get("value", [])) + list_of_elem = _deserialize( + List[_models.ManagedIdentityMetadata], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1845,6 +1926,7 @@ async def create_collection_asset( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1862,7 +1944,7 @@ async def create_collection_asset( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacCollection, response.json()) @@ -1958,6 +2040,7 @@ async def replace_collection_asset( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1975,7 +2058,7 @@ async def replace_collection_asset( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacCollection, response.json()) @@ -2023,6 +2106,7 @@ async def delete_collection_asset(self, collection_id: str, asset_id: str, **kwa } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2040,7 +2124,7 @@ async def delete_collection_asset(self, collection_id: str, asset_id: str, **kwa raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacCollection, response.json()) @@ -2085,6 +2169,7 @@ async def get_collection_configuration(self, collection_id: str, **kwargs: Any) } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2102,7 +2187,7 @@ async def get_collection_configuration(self, collection_id: str, **kwargs: Any) raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.UserCollectionSettings, response.json()) @@ -2222,6 +2307,7 @@ async def add_mosaic( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2239,7 +2325,7 @@ async def add_mosaic( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacMosaic, response.json()) @@ -2380,6 +2466,7 @@ async def replace_mosaic( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2397,7 +2484,7 @@ async def replace_mosaic( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacMosaic, response.json()) @@ -2498,6 +2585,7 @@ async def get_mosaic(self, collection_id: str, mosaic_id: str, **kwargs: Any) -> } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2515,7 +2603,7 @@ async def get_mosaic(self, collection_id: str, mosaic_id: str, **kwargs: Any) -> raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacMosaic, response.json()) @@ -2560,6 +2648,7 @@ async def list_mosaics(self, collection_id: str, **kwargs: Any) -> List[_models. } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2577,7 +2666,7 @@ async def list_mosaics(self, collection_id: str, **kwargs: Any) -> List[_models. raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(List[_models.StacMosaic], response.json()) @@ -2622,6 +2711,7 @@ async def _create_collection_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2641,7 +2731,7 @@ async def _create_collection_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2759,12 +2849,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @overload - async def create_or_replace_collection( + async def replace_collection( self, collection_id: str, body: _models.StacCollection, *, content_type: str = "application/json", **kwargs: Any ) -> _models.StacCollection: - """Create or update Collection. + """Replace Collection. - Create or replace a collection in the GeoCatalog instance. + Replace an existing collection in the GeoCatalog instance. :param collection_id: Catalog collection id. Required. :type collection_id: str @@ -2779,12 +2869,12 @@ async def create_or_replace_collection( """ @overload - async def create_or_replace_collection( + async def replace_collection( self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models.StacCollection: - """Create or update Collection. + """Replace Collection. - Create or replace a collection in the GeoCatalog instance. + Replace an existing collection in the GeoCatalog instance. :param collection_id: Catalog collection id. Required. :type collection_id: str @@ -2799,12 +2889,12 @@ async def create_or_replace_collection( """ @overload - async def create_or_replace_collection( + async def replace_collection( self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.StacCollection: - """Create or update Collection. + """Replace Collection. - Create or replace a collection in the GeoCatalog instance. + Replace an existing collection in the GeoCatalog instance. :param collection_id: Catalog collection id. Required. :type collection_id: str @@ -2819,12 +2909,12 @@ async def create_or_replace_collection( """ @distributed_trace_async - async def create_or_replace_collection( + async def replace_collection( self, collection_id: str, body: Union[_models.StacCollection, JSON, IO[bytes]], **kwargs: Any ) -> _models.StacCollection: - """Create or update Collection. + """Replace Collection. - Create or replace a collection in the GeoCatalog instance. + Replace an existing collection in the GeoCatalog instance. :param collection_id: Catalog collection id. Required. :type collection_id: str @@ -2856,7 +2946,7 @@ async def create_or_replace_collection( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_stac_create_or_replace_collection_request( + _request = build_stac_replace_collection_request( collection_id=collection_id, content_type=content_type, api_version=self._config.api_version, @@ -2869,6 +2959,7 @@ async def create_or_replace_collection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2886,7 +2977,7 @@ async def create_or_replace_collection( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacCollection, response.json()) @@ -2920,6 +3011,7 @@ async def _delete_collection_initial(self, collection_id: str, **kwargs: Any) -> } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2939,7 +3031,7 @@ async def _delete_collection_initial(self, collection_id: str, **kwargs: Any) -> response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -3048,6 +3140,7 @@ async def get_collection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3065,7 +3158,7 @@ async def get_collection( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacCollection, response.json()) @@ -3120,6 +3213,7 @@ async def get_collections( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3137,7 +3231,7 @@ async def get_collections( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacCatalogCollections, response.json()) @@ -3182,6 +3276,7 @@ async def get_partition_type(self, collection_id: str, **kwargs: Any) -> _models } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3199,7 +3294,7 @@ async def get_partition_type(self, collection_id: str, **kwargs: Any) -> _models raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.PartitionType, response.json()) @@ -3471,6 +3566,7 @@ async def create_render_option( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3488,7 +3584,7 @@ async def create_render_option( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.RenderOption, response.json()) @@ -3639,6 +3735,7 @@ async def replace_render_option( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3656,7 +3753,7 @@ async def replace_render_option( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.RenderOption, response.json()) @@ -3757,6 +3854,7 @@ async def get_render_option(self, collection_id: str, render_option_id: str, **k } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3774,7 +3872,7 @@ async def get_render_option(self, collection_id: str, render_option_id: str, **k raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.RenderOption, response.json()) @@ -3819,6 +3917,7 @@ async def list_render_options(self, collection_id: str, **kwargs: Any) -> List[_ } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3836,7 +3935,7 @@ async def list_render_options(self, collection_id: str, **kwargs: Any) -> List[_ raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(List[_models.RenderOption], response.json()) @@ -3881,6 +3980,7 @@ async def get_collection_thumbnail(self, collection_id: str, **kwargs: Any) -> A } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3906,7 +4006,7 @@ async def get_collection_thumbnail(self, collection_id: str, **kwargs: Any) -> A response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -3949,6 +4049,7 @@ async def get_tile_settings(self, collection_id: str, **kwargs: Any) -> _models. } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3966,7 +4067,7 @@ async def get_tile_settings(self, collection_id: str, **kwargs: Any) -> _models. raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.TileSettings, response.json()) @@ -4086,6 +4187,7 @@ async def replace_tile_settings( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4103,7 +4205,7 @@ async def replace_tile_settings( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.TileSettings, response.json()) @@ -4145,6 +4247,7 @@ async def get_conformance_class(self, **kwargs: Any) -> _models.StacConformanceC } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4162,7 +4265,7 @@ async def get_conformance_class(self, **kwargs: Any) -> _models.StacConformanceC raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacConformanceClasses, response.json()) @@ -4204,6 +4307,7 @@ async def get_landing_page(self, **kwargs: Any) -> _models.StacLandingPage: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4221,7 +4325,7 @@ async def get_landing_page(self, **kwargs: Any) -> _models.StacLandingPage: raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacLandingPage, response.json()) @@ -4267,6 +4371,7 @@ async def _create_item_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4286,7 +4391,7 @@ async def _create_item_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -4461,7 +4566,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _create_or_replace_item_initial( + async def _replace_item_initial( self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -4485,7 +4590,7 @@ async def _create_or_replace_item_initial( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_stac_create_or_replace_item_request( + _request = build_stac_replace_item_request( collection_id=collection_id, item_id=item_id, content_type=content_type, @@ -4499,6 +4604,7 @@ async def _create_or_replace_item_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4518,7 +4624,7 @@ async def _create_or_replace_item_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -4526,7 +4632,7 @@ async def _create_or_replace_item_initial( return deserialized # type: ignore @overload - async def begin_create_or_replace_item( + async def begin_replace_item( self, collection_id: str, item_id: str, @@ -4535,7 +4641,7 @@ async def begin_create_or_replace_item( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Create or replace a STAC item in a collection. + """Replace a STAC item in a collection. :param collection_id: Catalog collection id. Required. :type collection_id: str @@ -4552,10 +4658,10 @@ async def begin_create_or_replace_item( """ @overload - async def begin_create_or_replace_item( + async def begin_replace_item( self, collection_id: str, item_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Create or replace a STAC item in a collection. + """Replace a STAC item in a collection. :param collection_id: Catalog collection id. Required. :type collection_id: str @@ -4572,7 +4678,7 @@ async def begin_create_or_replace_item( """ @overload - async def begin_create_or_replace_item( + async def begin_replace_item( self, collection_id: str, item_id: str, @@ -4581,7 +4687,7 @@ async def begin_create_or_replace_item( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Create or replace a STAC item in a collection. + """Replace a STAC item in a collection. :param collection_id: Catalog collection id. Required. :type collection_id: str @@ -4598,10 +4704,10 @@ async def begin_create_or_replace_item( """ @distributed_trace_async - async def begin_create_or_replace_item( + async def begin_replace_item( self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: - """Create or replace a STAC item in a collection. + """Replace a STAC item in a collection. :param collection_id: Catalog collection id. Required. :type collection_id: str @@ -4622,7 +4728,7 @@ async def begin_create_or_replace_item( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_replace_item_initial( + raw_result = await self._replace_item_initial( collection_id=collection_id, item_id=item_id, body=body, @@ -4687,6 +4793,7 @@ async def _delete_item_initial(self, collection_id: str, item_id: str, **kwargs: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4706,7 +4813,7 @@ async def _delete_item_initial(self, collection_id: str, item_id: str, **kwargs: response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -4771,13 +4878,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async - async def get_item(self, collection_id: str, item_id: str, **kwargs: Any) -> _models.StacItem: + async def get_item( + self, + collection_id: str, + item_id: str, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> _models.StacItem: """Fetch a single STAC Item. :param collection_id: Catalog collection id. Required. :type collection_id: str :param item_id: STAC Item id. Required. :type item_id: str + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int :return: StacItem. The StacItem is compatible with MutableMapping :rtype: ~azure.planetarycomputer.models.StacItem :raises ~azure.core.exceptions.HttpResponseError: @@ -4798,6 +4918,8 @@ async def get_item(self, collection_id: str, item_id: str, **kwargs: Any) -> _mo _request = build_stac_get_item_request( collection_id=collection_id, item_id=item_id, + sign=sign, + duration_in_minutes=duration_in_minutes, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4807,6 +4929,7 @@ async def get_item(self, collection_id: str, item_id: str, **kwargs: Any) -> _mo } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4824,7 +4947,7 @@ async def get_item(self, collection_id: str, item_id: str, **kwargs: Any) -> _mo raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacItem, response.json()) @@ -4841,6 +4964,9 @@ async def get_item_collection( limit: Optional[int] = None, bounding_box: Optional[List[str]] = None, datetime: Optional[str] = None, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + token: Optional[str] = None, **kwargs: Any ) -> _models.StacItemCollection: """Fetch features of the feature collection with id ``collectionId``. @@ -4911,6 +5037,13 @@ async def get_item_collection( server whether only a single temporal property is used to determine the extent or all relevant temporal properties. Default value is None. :paramtype datetime: str + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int + :keyword token: Pagination token for fetching the next set of results. Default value is None. + :paramtype token: str :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping :rtype: ~azure.planetarycomputer.models.StacItemCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -4933,6 +5066,9 @@ async def get_item_collection( limit=limit, bounding_box=bounding_box, datetime=datetime, + sign=sign, + duration_in_minutes=duration_in_minutes, + token=token, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4942,6 +5078,7 @@ async def get_item_collection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4959,7 +5096,7 @@ async def get_item_collection( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacItemCollection, response.json()) @@ -5006,6 +5143,7 @@ async def _update_item_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5025,7 +5163,7 @@ async def _update_item_initial( response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -5290,6 +5428,7 @@ async def create_queryables( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5307,7 +5446,7 @@ async def create_queryables( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(List[_models.StacQueryable], response.json()) @@ -5458,6 +5597,7 @@ async def replace_queryable( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5475,7 +5615,7 @@ async def replace_queryable( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacQueryable, response.json()) @@ -5571,6 +5711,7 @@ async def list_queryables(self, **kwargs: Any) -> _models.QueryableDefinitionsRe } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5588,7 +5729,7 @@ async def list_queryables(self, **kwargs: Any) -> _models.QueryableDefinitionsRe raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) @@ -5636,6 +5777,7 @@ async def get_collection_queryables( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5653,7 +5795,7 @@ async def get_collection_queryables( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) @@ -5809,6 +5951,7 @@ async def search( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5826,7 +5969,7 @@ async def search( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.StacItemCollection, response.json()) @@ -5891,6 +6034,7 @@ async def get_tile_matrix_definitions(self, tile_matrix_set_id: str, **kwargs: A } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5908,7 +6052,7 @@ async def get_tile_matrix_definitions(self, tile_matrix_set_id: str, **kwargs: A raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.TileMatrixSet, response.json()) @@ -5950,6 +6094,7 @@ async def list_tile_matrices(self, **kwargs: Any) -> List[str]: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5967,7 +6112,7 @@ async def list_tile_matrices(self, **kwargs: Any) -> List[str]: raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(List[str], response.json()) @@ -5977,86 +6122,21 @@ async def list_tile_matrices(self, **kwargs: Any) -> List[str]: return deserialized # type: ignore @distributed_trace_async - async def get_asset_statistics( # pylint: disable=too-many-locals - self, - collection_id: str, - item_id: str, - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, - **kwargs: Any - ) -> _models.AssetStatisticsResponse: - """Asset Statistics. - - Per Asset statistics. - - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. - Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). + async def get_class_map_legend( + self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any + ) -> _models.ClassMapLegendResponse: + """Get ClassMap Legend. - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. + Generate values and color swatches mapping for a given classmap. - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_range: str - :return: AssetStatisticsResponse. The AssetStatisticsResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.AssetStatisticsResponse + :param classmap_name: classmap name. Required. + :type classmap_name: str + :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. + :paramtype trim_start: int + :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. + :paramtype trim_end: int + :return: ClassMapLegendResponse. The ClassMapLegendResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.ClassMapLegendResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6070,24 +6150,12 @@ async def get_asset_statistics( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AssetStatisticsResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.ClassMapLegendResponse] = kwargs.pop("cls", None) - _request = build_data_get_asset_statistics_request( - collection_id=collection_id, - item_id=item_id, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - resampling=resampling, - max_size=max_size, - categorical=categorical, - categories_pixels=categories_pixels, - percentiles=percentiles, - histogram_bins=histogram_bins, - histogram_range=histogram_range, + _request = build_data_get_class_map_legend_request( + classmap_name=classmap_name, + trim_start=trim_start, + trim_end=trim_end, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6097,6 +6165,7 @@ async def get_asset_statistics( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6114,9 +6183,9 @@ async def get_asset_statistics( # pylint: disable=too-many-locals raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AssetStatisticsResponse, response.json()) + deserialized = _deserialize(_models.ClassMapLegendResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6124,17 +6193,34 @@ async def get_asset_statistics( # pylint: disable=too-many-locals return deserialized # type: ignore @distributed_trace_async - async def list_available_assets(self, collection_id: str, item_id: str, **kwargs: Any) -> List[str]: - """Available Assets. + async def get_interval_legend( + self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any + ) -> List[List[List[int]]]: + """Get Interval Legend. - Return a list of supported assets. + Generate values and color swatches mapping for a given interval classmap. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :return: list of str - :rtype: list[str] + Returns a color map for intervals, where each interval is defined by + a numeric range [min, max] representing the interval boundaries and + an RGBA color [red, green, blue, alpha] associated with the interval. + + The response is a 2D array of interval definitions, where each element is a pair: + the first element is an array of two numbers [min, max] defining the interval, + and the second element is an array of four numbers [red, green, blue, alpha] defining the RGBA + color. + + Example: [[ [-2, 0], [0, 0, 0, 0] ], [ [1, 32], [255, 255, 178, 255] ]]. + This defines two intervals: [-2, 0] mapped to transparent black and [1, 32] mapped to opaque + yellow. + + :param classmap_name: classmap name. Required. + :type classmap_name: str + :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. + :paramtype trim_start: int + :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. + :paramtype trim_end: int + :return: list of list of list of int + :rtype: list[list[list[int]]] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6148,11 +6234,12 @@ async def list_available_assets(self, collection_id: str, item_id: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[str]] = kwargs.pop("cls", None) + cls: ClsType[List[List[List[int]]]] = kwargs.pop("cls", None) - _request = build_data_list_available_assets_request( - collection_id=collection_id, - item_id=item_id, + _request = build_data_get_interval_legend_request( + classmap_name=classmap_name, + trim_start=trim_start, + trim_end=trim_end, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6162,6 +6249,7 @@ async def list_available_assets(self, collection_id: str, item_id: str, **kwargs } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6178,28 +6266,50 @@ async def list_available_assets(self, collection_id: str, item_id: str, **kwargs map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(List[str], response.json()) + deserialized = _deserialize(List[List[List[int]]], response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def get_bounds(self, collection_id: str, item_id: str, **kwargs: Any) -> _models.StacItemBounds: - """Bounds. + async def get_legend( + self, + color_map_name: str, + *, + height: Optional[float] = None, + width: Optional[float] = None, + trim_start: Optional[int] = None, + trim_end: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Get Legend. - Return all Bounds. + Generate a legend image for a given colormap. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :return: StacItemBounds. The StacItemBounds is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemBounds + If the colormap has non-contiguous values at the beginning or end, + which aren't desired in the output image, they can be trimmed by specifying + the number of values to trim. + + :param color_map_name: The name of the registered colormap to generate a legend for. Required. + :type color_map_name: str + :keyword height: The output height of the legend image. Default value is None. + :paramtype height: float + :keyword width: The output width of the legend image. Default value is None. + :paramtype width: float + :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. + :paramtype trim_start: int + :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. + :paramtype trim_end: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6213,11 +6323,14 @@ async def get_bounds(self, collection_id: str, item_id: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacItemBounds] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_bounds_request( - collection_id=collection_id, - item_id=item_id, + _request = build_data_get_legend_request( + color_map_name=color_map_name, + height=height, + width=width, + trim_start=trim_start, + trim_end=trim_end, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6227,7 +6340,8 @@ async def get_bounds(self, collection_id: str, item_id: str, **kwargs: Any) -> _ } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6243,498 +6357,158 @@ async def get_bounds(self, collection_id: str, item_id: str, **kwargs: Any) -> _ map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacItemBounds, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def crop_geo_json( + async def register_mosaics_search( self, - collection_id: str, - item_id: str, - format: str, - body: _models.Feature, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, content_type: str = "application/json", + collections: Optional[List[str]] = None, + ids: Optional[List[str]] = None, + bounding_box: Optional[List[float]] = None, + intersects: Optional[_models.Geometry] = None, + query: Optional[dict[str, Any]] = None, + filter: Optional[dict[str, Any]] = None, + datetime: Optional[str] = None, + sort_by: Optional[List[_models.StacSortExtension]] = None, + filter_language: Optional[Union[str, _models.FilterLanguage]] = None, + metadata: Optional[_models.MosaicMetadata] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Geojson Crop. + ) -> _models.TilerMosaicSearchRegistrationResponse: + """Register Search. - Create image from a geojson feature. + Register a Search query. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. - :type body: ~azure.planetarycomputer.models.Feature - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :keyword collections: List of STAC collection IDs to include in the mosaic. Default value is + None. + :paramtype collections: list[str] + :keyword ids: List of specific STAC item IDs to include in the mosaic. Default value is None. + :paramtype ids: list[str] + :keyword bounding_box: Geographic bounding box to filter items [west, south, east, north]. + Default value is None. + :paramtype bounding_box: list[float] + :keyword intersects: GeoJSON geometry to spatially filter items by intersection. Default value + is None. + :paramtype intersects: ~azure.planetarycomputer.models.Geometry + :keyword query: Query. Default value is None. + :paramtype query: dict[str, any] + :keyword filter: Filter. Default value is None. + :paramtype filter: dict[str, any] + :keyword datetime: Temporal filter in RFC 3339 format or interval. Default value is None. + :paramtype datetime: str + :keyword sort_by: Criteria for ordering items in the mosaic. Default value is None. + :paramtype sort_by: list[~azure.planetarycomputer.models.StacSortExtension] + :keyword filter_language: Query language format used in the filter parameter. Known values are: + "cql-json", "cql2-json", and "cql2-text". Default value is None. + :paramtype filter_language: str or ~azure.planetarycomputer.models.FilterLanguage + :keyword metadata: Additional metadata to associate with the mosaic. Default value is None. + :paramtype metadata: ~azure.planetarycomputer.models.MosaicMetadata + :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is + compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def crop_geo_json( - self, - collection_id: str, - item_id: str, - format: str, - body: JSON, - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterator[bytes]: - """Geojson Crop. + async def register_mosaics_search( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TilerMosaicSearchRegistrationResponse: + """Register Search. - Create image from a geojson feature. + Register a Search query. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. + :param body: Required. :type body: JSON - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is + compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def crop_geo_json( - self, - collection_id: str, - item_id: str, - format: str, - body: IO[bytes], - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterator[bytes]: - """Geojson Crop. + async def register_mosaics_search( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TilerMosaicSearchRegistrationResponse: + """Register Search. - Create image from a geojson feature. + Register a Search query. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. + :param body: Required. :type body: IO[bytes] - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is + compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def crop_geo_json( # pylint: disable=too-many-locals + async def register_mosaics_search( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - format: str, - body: Union[_models.Feature, JSON, IO[bytes]], + body: Union[JSON, IO[bytes]] = _Unset, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, + collections: Optional[List[str]] = None, + ids: Optional[List[str]] = None, + bounding_box: Optional[List[float]] = None, + intersects: Optional[_models.Geometry] = None, + query: Optional[dict[str, Any]] = None, + filter: Optional[dict[str, Any]] = None, + datetime: Optional[str] = None, + sort_by: Optional[List[_models.StacSortExtension]] = None, + filter_language: Optional[Union[str, _models.FilterLanguage]] = None, + metadata: Optional[_models.MosaicMetadata] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Geojson Crop. + ) -> _models.TilerMosaicSearchRegistrationResponse: + """Register Search. - Create image from a geojson feature. + Register a Search query. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] - Required. - :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword collections: List of STAC collection IDs to include in the mosaic. Default value is + None. + :paramtype collections: list[str] + :keyword ids: List of specific STAC item IDs to include in the mosaic. Default value is None. + :paramtype ids: list[str] + :keyword bounding_box: Geographic bounding box to filter items [west, south, east, north]. + Default value is None. + :paramtype bounding_box: list[float] + :keyword intersects: GeoJSON geometry to spatially filter items by intersection. Default value is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :paramtype intersects: ~azure.planetarycomputer.models.Geometry + :keyword query: Query. Default value is None. + :paramtype query: dict[str, any] + :keyword filter: Filter. Default value is None. + :paramtype filter: dict[str, any] + :keyword datetime: Temporal filter in RFC 3339 format or interval. Default value is None. + :paramtype datetime: str + :keyword sort_by: Criteria for ordering items in the mosaic. Default value is None. + :paramtype sort_by: list[~azure.planetarycomputer.models.StacSortExtension] + :keyword filter_language: Query language format used in the filter parameter. Known values are: + "cql-json", "cql2-json", and "cql2-text". Default value is None. + :paramtype filter_language: str or ~azure.planetarycomputer.models.FilterLanguage + :keyword metadata: Additional metadata to associate with the mosaic. Default value is None. + :paramtype metadata: ~azure.planetarycomputer.models.MosaicMetadata + :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is + compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6749,8 +6523,22 @@ async def crop_geo_json( # pylint: disable=too-many-locals _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.TilerMosaicSearchRegistrationResponse] = kwargs.pop("cls", None) + if body is _Unset: + body = { + "bbox": bounding_box, + "collections": collections, + "datetime_property": datetime, + "filter": filter, + "filter_lang": filter_language, + "ids": ids, + "intersects": intersects, + "metadata": metadata, + "query": query, + "sortby": sort_by, + } + body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): @@ -6758,28 +6546,7 @@ async def crop_geo_json( # pylint: disable=too-many-locals else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_data_crop_geo_json_request( - collection_id=collection_id, - item_id=item_id, - format=format, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - algorithm=algorithm, - algorithm_params=algorithm_params, - color_formula=color_formula, - coordinate_reference_system=coordinate_reference_system, - resampling=resampling, - max_size=max_size, - height=height, - width=width, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, + _request = build_data_register_mosaics_search_request( content_type=content_type, api_version=self._config.api_version, content=_content, @@ -6791,7 +6558,8 @@ async def crop_geo_json( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", True) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6807,97 +6575,329 @@ async def crop_geo_json( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerMosaicSearchRegistrationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_tilesets( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileSetList: + """Tileset List. + + Return a list of available tilesets for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetList. The TileSetList is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSetList] = kwargs.pop("cls", None) + + _request = build_data_list_tilesets_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetList, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def crop_geo_json_with_dimensions( + @distributed_trace_async + async def get_tileset_metadata( self, collection_id: str, item_id: str, - width: int, - height: int, - format: str, - body: _models.Feature, + tile_matrix_set_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileSetMetadata: + """Tileset Metadata. + + Return metadata for a specific tileset of a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetMetadata. The TileSetMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSetMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_tileset_metadata_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_tile( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, - content_type: str = "application/json", + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - """Geojson Crop. + """Tile Tilematrixsetid Plain. - Create image from a geojson feature. + Create map tile from a dataset (without scale or format in path). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. - :type body: ~azure.planetarycomputer.models.Feature + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -6930,96 +6930,231 @@ async def crop_geo_json_with_dimensions( "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - async def crop_geo_json_with_dimensions( - self, - collection_id: str, - item_id: str, - width: int, - height: int, - format: str, - body: JSON, - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_tile_by_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, - content_type: str = "application/json", + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - """Geojson Crop. + """Tile Tilematrixsetid Format. - Create image from a geojson feature. + Create map tile from a dataset (with format in path, without scale). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. :type format: str - :param body: Request GeoJson body. Required. - :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -7052,96 +7187,231 @@ async def crop_geo_json_with_dimensions( "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - async def crop_geo_json_with_dimensions( + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_by_format_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + scale=scale, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_tile_by_scale( # pylint: disable=too-many-locals self, collection_id: str, item_id: str, - width: int, - height: int, - format: str, - body: IO[bytes], + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, - content_type: str = "application/json", + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - """Geojson Crop. + """Tile Tilematrixsetid Scale. - Create image from a geojson feature. + Create map tile from a dataset (with scale in path, without format). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. - :type body: IO[bytes] + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -7174,96 +7444,230 @@ async def crop_geo_json_with_dimensions( "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_by_scale_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals + async def get_tile_by_scale_and_format( # pylint: disable=too-many-locals self, collection_id: str, item_id: str, - width: int, - height: int, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, format: str, - body: Union[_models.Feature, JSON, IO[bytes]], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - """Geojson Crop. + """Tile Tilematrixsetid. - Create image from a geojson feature. + Create map tile from a dataset (with TileMatrixSetId, scale, and format in path). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. :type format: str - :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] - Required. - :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -7296,13 +7700,38 @@ async def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -7315,44 +7744,46 @@ async def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_data_crop_geo_json_with_dimensions_request( + _request = build_data_get_tile_by_scale_and_format_request( collection_id=collection_id, item_id=item_id, - width=width, - height=height, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, algorithm=algorithm, algorithm_params=algorithm_params, + buffer=buffer, color_formula=color_formula, - coordinate_reference_system=coordinate_reference_system, resampling=resampling, - max_size=max_size, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, - content_type=content_type, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -7361,6 +7792,7 @@ async def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7386,391 +7818,447 @@ async def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def get_geo_json_statistics( + @distributed_trace_async + async def get_tile_no_tms( # pylint: disable=too-many-locals self, collection_id: str, item_id: str, - body: _models.Feature, + z: float, + x: float, + y: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, - content_type: str = "application/json", + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any - ) -> _models.StacItemStatisticsGeoJson: - """Geojson Statistics. + ) -> AsyncIterator[bytes]: + """Tile Plain. - Get Statistics from a geojson feature. + Create map tile from a dataset (without TileMatrixSetId, scale or format in path). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str - :param body: Request GeoJson body. Required. - :type body: ~azure.planetarycomputer.models.Feature + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. - Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). - - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is None. - :paramtype histogram_range: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - async def get_geo_json_statistics( - self, - collection_id: str, - item_id: str, - body: JSON, - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.StacItemStatisticsGeoJson: - """Geojson Statistics. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Get Statistics from a geojson feature. + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param body: Request GeoJson body. Required. - :type body: JSON - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. - Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). + _request = build_data_get_tile_no_tms_request( + collection_id=collection_id, + item_id=item_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. + response = pipeline_response.http_response - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_range: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson - :raises ~azure.core.exceptions.HttpResponseError: - """ + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - @overload - async def get_geo_json_statistics( + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_tile_no_tms_by_format( # pylint: disable=too-many-locals self, collection_id: str, item_id: str, - body: IO[bytes], + z: float, + x: float, + y: float, + format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, - content_type: str = "application/json", + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any - ) -> _models.StacItemStatisticsGeoJson: - """Geojson Statistics. + ) -> AsyncIterator[bytes]: + """Tile Format. - Get Statistics from a geojson feature. + Create map tile from a dataset (with format in path, without TileMatrixSetId or scale). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str - :param body: Request GeoJson body. Required. - :type body: IO[bytes] + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. - Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). - - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is None. - :paramtype histogram_range: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def get_geo_json_statistics( # pylint: disable=too-many-locals - self, - collection_id: str, - item_id: str, - body: Union[_models.Feature, JSON, IO[bytes]], - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, - **kwargs: Any - ) -> _models.StacItemStatisticsGeoJson: - """Geojson Statistics. - - Get Statistics from a geojson feature. - - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] - Required. - :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). - - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_range: str - :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7781,39 +8269,46 @@ async def get_geo_json_statistics( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StacItemStatisticsGeoJson] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_geo_json_statistics_request( + _request = build_data_get_tile_no_tms_by_format_request( collection_id=collection_id, item_id=item_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, - coordinate_reference_system=coordinate_reference_system, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + scale=scale, + buffer=buffer, + color_formula=color_formula, resampling=resampling, - max_size=max_size, - categorical=categorical, - categories_pixels=categories_pixels, - percentiles=percentiles, - histogram_bins=histogram_bins, - histogram_range=histogram_range, - content_type=content_type, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -7822,7 +8317,8 @@ async def get_geo_json_statistics( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7838,242 +8334,127 @@ async def get_geo_json_statistics( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacItemStatisticsGeoJson, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def get_info_geo_json( - self, collection_id: str, item_id: str, *, assets: Optional[List[str]] = None, **kwargs: Any - ) -> _models.TilerInfoGeoJsonFeature: - """Info Geojson. - - Return Info Geojson. - - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :return: TilerInfoGeoJsonFeature. The TilerInfoGeoJsonFeature is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerInfoGeoJsonFeature - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TilerInfoGeoJsonFeature] = kwargs.pop("cls", None) - - _request = build_data_get_info_geo_json_request( - collection_id=collection_id, - item_id=item_id, - assets=assets, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerInfoGeoJsonFeature, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_item_asset_details( - self, collection_id: str, item_id: str, *, assets: Optional[List[str]] = None, **kwargs: Any - ) -> _models.TilerInfoMapResponse: - """Info. - - Return dataset's basic info. - - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :return: TilerInfoMapResponse. The TilerInfoMapResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerInfoMapResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TilerInfoMapResponse] = kwargs.pop("cls", None) - - _request = build_data_get_item_asset_details_request( - collection_id=collection_id, - item_id=item_id, - assets=assets, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerInfoMapResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_part( # pylint: disable=too-many-locals + async def get_tile_no_tms_by_scale( # pylint: disable=too-many-locals self, collection_id: str, item_id: str, - minx: float, - miny: float, - maxx: float, - maxy: float, - format: str, + z: float, + x: float, + y: float, + scale: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - """Part. + """Tile Scale. - Create image from part of a dataset. + Create map tile from a dataset (with scale in path, without TileMatrixSetId or format). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str - :param minx: Bounding box min X. Required. - :type minx: float - :param miny: Bounding box min Y. Required. - :type miny: float - :param maxx: Bounding box max X. Required. - :type maxx: float - :param maxy: Bounding box max Y. Required. - :type maxy: float - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword dst_crs: Output Coordinate Reference System. Default value is None. - :paramtype dst_crs: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -8106,13 +8487,38 @@ async def get_part( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -8130,33 +8536,40 @@ async def get_part( # pylint: disable=too-many-locals cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_part_request( + _request = build_data_get_tile_no_tms_by_scale_request( collection_id=collection_id, item_id=item_id, - minx=minx, - miny=miny, - maxx=maxx, - maxy=maxy, - format=format, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, algorithm=algorithm, algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + buffer=buffer, color_formula=color_formula, - dst_crs=dst_crs, - coordinate_reference_system=coordinate_reference_system, resampling=resampling, - max_size=max_size, - height=height, - width=width, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8166,6 +8579,7 @@ async def get_part( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8191,7 +8605,7 @@ async def get_part( # pylint: disable=too-many-locals response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8199,91 +8613,109 @@ async def get_part( # pylint: disable=too-many-locals return deserialized # type: ignore @distributed_trace_async - async def get_part_with_dimensions( # pylint: disable=too-many-locals + async def get_tile_no_tms_by_scale_and_format( # pylint: disable=too-many-locals self, collection_id: str, item_id: str, - minx: float, - miny: float, - maxx: float, - maxy: float, - width: int, - height: int, + z: float, + x: float, + y: float, + scale: float, format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - """Part. + """Tile. - Create image from part of a dataset. + Create map tile from a dataset (with scale and format in path, without TileMatrixSetId). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str - :param minx: Bounding box min X. Required. - :type minx: float - :param miny: Bounding box min Y. Required. - :type miny: float - :param maxx: Bounding box max X. Required. - :type maxx: float - :param maxy: Bounding box max Y. Required. - :type maxy: float - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword dst_crs: Output Coordinate Reference System. Default value is None. - :paramtype dst_crs: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -8316,13 +8748,38 @@ async def get_part_with_dimensions( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -8340,33 +8797,40 @@ async def get_part_with_dimensions( # pylint: disable=too-many-locals cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_part_with_dimensions_request( + _request = build_data_get_tile_no_tms_by_scale_and_format_request( collection_id=collection_id, item_id=item_id, - minx=minx, - miny=miny, - maxx=maxx, - maxy=maxy, - width=width, - height=height, + z=z, + x=x, + y=y, + scale=scale, format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, algorithm=algorithm, algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + buffer=buffer, color_formula=color_formula, - dst_crs=dst_crs, - coordinate_reference_system=coordinate_reference_system, resampling=resampling, - max_size=max_size, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8376,6 +8840,7 @@ async def get_part_with_dimensions( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8401,145 +8866,32 @@ async def get_part_with_dimensions( # pylint: disable=too-many-locals response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def get_point( # pylint: disable=too-many-locals - self, - collection_id: str, - item_id: str, - longitude: float, - latitude: float, - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - **kwargs: Any - ) -> _models.TilerCoreModelsResponsesPoint: - """Point. - - Get Point value for a dataset. - - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param longitude: Longitude. Required. - :type longitude: float - :param latitude: Latitude. Required. - :type latitude: float - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :return: TilerCoreModelsResponsesPoint. The TilerCoreModelsResponsesPoint is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerCoreModelsResponsesPoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TilerCoreModelsResponsesPoint] = kwargs.pop("cls", None) - - _request = build_data_get_point_request( - collection_id=collection_id, - item_id=item_id, - longitude=longitude, - latitude=latitude, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - coordinate_reference_system=coordinate_reference_system, - resampling=resampling, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerCoreModelsResponsesPoint, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_preview( # pylint: disable=too-many-locals + @overload + async def crop_feature_geo_json( # pylint: disable=too-many-locals self, collection_id: str, item_id: str, + body: _models.Feature, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - format: Optional[Union[str, _models.TilerImageFormat]] = None, color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, max_size: Optional[int] = None, height: Optional[int] = None, @@ -8548,42 +8900,60 @@ async def get_preview( # pylint: disable=too-many-locals color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", **kwargs: Any ) -> AsyncIterator[bytes]: - """Preview. + """Geojson Feature. - Create preview of a dataset. + Create image from a geojson feature (without format in path). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str - :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: - "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. - :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword dst_crs: Output Coordinate Reference System. Default value is None. - :paramtype dst_crs: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling @@ -8626,110 +8996,67 @@ async def get_preview( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_data_get_preview_request( - collection_id=collection_id, - item_id=item_id, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - algorithm=algorithm, - algorithm_params=algorithm_params, - format=format, - color_formula=color_formula, - dst_crs=dst_crs, - resampling=resampling, - max_size=max_size, - height=height, - width=width, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - @distributed_trace_async - async def get_preview_with_format( # pylint: disable=too-many-locals + @overload + async def crop_feature_geo_json( # pylint: disable=too-many-locals self, collection_id: str, item_id: str, - format: str, + body: JSON, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, max_size: Optional[int] = None, height: Optional[int] = None, @@ -8738,41 +9065,60 @@ async def get_preview_with_format( # pylint: disable=too-many-locals color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", **kwargs: Any ) -> AsyncIterator[bytes]: - """Preview. + """Geojson Feature. - Create preview of a dataset. + Create image from a geojson feature (without format in path). :param collection_id: STAC Collection Identifier. Required. :type collection_id: str :param item_id: STAC Item Identifier. Required. :type item_id: str - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword dst_crs: Output Coordinate Reference System. Default value is None. - :paramtype dst_crs: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling @@ -8815,179 +9161,378 @@ async def get_preview_with_format( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_data_get_preview_with_format_request( - collection_id=collection_id, - item_id=item_id, - format=format, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - algorithm=algorithm, - algorithm_params=algorithm_params, - color_formula=color_formula, - dst_crs=dst_crs, - resampling=resampling, - max_size=max_size, - height=height, - width=width, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore @overload - async def create_static_image( + async def crop_feature_geo_json( # pylint: disable=too-many-locals self, collection_id: str, - body: _models.ImageParameters, + item_id: str, + body: IO[bytes], *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.ImageResponse: - """Create Static Image. - - Create a new image export. - - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param body: Image request body. Required. - :type body: ~azure.planetarycomputer.models.ImageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ImageResponse. The ImageResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ImageResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_static_image( - self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ImageResponse: - """Create Static Image. - - Create a new image export. - - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param body: Image request body. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ImageResponse. The ImageResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ImageResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_static_image( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ImageResponse: - """Create Static Image. + ) -> AsyncIterator[bytes]: + """Geojson Feature. - Create a new image export. + Create image from a geojson feature (without format in path). - :param collection_id: STAC Collection ID. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Image request body. Required. + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ImageResponse. The ImageResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ImageResponse + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_static_image( - self, collection_id: str, body: Union[_models.ImageParameters, JSON, IO[bytes]], **kwargs: Any - ) -> _models.ImageResponse: - """Create Static Image. + async def crop_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Geojson Feature. - Create a new image export. + Create image from a geojson feature (without format in path). - :param collection_id: STAC Collection ID. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Image request body. Is one of the following types: ImageParameters, JSON, - IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.ImageParameters or JSON or IO[bytes] - :return: ImageResponse. The ImageResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ImageResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -8996,7 +9541,7 @@ async def create_static_image( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ImageResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -9005,8 +9550,38 @@ async def create_static_image( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_data_create_static_image_request( + _request = build_data_crop_feature_geo_json_request( collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + format=format, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -9018,71 +9593,7 @@ async def create_static_image( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ImageResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_static_image(self, collection_id: str, id: str, **kwargs: Any) -> AsyncIterator[bytes]: - """Get Static Image. - - Fetch an existing image export by ID. - - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param id: Image export ID. Required. - :type id: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_data_get_static_image_request( - collection_id=collection_id, - id=id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9101,240 +9612,17173 @@ async def get_static_image(self, collection_id: str, id: str, **kwargs: Any) -> response_headers = {} response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def list_statistics( # pylint: disable=too-many-locals + @overload + async def crop_feature_geo_json_format( # pylint: disable=too-many-locals self, collection_id: str, item_id: str, + format: str, + body: _models.Feature, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.TilerStacItemStatistics: - """Statistics. + ) -> AsyncIterator[bytes]: + """Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + format: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + format: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def crop_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_feature_geo_json_format_request( + collection_id=collection_id, + item_id=item_id, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def crop_feature_geo_json_width_by_height( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + width: int, + height: int, + format: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_feature_geo_json_width_by_height( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + width: int, + height: int, + format: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_feature_geo_json_width_by_height( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + width: int, + height: int, + format: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def crop_feature_geo_json_width_by_height( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + width: int, + height: int, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_feature_geo_json_width_by_height_request( + collection_id=collection_id, + item_id=item_id, + width=width, + height=height, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + max_size=max_size, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_bounds( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.StacItemBounds: + """Item Bounds. + + Return the bounds for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: StacItemBounds. The StacItemBounds is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemBounds + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacItemBounds] = kwargs.pop("cls", None) + + _request = build_data_get_item_bounds_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacItemBounds, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_info( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + assets: Optional[List[str]] = None, + **kwargs: Any + ) -> _models.TilerInfoMapResponse: + """Item Info. + + Return dataset's basic info for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :return: TilerInfoMapResponse. The TilerInfoMapResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerInfoMapResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TilerInfoMapResponse] = kwargs.pop("cls", None) + + _request = build_data_get_item_info_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + assets=assets, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerInfoMapResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_info_geo_json( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + assets: Optional[List[str]] = None, + **kwargs: Any + ) -> _models.TilerInfoGeoJsonFeature: + """Item Info Geojson. + + Return info as GeoJSON for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :return: TilerInfoGeoJsonFeature. The TilerInfoGeoJsonFeature is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerInfoGeoJsonFeature + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TilerInfoGeoJsonFeature] = kwargs.pop("cls", None) + + _request = build_data_get_item_info_geo_json_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + assets=assets, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerInfoGeoJsonFeature, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_item_available_assets( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> List[str]: + """Item Available Assets. + + Return a list of supported assets for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + _request = build_data_list_item_available_assets_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[str], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_asset_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + asset_band_indices: Optional[List[str]] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + asset_expression: Optional[List[str]] = None, + height: Optional[int] = None, + width: Optional[int] = None, + **kwargs: Any + ) -> _models.AssetStatisticsResponse: + """Item Asset Statistics. + + Per asset statistics for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). + + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. + + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). + + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword asset_expression: Per asset band expression. Default value is None. + :paramtype asset_expression: list[str] + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :return: AssetStatisticsResponse. The AssetStatisticsResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.AssetStatisticsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AssetStatisticsResponse] = kwargs.pop("cls", None) + + _request = build_data_get_item_asset_statistics_request( + collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + asset_band_indices=asset_band_indices, + no_data=no_data, + unscale=unscale, + reproject=reproject, + resampling=resampling, + max_size=max_size, + categorical=categorical, + categories_pixels=categories_pixels, + percentiles=percentiles, + histogram_bins=histogram_bins, + histogram_range=histogram_range, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + asset_expression=asset_expression, + height=height, + width=width, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AssetStatisticsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_item_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + **kwargs: Any + ) -> _models.TilerStacItemStatistics: + """Item Statistics. + + Merged assets statistics for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). + + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. + + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). + + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :return: TilerStacItemStatistics. The TilerStacItemStatistics is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerStacItemStatistics + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TilerStacItemStatistics] = kwargs.pop("cls", None) + + _request = build_data_list_item_statistics_request( + collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + resampling=resampling, + max_size=max_size, + categorical=categorical, + categories_pixels=categories_pixels, + percentiles=percentiles, + histogram_bins=histogram_bins, + histogram_range=histogram_range, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + algorithm=algorithm, + algorithm_params=algorithm_params, + height=height, + width=width, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerStacItemStatistics, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def get_item_geo_json_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacItemStatisticsGeoJson: + """Item Geojson Statistics. + + Get statistics from a GeoJSON feature for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). + + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. + + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). + + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_item_geo_json_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacItemStatisticsGeoJson: + """Item Geojson Statistics. + + Get statistics from a GeoJSON feature for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). + + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. + + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). + + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_item_geo_json_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacItemStatisticsGeoJson: + """Item Geojson Statistics. + + Get statistics from a GeoJSON feature for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). + + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. + + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). + + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_item_geo_json_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + **kwargs: Any + ) -> _models.StacItemStatisticsGeoJson: + """Item Geojson Statistics. + + Get statistics from a GeoJSON feature for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). + + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. + + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). + + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StacItemStatisticsGeoJson] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_get_item_geo_json_statistics_request( + collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + max_size=max_size, + categorical=categorical, + categories_pixels=categories_pixels, + percentiles=percentiles, + histogram_bins=histogram_bins, + histogram_range=histogram_range, + destination_crs=destination_crs, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + algorithm=algorithm, + algorithm_params=algorithm_params, + height=height, + width=width, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacItemStatisticsGeoJson, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_tile_json( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileJsonMetadata: + """Item TileJson. + + Return TileJSON document for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_item_tile_json_request( + collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_tile_json_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileJsonMetadata: + """Item TileJson Tilematrixsetid As Path. + + Return TileJSON document for a STAC item with TileMatrixSetId as path. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_item_tile_json_tms_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_wmts_capabilities( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Item Wmts. + + OGC WMTS endpoint for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_item_wmts_capabilities_request( + collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_wmts_capabilities_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Item Wmts Tilematrixsetid As Path. + + OGC WMTS endpoint for a STAC item with TileMatrixSetId as path. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_item_wmts_capabilities_tms_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_point( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + longitude: float, + latitude: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + **kwargs: Any + ) -> _models.TilerCoreModelsResponsesPoint: + """Item Point. + + Get point value for a STAC item dataset. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :return: TilerCoreModelsResponsesPoint. The TilerCoreModelsResponsesPoint is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerCoreModelsResponsesPoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TilerCoreModelsResponsesPoint] = kwargs.pop("cls", None) + + _request = build_data_get_item_point_request( + collection_id=collection_id, + item_id=item_id, + longitude=longitude, + latitude=latitude, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerCoreModelsResponsesPoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_preview( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + color_formula: Optional[str] = None, + dst_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Item Preview. + + Create preview of a STAC item dataset. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword dst_crs: Output Coordinate Reference System. Default value is None. + :paramtype dst_crs: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_item_preview_request( + collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + color_formula=color_formula, + dst_crs=dst_crs, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_preview_with_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + dst_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Item Preview With Format. + + Create preview of a STAC item dataset with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword dst_crs: Output Coordinate Reference System. Default value is None. + :paramtype dst_crs: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_item_preview_with_format_request( + collection_id=collection_id, + item_id=item_id, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + dst_crs=dst_crs, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_bbox_crop( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Item Bbox. + + Create an image from part of a STAC item dataset (bounding box crop). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_item_bbox_crop_request( + collection_id=collection_id, + item_id=item_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_item_bbox_crop_with_dimensions( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + width: int, + height: int, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Item Bbox With Dimensions. + + Create an image from part of a STAC item dataset (bounding box crop with dimensions). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param width: Force output image width. Required. + :type width: int + :param height: Force output image height. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_item_bbox_crop_with_dimensions_request( + collection_id=collection_id, + item_id=item_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + width=width, + height=height, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + resampling=resampling, + max_size=max_size, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_collection_tilesets( # pylint: disable=too-many-locals + self, + collection_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileSetList: + """Collection Tileset List. + + Return a list of available tilesets for a STAC collection. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetList. The TileSetList is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSetList] = kwargs.pop("cls", None) + + _request = build_data_list_collection_tilesets_request( + collection_id=collection_id, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetList, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tileset_metadata( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileSetMetadata: + """Collection Tileset Metadata. + + Return metadata for a specific tileset of a STAC collection. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetMetadata. The TileSetMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSetMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tileset_metadata_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile_by_scale_and_format( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Tile Tilematrixsetid. + + Create map tile for a STAC collection (with TileMatrixSetId, scale, and format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_by_scale_and_format_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Tile Tilematrixsetid Plain. + + Create map tile for a STAC collection (with TileMatrixSetId, without scale or format). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile_by_format( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Tile Tilematrixsetid Format. + + Create map tile for a STAC collection (with TileMatrixSetId and format, without scale). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_by_format_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile_by_scale( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Tile Tilematrixsetid Scale. + + Create map tile for a STAC collection (with TileMatrixSetId and scale, without format). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_by_scale_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile_no_tms_by_scale_and_format( # pylint: disable=name-too-long,too-many-locals + self, + collection_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Tile. + + Create map tile for a STAC collection (without TileMatrixSetId, with scale and format). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles (default: + "1"). Required. + :type scale: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp) (default: "png"). + Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_no_tms_by_scale_and_format_request( + collection_id=collection_id, + z=z, + x=x, + y=y, + scale=scale, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile_no_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Tile Plain. + + Create map tile for a STAC collection (without TileMatrixSetId, scale, or format). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_no_tms_request( + collection_id=collection_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile_no_tms_by_format( # pylint: disable=too-many-locals + self, + collection_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Tile Format. + + Create map tile for a STAC collection (with format, without TileMatrixSetId or scale). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_no_tms_by_format_request( + collection_id=collection_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile_no_tms_by_scale( # pylint: disable=too-many-locals + self, + collection_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Tile Scale. + + Create map tile for a STAC collection (with scale, without TileMatrixSetId or format). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_no_tms_by_scale_request( + collection_id=collection_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile_json( # pylint: disable=too-many-locals + self, + collection_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> _models.TileJsonMetadata: + """Collection TileJson. + + Return TileJSON document for a STAC collection. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_json_request( + collection_id=collection_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_tile_json_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> _models.TileJsonMetadata: + """Collection TileJson Tilematrixsetid As Path. + + Return TileJSON document for a STAC collection with TileMatrixSetId as path. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_collection_tile_json_tms_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_wmts_capabilities( # pylint: disable=too-many-locals + self, + collection_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Wmts. + + OGC WMTS endpoint for a STAC collection. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_wmts_capabilities_request( + collection_id=collection_id, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_wmts_capabilities_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Wmts Tilematrixsetid As Path. + + OGC WMTS endpoint for a STAC collection with TileMatrixSetId as path. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_wmts_capabilities_tms_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_assets_for_tile( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> List[_models.TilerAssetGeoJson]: + """Collection Assets For Tile Tilematrixsetid As Path. + + Return a list of assets which overlap a given tile for a STAC collection (with + TileMatrixSetId). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: list of TilerAssetGeoJson + :rtype: list[~azure.planetarycomputer.models.TilerAssetGeoJson] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TilerAssetGeoJson]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_assets_for_tile_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.TilerAssetGeoJson], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_assets_for_tile_no_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + z: float, + x: float, + y: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + **kwargs: Any + ) -> List[Any]: + """Collection Assets For Tile. + + Return a list of assets which overlap a given tile for a STAC collection (without + TileMatrixSetId). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :return: list of any + :rtype: list[any] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[Any]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_assets_for_tile_no_tms_request( + collection_id=collection_id, + z=z, + x=x, + y=y, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + tile_matrix_set_id=tile_matrix_set_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[Any], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_assets_for_bbox( # pylint: disable=too-many-locals + self, + collection_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any + ) -> List[Any]: + """Collection Assets For Bbox. + + Return a list of assets which overlap a given bounding box for a STAC collection. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :return: list of any + :rtype: list[any] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[Any]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_assets_for_bbox_request( + collection_id=collection_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[Any], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_info(self, collection_id: str, **kwargs: Any) -> _models.TilerStacSearchRegistration: + """Collection Info. + + Return search query info from a STAC collection identifier. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :return: TilerStacSearchRegistration. The TilerStacSearchRegistration is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerStacSearchRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TilerStacSearchRegistration] = kwargs.pop("cls", None) + + _request = build_data_get_collection_info_request( + collection_id=collection_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerStacSearchRegistration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_bbox_crop( # pylint: disable=too-many-locals + self, + collection_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Bbox. + + Create an image from part of a STAC collection dataset (bounding box crop). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_bbox_crop_request( + collection_id=collection_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + max_size=max_size, + height=height, + width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_bbox_crop_with_dimensions( # pylint: disable=too-many-locals + self, + collection_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + width: int, + height: int, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Bbox With Dimensions. + + Create an image from part of a STAC collection dataset (bounding box crop with dimensions). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param width: Force output image width. Required. + :type width: int + :param height: Force output image height. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_bbox_crop_with_dimensions_request( + collection_id=collection_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + width=width, + height=height, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + max_size=max_size, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def crop_collection_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_collection_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_collection_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def crop_collection_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_collection_feature_geo_json_request( + collection_id=collection_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, + height=height, + width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + format=format, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def crop_collection_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + format: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_collection_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + format: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_collection_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + format: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def crop_collection_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_collection_feature_geo_json_format_request( + collection_id=collection_id, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, + height=height, + width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def crop_collection_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals + self, + collection_id: str, + width: int, + height: int, + format: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_collection_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals + self, + collection_id: str, + width: int, + height: int, + format: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_collection_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals + self, + collection_id: str, + width: int, + height: int, + format: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def crop_collection_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals + self, + collection_id: str, + width: int, + height: int, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Collection Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_collection_feature_geo_json_width_by_height_request( + collection_id=collection_id, + width=width, + height=height, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_point( # pylint: disable=too-many-locals + self, + collection_id: str, + longitude: float, + latitude: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + **kwargs: Any + ) -> _models.TilerCoreModelsResponsesPoint: + """Collection Point. + + Get Point value for a collection dataset. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :return: TilerCoreModelsResponsesPoint. The TilerCoreModelsResponsesPoint is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerCoreModelsResponsesPoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TilerCoreModelsResponsesPoint] = kwargs.pop("cls", None) + + _request = build_data_get_collection_point_request( + collection_id=collection_id, + longitude=longitude, + latitude=latitude, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerCoreModelsResponsesPoint, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_collection_point_assets( # pylint: disable=too-many-locals + self, + collection_id: str, + longitude: float, + latitude: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any + ) -> List[_models.StacItemPointAsset]: + """Collection Point Assets. + + Return a list of assets for a given point in a collection. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :return: list of StacItemPointAsset + :rtype: list[~azure.planetarycomputer.models.StacItemPointAsset] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StacItemPointAsset]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_point_assets_request( + collection_id=collection_id, + longitude=longitude, + latitude=latitude, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.StacItemPointAsset], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_searches_tilesets( + self, + search_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileSetList: + """Searches Tileset List. + + Return a list of available tilesets for a mosaic search. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetList. The TileSetList is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSetList] = kwargs.pop("cls", None) + + _request = build_data_list_searches_tilesets_request( + search_id=search_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetList, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_tileset_metadata( + self, + search_id: str, + tile_matrix_set_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileSetMetadata: + """Searches Tileset Metadata. + + Return metadata for a specific tileset of a mosaic search. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetMetadata. The TileSetMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSetMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_searches_tileset_metadata_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_tile_by_scale_and_format( # pylint: disable=too-many-locals + self, + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Tile Tilematrixsetid. + + Create map tile (with TileMatrixSetId, scale, and format in path). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_tile_by_scale_and_format_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_tile( # pylint: disable=too-many-locals + self, + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Tile Tilematrixsetid Plain. + + Create map tile (with TileMatrixSetId, without scale or format). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_tile_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_tile_by_format( # pylint: disable=too-many-locals + self, + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Tile Tilematrixsetid Format. + + Create map tile (with TileMatrixSetId and format, without scale). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_tile_by_format_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_tile_by_scale( # pylint: disable=too-many-locals + self, + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Tile Tilematrixsetid Scale. + + Create map tile (with TileMatrixSetId and scale, without format). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_tile_by_scale_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_assets_for_tile( # pylint: disable=too-many-locals + self, + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + collection_id: str, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + **kwargs: Any + ) -> List[_models.TilerAssetGeoJson]: + """Searches Assets For Tile Tilematrixsetid As Path. + + Return a list of assets which overlap a given tile. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword collection_id: STAC Collection Identifier. Required. + :paramtype collection_id: str + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :return: list of TilerAssetGeoJson + :rtype: list[~azure.planetarycomputer.models.TilerAssetGeoJson] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TilerAssetGeoJson]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_assets_for_tile_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + collection_id=collection_id, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.TilerAssetGeoJson], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_tile_json_tms( # pylint: disable=too-many-locals + self, + search_id: str, + tile_matrix_set_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> _models.TileJsonMetadata: + """Searches TileJson Tilematrixsetid As Path. + + Return TileJSON document for a search with TileMatrixSetId as path. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_searches_tile_json_tms_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + min_zoom=min_zoom, + max_zoom=max_zoom, + tile_format=tile_format, + tile_scale=tile_scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_wmts_capabilities_tms( # pylint: disable=too-many-locals + self, + search_id: str, + tile_matrix_set_id: str, + *, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Wmts Tilematrixsetid As Path. + + OGC WMTS endpoint with TileMatrixSetId as path. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_wmts_capabilities_tms_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_info(self, search_id: str, **kwargs: Any) -> _models.TilerStacSearchRegistration: + """Searches Info. + + Get Search query metadata. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :return: TilerStacSearchRegistration. The TilerStacSearchRegistration is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerStacSearchRegistration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TilerStacSearchRegistration] = kwargs.pop("cls", None) + + _request = build_data_get_searches_info_request( + search_id=search_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerStacSearchRegistration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_bbox_crop( # pylint: disable=too-many-locals + self, + search_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Bbox. + + Create an image from part of a dataset (bounding box crop). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_bbox_crop_request( + search_id=search_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + max_size=max_size, + height=height, + width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_bbox_crop_with_dimensions( # pylint: disable=too-many-locals + self, + search_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + width: int, + height: int, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Bbox With Dimensions. + + Create an image from part of a dataset (bounding box crop with dimensions). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param width: Force output image width. Required. + :type width: int + :param height: Force output image height. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_bbox_crop_with_dimensions_request( + search_id=search_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + width=width, + height=height, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + max_size=max_size, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_bbox_assets( # pylint: disable=too-many-locals + self, + search_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any + ) -> List[Any]: + """Searches Assets For Bbox. + + Return a list of assets which overlap a given bounding box for a search. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :return: list of any + :rtype: list[any] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[Any]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_bbox_assets_request( + search_id=search_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[Any], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def crop_searches_feature_geo_json( # pylint: disable=too-many-locals + self, + search_id: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_searches_feature_geo_json( # pylint: disable=too-many-locals + self, + search_id: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_searches_feature_geo_json( # pylint: disable=too-many-locals + self, + search_id: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def crop_searches_feature_geo_json( # pylint: disable=too-many-locals + self, + search_id: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_searches_feature_geo_json_request( + search_id=search_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, + height=height, + width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + format=format, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def crop_searches_feature_geo_json_format( # pylint: disable=too-many-locals + self, + search_id: str, + format: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_searches_feature_geo_json_format( # pylint: disable=too-many-locals + self, + search_id: str, + format: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_searches_feature_geo_json_format( # pylint: disable=too-many-locals + self, + search_id: str, + format: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature Crop With Format. - Merged assets statistics. + Create image from a geojson feature with format. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). - - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is None. - :paramtype histogram_range: str - :return: TilerStacItemStatistics. The TilerStacItemStatistics is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerStacItemStatistics + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TilerStacItemStatistics] = kwargs.pop("cls", None) - - _request = build_data_list_statistics_request( - collection_id=collection_id, - item_id=item_id, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - resampling=resampling, - max_size=max_size, - categorical=categorical, - categories_pixels=categories_pixels, - percentiles=percentiles, - histogram_bins=histogram_bins, - histogram_range=histogram_range, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerStacItemStatistics, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore @distributed_trace_async - async def get_tile_json( # pylint: disable=too-many-locals + async def crop_searches_feature_geo_json_format( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - tile_matrix_set_id: str, + search_id: str, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - buffer: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, color_formula: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, **kwargs: Any - ) -> _models.TileJsonMetadata: - """TileJson Tilematrixsetid As Path. + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature Crop With Format. - Return the TileJson Tilematrixsetid As a path. + Create image from a geojson feature with format. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword tile_format: Default will be automatically defined if the output image needs a mask - (png) or - not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). Default value is None. - :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat - :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles - (e.g., 1=256x256, 2=512x512). Default value is None. - :paramtype tile_scale: int - :keyword min_zoom: Overwrite default minzoom. Default value is None. - :paramtype min_zoom: int - :keyword max_zoom: Overwrite default maxzoom. Default value is None. - :paramtype max_zoom: int - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -9367,15 +26811,21 @@ async def get_tile_json( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileJsonMetadata + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9386,35 +26836,59 @@ async def get_tile_json( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_tile_json_request( - collection_id=collection_id, - item_id=item_id, - tile_matrix_set_id=tile_matrix_set_id, + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_searches_feature_geo_json_format_request( + search_id=search_id, + format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, - tile_format=tile_format, - tile_scale=tile_scale, - min_zoom=min_zoom, - max_zoom=max_zoom, - buffer=buffer, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, + height=height, + width=width, color_formula=color_formula, + collection=collection, resampling=resampling, + pixel_selection=pixel_selection, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, + destination_crs=destination_crs, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -9423,7 +26897,8 @@ async def get_tile_json( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9439,99 +26914,343 @@ async def get_tile_json( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TileJsonMetadata, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def get_tile( # pylint: disable=too-many-locals + @overload + async def crop_searches_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals self, - collection_id: str, - item_id: str, - tile_matrix_set_id: str, - z: float, - x: float, - y: float, - scale: float, + search_id: str, + width: int, + height: int, format: str, + body: _models.Feature, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - buffer: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, color_formula: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, - subdataset_name: Optional[str] = None, - subdataset_bands: Optional[List[str]] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any ) -> AsyncIterator[bytes]: - """Tile Tilematrixsetid As Path. + """Searches Geojson Feature Crop With Dimensions. - Create map tile from a dataset. + Create image from a geojson feature with dimensions. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str - :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and - representing the scaleDenominator the tile. Required. - :type z: float - :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the - MatrixHeight-1 for the selected TileMatrix. Required. - :type x: float - :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the - MatrixWidth-1 for the selected TileMatrix. Required. - :type y: float - :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. - :type scale: float + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def crop_searches_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals + self, + search_id: str, + width: int, + height: int, + format: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -9564,179 +27283,348 @@ async def get_tile( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. - :paramtype subdataset_name: str - :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is - None. - :paramtype subdataset_bands: list[str] + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_data_get_tile_request( - collection_id=collection_id, - item_id=item_id, - tile_matrix_set_id=tile_matrix_set_id, - z=z, - x=x, - y=y, - scale=scale, - format=format, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - algorithm=algorithm, - algorithm_params=algorithm_params, - buffer=buffer, - color_formula=color_formula, - resampling=resampling, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, - subdataset_name=subdataset_name, - subdataset_bands=subdataset_bands, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + @overload + async def crop_searches_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals + self, + search_id: str, + width: int, + height: int, + format: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Geojson Feature Crop With Dimensions. - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + Create image from a geojson feature with dimensions. - return deserialized # type: ignore + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get_wmts_capabilities( # pylint: disable=too-many-locals + async def crop_searches_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals self, - collection_id: str, - item_id: str, - tile_matrix_set_id: str, + search_id: str, + width: int, + height: int, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - buffer: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, color_formula: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - """Wmts Tilematrixsetid As Path. + """Searches Geojson Feature Crop With Dimensions. - OGC WMTS endpoint. + Create image from a geojson feature with dimensions. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str - :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", - "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. - :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat - :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles - (e.g., 1=256x256, 2=512x512). Default value is None. - :paramtype tile_scale: int - :keyword min_zoom: Overwrite default minzoom. Default value is None. - :paramtype min_zoom: int - :keyword max_zoom: Overwrite default maxzoom. Default value is None. - :paramtype max_zoom: int - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -9769,13 +27657,19 @@ async def get_wmts_capabilities( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str :return: AsyncIterator[bytes] :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -9788,35 +27682,59 @@ async def get_wmts_capabilities( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_wmts_capabilities_request( - collection_id=collection_id, - item_id=item_id, - tile_matrix_set_id=tile_matrix_set_id, + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_searches_feature_geo_json_width_by_height_request( + search_id=search_id, + width=width, + height=height, + format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, - tile_format=tile_format, - tile_scale=tile_scale, - min_zoom=min_zoom, - max_zoom=max_zoom, - buffer=buffer, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, color_formula=color_formula, + collection=collection, resampling=resampling, + pixel_selection=pixel_selection, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, + destination_crs=destination_crs, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -9825,6 +27743,7 @@ async def get_wmts_capabilities( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9843,8 +27762,14 @@ async def get_wmts_capabilities( # pylint: disable=too-many-locals response_headers = {} response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -9852,120 +27777,70 @@ async def get_wmts_capabilities( # pylint: disable=too-many-locals return deserialized # type: ignore @distributed_trace_async - async def get_class_map_legend( - self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any - ) -> _models.ClassMapLegendResponse: - """Get ClassMap Legend. - - Generate values and color swatches mapping for a given classmap. - - :param classmap_name: classmap name. Required. - :type classmap_name: str - :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. - :paramtype trim_start: int - :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. - :paramtype trim_end: int - :return: ClassMapLegendResponse. The ClassMapLegendResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ClassMapLegendResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.ClassMapLegendResponse] = kwargs.pop("cls", None) - - _request = build_data_get_class_map_legend_request( - classmap_name=classmap_name, - trim_start=trim_start, - trim_end=trim_end, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ClassMapLegendResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_interval_legend( - self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any - ) -> List[List[List[int]]]: - """Get Interval Legend. - - Generate values and color swatches mapping for a given interval classmap. - - Returns a color map for intervals, where each interval is defined by: - - * A numeric range `[min, max]` representing the interval boundaries. - * An RGBA color `[red, green, blue, alpha]` associated with the interval. - - The response is a 2D array of interval definitions, where each element is a pair: - - * The first element is an array of two numbers `[min, max]` defining the interval. - * The second element is an array of four numbers `[red, green, blue, alpha]` defining the RGBA - color. - - Example: - - .. code-block:: json - - [ - [ - [-2, 0], [0, 0, 0, 0] - ], - [ - [1, 32], [255, 255, 178, 255] - ] - ] - - This example defines two intervals: - - * The interval `[-2, 0]` is mapped to the color `[0, 0, 0, 0]` (transparent black). - * The interval `[1, 32]` is mapped to the color `[255, 255, 178, 255]` (opaque yellow). - - :param classmap_name: classmap name. Required. - :type classmap_name: str - :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. - :paramtype trim_start: int - :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. - :paramtype trim_end: int - :return: list of list of list of int - :rtype: list[list[list[int]]] + async def get_searches_wmts_capabilities( # pylint: disable=too-many-locals + self, + search_id: str, + *, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Searches Wmts. + + OGC WMTS endpoint. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9979,12 +27854,23 @@ async def get_interval_legend( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[List[List[int]]]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_interval_legend_request( - classmap_name=classmap_name, - trim_start=trim_start, - trim_end=trim_end, + _request = build_data_get_searches_wmts_capabilities_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, api_version=self._config.api_version, headers=_headers, params=_params, @@ -9994,7 +27880,8 @@ async def get_interval_legend( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10013,10 +27900,7 @@ async def get_interval_legend( response_headers = {} response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[List[List[int]]], response.json()) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -10024,36 +27908,195 @@ async def get_interval_legend( return deserialized # type: ignore @distributed_trace_async - async def get_legend( + async def get_searches_tile_json( # pylint: disable=too-many-locals self, - color_map_name: str, + search_id: str, *, - height: Optional[float] = None, - width: Optional[float] = None, - trim_start: Optional[int] = None, - trim_end: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + padding: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection_id: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + rescale: Optional[List[str]] = None, + colormap_name: Optional[Union[str, _models.ColorMapNames]] = None, + colormap: Optional[str] = None, + return_mask: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Get Legend. - - Generate a legend image for a given colormap. + ) -> _models.TileJsonMetadata: + """Searches TileJson. - If the colormap has non-contiguous values at the beginning or end, - which aren't desired in the output image, they can be trimmed by specifying - the number of values to trim. + Return TileJSON document for a search. - :param color_map_name: The name of the registered colormap to generate a legend for. Required. - :type color_map_name: str - :keyword height: The output height of the legend image. Default value is None. - :paramtype height: float - :keyword width: The output width of the legend image. Default value is None. - :paramtype width: float - :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. - :paramtype trim_start: int - :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. - :paramtype trim_end: int - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection_id: STAC Collection ID. Default value is None. + :paramtype collection_id: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword colormap_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype colormap_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword colormap: JSON encoded custom Colormap. Default value is None. + :paramtype colormap: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10067,14 +28110,46 @@ async def get_legend( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) - _request = build_data_get_legend_request( - color_map_name=color_map_name, - height=height, - width=width, - trim_start=trim_start, - trim_end=trim_end, + _request = build_data_get_searches_tile_json_request( + search_id=search_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + padding=padding, + buffer=buffer, + color_formula=color_formula, + collection_id=collection_id, + resampling=resampling, + pixel_selection=pixel_selection, + algorithm=algorithm, + algorithm_params=algorithm_params, + rescale=rescale, + colormap_name=colormap_name, + colormap=colormap, + return_mask=return_mask, api_version=self._config.api_version, headers=_headers, params=_params, @@ -10084,7 +28159,8 @@ async def get_legend( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", True) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10100,62 +28176,210 @@ async def get_legend( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def get_mosaics_assets_for_point( + async def get_searches_tile_no_tms( # pylint: disable=too-many-locals self, search_id: str, - longitude: float, - latitude: float, + z: float, + x: float, + y: float, *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, scan_limit: Optional[int] = None, items_limit: Optional[int] = None, time_limit: Optional[int] = None, exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> List[_models.StacItemPointAsset]: - """Assets For Point. + ) -> AsyncIterator[bytes]: + """Searches Tile Plain. - Return a list of assets for a given point. + The most basic operation. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param longitude: Longitude. Required. - :type longitude: float - :param latitude: Latitude. Required. - :type latitude: float - :keyword scan_limit: Return as soon as we scan N items (defaults to 10000 in PgSTAC). Default - value is None. + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. :paramtype scan_limit: int - :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100 in - PgSTAC). Default value is None. + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. :paramtype items_limit: int - :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5 in PgSTAC). - Default value is None. + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. :paramtype time_limit: int - :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True in - PgSTAC). Default value is None. + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. :paramtype exit_when_full: bool :keyword skip_covered: Skip any items that would show up completely under the previous items (defaults - to True in PgSTAC). Default value is None. + to True). Default value is None. :paramtype skip_covered: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :return: list of StacItemPointAsset - :rtype: list[~azure.planetarycomputer.models.StacItemPointAsset] + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10169,18 +28393,47 @@ async def get_mosaics_assets_for_point( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.StacItemPointAsset]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_assets_for_point_request( + _request = build_data_get_searches_tile_no_tms_request( search_id=search_id, - longitude=longitude, - latitude=latitude, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, scan_limit=scan_limit, items_limit=items_limit, time_limit=time_limit, exit_when_full=exit_when_full, skip_covered=skip_covered, - coordinate_reference_system=coordinate_reference_system, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -10190,7 +28443,8 @@ async def get_mosaics_assets_for_point( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10206,41 +28460,72 @@ async def get_mosaics_assets_for_point( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.StacItemPointAsset], response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def get_mosaics_assets_for_tile( + async def get_searches_tile_no_tms_by_format( # pylint: disable=too-many-locals self, search_id: str, - tile_matrix_set_id: str, z: float, x: float, y: float, + format: str, *, - collection_id: str, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, scan_limit: Optional[int] = None, items_limit: Optional[int] = None, time_limit: Optional[int] = None, exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> List[_models.TilerAssetGeoJson]: - """Assets For Tile Tilematrixsetid As Path. + ) -> AsyncIterator[bytes]: + """Searches Tile Format. - Return a list of assets which overlap a given tile. + The most basic operation. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and representing the scaleDenominator the tile. Required. :type z: float @@ -10250,26 +28535,140 @@ async def get_mosaics_assets_for_tile( :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the MatrixWidth-1 for the selected TileMatrix. Required. :type y: float - :keyword collection_id: STAC Collection Identifier. Required. - :paramtype collection_id: str - :keyword scan_limit: Return as soon as we scan N items (defaults to 10000 in PgSTAC). Default - value is None. + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. :paramtype scan_limit: int - :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100 in - PgSTAC). Default value is None. + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. :paramtype items_limit: int - :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5 in PgSTAC). - Default value is None. + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. :paramtype time_limit: int - :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True in - PgSTAC). Default value is None. + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. :paramtype exit_when_full: bool :keyword skip_covered: Skip any items that would show up completely under the previous items (defaults - to True in PgSTAC). Default value is None. + to True). Default value is None. :paramtype skip_covered: bool - :return: list of TilerAssetGeoJson - :rtype: list[~azure.planetarycomputer.models.TilerAssetGeoJson] + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10283,20 +28682,47 @@ async def get_mosaics_assets_for_tile( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.TilerAssetGeoJson]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_assets_for_tile_request( + _request = build_data_get_searches_tile_no_tms_by_format_request( search_id=search_id, - tile_matrix_set_id=tile_matrix_set_id, z=z, x=x, y=y, - collection_id=collection_id, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, scan_limit=scan_limit, items_limit=items_limit, time_limit=time_limit, exit_when_full=exit_when_full, skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -10306,7 +28732,8 @@ async def get_mosaics_assets_for_tile( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10322,221 +28749,215 @@ async def get_mosaics_assets_for_tile( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.TilerAssetGeoJson], response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_mosaics_search_info(self, search_id: str, **kwargs: Any) -> _models.TilerStacSearchRegistration: - """Info Search. - - Get Search query metadata. - - :param search_id: Search Id (pgSTAC Search Hash). Required. - :type search_id: str - :return: TilerStacSearchRegistration. The TilerStacSearchRegistration is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerStacSearchRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TilerStacSearchRegistration] = kwargs.pop("cls", None) - - _request = build_data_get_mosaics_search_info_request( - search_id=search_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerStacSearchRegistration, response.json()) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def register_mosaics_search( - self, - *, - content_type: str = "application/json", - collections: Optional[List[str]] = None, - ids: Optional[List[str]] = None, - bounding_box: Optional[float] = None, - intersects: Optional[_models.Geometry] = None, - query: Optional[dict[str, Any]] = None, - filter: Optional[dict[str, Any]] = None, - datetime: Optional[str] = None, - sort_by: Optional[List[_models.StacSortExtension]] = None, - filter_language: Optional[Union[str, _models.FilterLanguage]] = None, - metadata: Optional[_models.MosaicMetadata] = None, - **kwargs: Any - ) -> _models.TilerMosaicSearchRegistrationResponse: - """Register Search. - - Register a Search query. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword collections: List of STAC collection IDs to include in the mosaic. Default value is - None. - :paramtype collections: list[str] - :keyword ids: List of specific STAC item IDs to include in the mosaic. Default value is None. - :paramtype ids: list[str] - :keyword bounding_box: Geographic bounding box to filter items [west, south, east, north]. - Default value is None. - :paramtype bounding_box: float - :keyword intersects: GeoJSON geometry to spatially filter items by intersection. Default value - is None. - :paramtype intersects: ~azure.planetarycomputer.models.Geometry - :keyword query: Query. Default value is None. - :paramtype query: dict[str, any] - :keyword filter: Filter. Default value is None. - :paramtype filter: dict[str, any] - :keyword datetime: Temporal filter in RFC 3339 format or interval. Default value is None. - :paramtype datetime: str - :keyword sort_by: Criteria for ordering items in the mosaic. Default value is None. - :paramtype sort_by: list[~azure.planetarycomputer.models.StacSortExtension] - :keyword filter_language: Query language format used in the filter parameter. Known values are: - "cql-json", "cql2-json", and "cql2-text". Default value is None. - :paramtype filter_language: str or ~azure.planetarycomputer.models.FilterLanguage - :keyword metadata: Additional metadata to associate with the mosaic. Default value is None. - :paramtype metadata: ~azure.planetarycomputer.models.MosaicMetadata - :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is - compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def register_mosaics_search( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TilerMosaicSearchRegistrationResponse: - """Register Search. - - Register a Search query. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is - compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def register_mosaics_search( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TilerMosaicSearchRegistrationResponse: - """Register Search. - - Register a Search query. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is - compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def register_mosaics_search( # pylint: disable=too-many-locals + async def get_searches_tile_no_tms_by_scale( # pylint: disable=too-many-locals self, - body: Union[JSON, IO[bytes]] = _Unset, + search_id: str, + z: float, + x: float, + y: float, + scale: float, *, - collections: Optional[List[str]] = None, - ids: Optional[List[str]] = None, - bounding_box: Optional[float] = None, - intersects: Optional[_models.Geometry] = None, - query: Optional[dict[str, Any]] = None, - filter: Optional[dict[str, Any]] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, datetime: Optional[str] = None, - sort_by: Optional[List[_models.StacSortExtension]] = None, - filter_language: Optional[Union[str, _models.FilterLanguage]] = None, - metadata: Optional[_models.MosaicMetadata] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> _models.TilerMosaicSearchRegistrationResponse: - """Register Search. + ) -> AsyncIterator[bytes]: + """Searches Tile Scale. - Register a Search query. + The most basic operation. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword collections: List of STAC collection IDs to include in the mosaic. Default value is + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is None. - :paramtype collections: list[str] - :keyword ids: List of specific STAC item IDs to include in the mosaic. Default value is None. - :paramtype ids: list[str] - :keyword bounding_box: Geographic bounding box to filter items [west, south, east, north]. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). Default value is None. - :paramtype bounding_box: float - :keyword intersects: GeoJSON geometry to spatially filter items by intersection. Default value - is None. - :paramtype intersects: ~azure.planetarycomputer.models.Geometry - :keyword query: Query. Default value is None. - :paramtype query: dict[str, any] - :keyword filter: Filter. Default value is None. - :paramtype filter: dict[str, any] - :keyword datetime: Temporal filter in RFC 3339 format or interval. Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. :paramtype datetime: str - :keyword sort_by: Criteria for ordering items in the mosaic. Default value is None. - :paramtype sort_by: list[~azure.planetarycomputer.models.StacSortExtension] - :keyword filter_language: Query language format used in the filter parameter. Known values are: - "cql-json", "cql2-json", and "cql2-text". Default value is None. - :paramtype filter_language: str or ~azure.planetarycomputer.models.FilterLanguage - :keyword metadata: Additional metadata to associate with the mosaic. Default value is None. - :paramtype metadata: ~azure.planetarycomputer.models.MosaicMetadata - :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is - compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10547,37 +28968,51 @@ async def register_mosaics_search( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TilerMosaicSearchRegistrationResponse] = kwargs.pop("cls", None) - - if body is _Unset: - body = { - "bbox": bounding_box, - "collections": collections, - "datetime_property": datetime, - "filter": filter, - "filter_lang": filter_language, - "ids": ids, - "intersects": intersects, - "metadata": metadata, - "query": query, - "sortby": sort_by, - } - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_register_mosaics_search_request( - content_type=content_type, + _request = build_data_get_searches_tile_no_tms_by_scale_request( + search_id=search_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -10586,7 +29021,8 @@ async def register_mosaics_search( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10602,40 +29038,55 @@ async def register_mosaics_search( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerMosaicSearchRegistrationResponse, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def get_mosaics_tile_json( # pylint: disable=too-many-locals + async def get_searches_tile_no_tms_by_scale_and_format( # pylint: disable=name-too-long,too-many-locals self, search_id: str, - tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, scan_limit: Optional[int] = None, items_limit: Optional[int] = None, time_limit: Optional[int] = None, exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - buffer: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, @@ -10644,67 +29095,97 @@ async def get_mosaics_tile_json( # pylint: disable=too-many-locals color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> _models.TileJsonMetadata: - """TileJson Tilematrixsetid As Path. + ) -> AsyncIterator[bytes]: + """Searches Tile. - Return TileJSON document for a searchId. + The most basic operation. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword scan_limit: Return as soon as we scan N items (defaults to 10000 in PgSTAC). Default - value is None. + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. :paramtype scan_limit: int - :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100 in - PgSTAC). Default value is None. + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. :paramtype items_limit: int - :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5 in PgSTAC). - Default value is None. + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. :paramtype time_limit: int - :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True in - PgSTAC). Default value is None. + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. :paramtype exit_when_full: bool :keyword skip_covered: Skip any items that would show up completely under the previous items (defaults - to True in PgSTAC). Default value is None. + to True). Default value is None. :paramtype skip_covered: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword min_zoom: Overwrite default minzoom. Default value is None. - :paramtype min_zoom: int - :keyword max_zoom: Overwrite default maxzoom. Default value is None. - :paramtype max_zoom: int - :keyword tile_format: Default will be automatically defined if the output image needs a mask - (png) or - not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". Default value is None. - :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat - :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles - (e.g., 1=256x256, 2=512x512). Default value is None. - :paramtype tile_scale: int + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. Output **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, 1.0 = 258x258). Default value is None. - :paramtype buffer: str + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str @@ -10714,7 +29195,8 @@ async def get_mosaics_tile_json( # pylint: disable=too-many-locals "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", - "lowest", "mean", "median", "stdev", "lastbandlow", and "lastbandhigh". Default value is None. + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. @@ -10748,15 +29230,22 @@ async def get_mosaics_tile_json( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileJsonMetadata + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10770,28 +29259,37 @@ async def get_mosaics_tile_json( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_tile_json_request( + _request = build_data_get_searches_tile_no_tms_by_scale_and_format_request( search_id=search_id, - tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, scan_limit=scan_limit, items_limit=items_limit, time_limit=time_limit, exit_when_full=exit_when_full, skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, - min_zoom=min_zoom, - max_zoom=max_zoom, - tile_format=tile_format, - tile_scale=tile_scale, + tile_matrix_set_id=tile_matrix_set_id, buffer=buffer, color_formula=color_formula, collection=collection, @@ -10801,6 +29299,7 @@ async def get_mosaics_tile_json( # pylint: disable=too-many-locals color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -10810,7 +29309,8 @@ async def get_mosaics_tile_json( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -10826,59 +29326,51 @@ async def get_mosaics_tile_json( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TileJsonMetadata, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def get_mosaics_tile( # pylint: disable=too-many-locals + async def get_searches_assets_for_tile_no_tms( # pylint: disable=too-many-locals self, search_id: str, - tile_matrix_set_id: str, z: float, x: float, y: float, - scale: float, - format: str, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, scan_limit: Optional[int] = None, items_limit: Optional[int] = None, time_limit: Optional[int] = None, exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - buffer: Optional[str] = None, - color_formula: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, collection: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Tile Tilematrixsetid As Path. + ) -> List[Any]: + """Searches Assets For Tile. - Create map tile. + The most basic operation. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and representing the scaleDenominator the tile. Required. :type z: float @@ -10888,101 +29380,221 @@ async def get_mosaics_tile( # pylint: disable=too-many-locals :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the MatrixWidth-1 for the selected TileMatrix. Required. :type y: float - :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. - :type scale: float - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword scan_limit: Return as soon as we scan N items (defaults to 10000 in PgSTAC). Default - value is None. + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. :paramtype scan_limit: int - :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100 in - PgSTAC). Default value is None. + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. :paramtype items_limit: int - :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5 in PgSTAC). + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :return: list of any + :rtype: list[any] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[Any]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_assets_for_tile_no_tms_request( + search_id=search_id, + z=z, + x=x, + y=y, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + tile_matrix_set_id=tile_matrix_set_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[Any], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_searches_point( # pylint: disable=too-many-locals + self, + search_id: str, + longitude: float, + latitude: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + **kwargs: Any + ) -> _models.TilerCoreModelsResponsesPoint: + """Searches Point. + + Get Point value for a search dataset. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. :paramtype time_limit: int - :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True in - PgSTAC). Default value is None. + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. :paramtype exit_when_full: bool :keyword skip_covered: Skip any items that would show up completely under the previous items (defaults - to True in PgSTAC). Default value is None. + to True). Default value is None. :paramtype skip_covered: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword collection: STAC Collection ID. Default value is None. + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. :paramtype collection: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", - "lowest", "mean", "median", "stdev", "lastbandlow", and "lastbandhigh". Default value is None. - :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :return: TilerCoreModelsResponsesPoint. The TilerCoreModelsResponsesPoint is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerCoreModelsResponsesPoint :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10996,38 +29608,34 @@ async def get_mosaics_tile( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.TilerCoreModelsResponsesPoint] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_tile_request( + _request = build_data_get_searches_point_request( search_id=search_id, - tile_matrix_set_id=tile_matrix_set_id, - z=z, - x=x, - y=y, - scale=scale, - format=format, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, + longitude=longitude, + latitude=latitude, scan_limit=scan_limit, items_limit=items_limit, time_limit=time_limit, exit_when_full=exit_when_full, skip_covered=skip_covered, - algorithm=algorithm, - algorithm_params=algorithm_params, - buffer=buffer, - color_formula=color_formula, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, collection=collection, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + coordinate_reference_system=coordinate_reference_system, resampling=resampling, - pixel_selection=pixel_selection, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, api_version=self._config.api_version, headers=_headers, params=_params, @@ -11037,7 +29645,8 @@ async def get_mosaics_tile( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", True) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11053,137 +29662,87 @@ async def get_mosaics_tile( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerCoreModelsResponsesPoint, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def get_mosaics_wmts_capabilities( # pylint: disable=too-many-locals + async def get_searches_point_with_assets( # pylint: disable=too-many-locals self, search_id: str, - tile_matrix_set_id: str, + longitude: float, + latitude: float, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - buffer: Optional[str] = None, - color_formula: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Wmts Tilematrixsetid As Path. + ) -> List[_models.StacItemPointAsset]: + """Searches Point Assets. - OGC WMTS endpoint. + Return a list of assets for a given point in a search. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", - "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. - :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat - :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles - (e.g., 1=256x256, 2=512x512). Default value is None. - :paramtype tile_scale: int - :keyword min_zoom: Overwrite default minzoom. Default value is None. - :paramtype min_zoom: int - :keyword max_zoom: Overwrite default maxzoom. Default value is None. - :paramtype max_zoom: int - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :return: list of StacItemPointAsset + :rtype: list[~azure.planetarycomputer.models.StacItemPointAsset] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11197,30 +29756,25 @@ async def get_mosaics_wmts_capabilities( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.StacItemPointAsset]] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_wmts_capabilities_request( + _request = build_data_get_searches_point_with_assets_request( search_id=search_id, - tile_matrix_set_id=tile_matrix_set_id, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - algorithm=algorithm, - algorithm_params=algorithm_params, - tile_format=tile_format, - tile_scale=tile_scale, - min_zoom=min_zoom, - max_zoom=max_zoom, - buffer=buffer, - color_formula=color_formula, - resampling=resampling, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, + longitude=longitude, + latitude=latitude, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, api_version=self._config.api_version, headers=_headers, params=_params, @@ -11230,7 +29784,8 @@ async def get_mosaics_wmts_capabilities( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", True) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11246,25 +29801,25 @@ async def get_mosaics_wmts_capabilities( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.StacItemPointAsset], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore -class SharedAccessSignatureOperations: +class SasOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.planetarycomputer.aio.PlanetaryComputerProClient`'s - :attr:`shared_access_signature` attribute. + :attr:`sas` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -11308,7 +29863,7 @@ async def get_sign( cls: ClsType[_models.SharedAccessSignatureSignedLink] = kwargs.pop("cls", None) - _request = build_shared_access_signature_get_sign_request( + _request = build_sas_get_sign_request( href=href, duration_in_minutes=duration_in_minutes, api_version=self._config.api_version, @@ -11320,6 +29875,7 @@ async def get_sign( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11337,7 +29893,7 @@ async def get_sign( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.SharedAccessSignatureSignedLink, response.json()) @@ -11379,7 +29935,7 @@ async def get_token( cls: ClsType[_models.SharedAccessSignatureToken] = kwargs.pop("cls", None) - _request = build_shared_access_signature_get_token_request( + _request = build_sas_get_token_request( collection_id=collection_id, duration_in_minutes=duration_in_minutes, api_version=self._config.api_version, @@ -11391,6 +29947,7 @@ async def get_token( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11408,7 +29965,7 @@ async def get_token( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.SharedAccessSignatureToken, response.json()) @@ -11444,7 +30001,7 @@ async def revoke_token(self, *, duration_in_minutes: Optional[int] = None, **kwa cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_shared_access_signature_revoke_token_request( + _request = build_sas_revoke_token_request( duration_in_minutes=duration_in_minutes, api_version=self._config.api_version, headers=_headers, diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/__init__.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/__init__.py index 54cc3911b1f2..3cb3e9acdfcb 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/__init__.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/__init__.py @@ -23,8 +23,6 @@ ErrorInfo, Feature, Geometry, - ImageParameters, - ImageResponse, IngestionDefinition, IngestionRun, IngestionRunOperation, @@ -83,6 +81,12 @@ TileMatrix, TileMatrixSet, TileMatrixSetBoundingBox, + TileMatrixSetLimitsEntry, + TileSetBoundingBox, + TileSetEntry, + TileSetLink, + TileSetList, + TileSetMetadata, TileSettings, TilerAssetGeoJson, TilerCoreModelsResponsesPoint, @@ -113,6 +117,7 @@ PixelSelection, RenderOptionType, Resampling, + SelMethod, StacAssetUrlSigningMode, StacLinkType, StacModelType, @@ -121,7 +126,9 @@ TerrainAlgorithm, TileAddressingScheme, TileMatrixCornerOfOrigin, + TileMatrixSetId, TilerImageFormat, + WarpKernelResampling, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -137,8 +144,6 @@ "ErrorInfo", "Feature", "Geometry", - "ImageParameters", - "ImageResponse", "IngestionDefinition", "IngestionRun", "IngestionRunOperation", @@ -197,6 +202,12 @@ "TileMatrix", "TileMatrixSet", "TileMatrixSetBoundingBox", + "TileMatrixSetLimitsEntry", + "TileSetBoundingBox", + "TileSetEntry", + "TileSetLink", + "TileSetList", + "TileSetMetadata", "TileSettings", "TilerAssetGeoJson", "TilerCoreModelsResponsesPoint", @@ -224,6 +235,7 @@ "PixelSelection", "RenderOptionType", "Resampling", + "SelMethod", "StacAssetUrlSigningMode", "StacLinkType", "StacModelType", @@ -232,7 +244,9 @@ "TerrainAlgorithm", "TileAddressingScheme", "TileMatrixCornerOfOrigin", + "TileMatrixSetId", "TilerImageFormat", + "WarpKernelResampling", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_enums.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_enums.py index 7bc10699456d..20eb47245982 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_enums.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_enums.py @@ -445,6 +445,94 @@ class ColorMapNames(str, Enum, metaclass=CaseInsensitiveEnumMeta): """YlOrRd colormap - sequential white to dark red-orange.""" YLORRD_R = "ylorrd_r" """Reversed YlOrRd colormap.""" + ALGAE = "algae" + """Algae colormap - sequential green colormap for ocean data.""" + ALGAE_R = "algae_r" + """Reversed algae colormap.""" + AMP = "amp" + """Amp colormap - sequential magenta colormap for ocean data.""" + AMP_R = "amp_r" + """Reversed amp colormap.""" + BALANCE = "balance" + """Balance colormap - diverging blue to red for ocean data.""" + BALANCE_R = "balance_r" + """Reversed balance colormap.""" + CURL = "curl" + """Curl colormap - diverging teal to red for ocean data.""" + CURL_R = "curl_r" + """Reversed curl colormap.""" + DEEP = "deep" + """Deep colormap - sequential blue colormap for ocean data.""" + DEEP_R = "deep_r" + """Reversed deep colormap.""" + DELTA = "delta" + """Delta colormap - diverging blue to green for ocean data.""" + DELTA_R = "delta_r" + """Reversed delta colormap.""" + DENSE = "dense" + """Dense colormap - sequential purple colormap for ocean data.""" + DENSE_R = "dense_r" + """Reversed dense colormap.""" + DIFF = "diff" + """Diff colormap - diverging colormap for difference data.""" + DIFF_R = "diff_r" + """Reversed diff colormap.""" + HALINE = "haline" + """Haline colormap - sequential blue to yellow for salinity data.""" + HALINE_R = "haline_r" + """Reversed haline colormap.""" + ICE = "ice" + """Ice colormap - sequential blue colormap for ice data.""" + ICE_R = "ice_r" + """Reversed ice colormap.""" + MATTER = "matter" + """Matter colormap - sequential yellow to brown for ocean data.""" + MATTER_R = "matter_r" + """Reversed matter colormap.""" + OXY = "oxy" + """Oxy colormap - diverging colormap for oxygen data.""" + OXY_R = "oxy_r" + """Reversed oxy colormap.""" + PHASE = "phase" + """Phase colormap - circular colormap for phase data.""" + PHASE_R = "phase_r" + """Reversed phase colormap.""" + RAIN = "rain" + """Rain colormap - sequential colormap for precipitation data.""" + RAIN_R = "rain_r" + """Reversed rain colormap.""" + SOLAR = "solar" + """Solar colormap - sequential colormap for solar radiation data.""" + SOLAR_R = "solar_r" + """Reversed solar colormap.""" + SPEED = "speed" + """Speed colormap - sequential colormap for velocity data.""" + SPEED_R = "speed_r" + """Reversed speed colormap.""" + TARN = "tarn" + """Tarn colormap - sequential colormap for topographic data.""" + TARN_R = "tarn_r" + """Reversed tarn colormap.""" + TEMPO = "tempo" + """Tempo colormap - sequential colormap for temporal data.""" + TEMPO_R = "tempo_r" + """Reversed tempo colormap.""" + THERMAL = "thermal" + """Thermal colormap - sequential colormap for temperature data.""" + THERMAL_R = "thermal_r" + """Reversed thermal colormap.""" + TOPO = "topo" + """Topo colormap - sequential colormap for topographic data.""" + TOPO_R = "topo_r" + """Reversed topo colormap.""" + TURBID = "turbid" + """Turbid colormap - sequential colormap for turbidity data.""" + TURBID_R = "turbid_r" + """Reversed turbid colormap.""" + TURBO = "turbo" + """Turbo colormap - improved rainbow colormap.""" + TURBO_R = "turbo_r" + """Reversed turbo colormap.""" class FeatureType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -515,6 +603,8 @@ class IngestionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): STATIC_CATALOG = "StaticCatalog" """Static STAC Catalog.""" + STAC_GEOPARQUET = "StacGeoparquet" + """Ingestion STAC Geoparquet catalog.""" class LegendConfigType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -608,6 +698,8 @@ class PixelSelection(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Select image with lowest value in the last band.""" LAST_BAND_HIGH = "lastbandhigh" """Select image with highest value in the last band.""" + COUNT = "count" + """Count available pixels across sources.""" class RenderOptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -644,6 +736,27 @@ class Resampling(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Root mean square resampling - useful for resampling error or deviation grids.""" +class SelMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Xarray indexing method to use for inexact matches.""" + + NEAREST = "nearest" + """Nearest neighbor method.""" + LINEAR = "linear" + """Linear interpolation.""" + BILINEAR = "bilinear" + """Bilinear interpolation.""" + CUBIC = "cubic" + """Cubic interpolation.""" + CUBIC_SPLINE = "cubic_spline" + """Cubic spline interpolation.""" + LANCZOS = "lanczos" + """Lanczos interpolation.""" + AREA = "area" + """Area-weighted interpolation.""" + MODE = "mode" + """Mode (most common) value.""" + + class StacAssetUrlSigningMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Represent the signature type for asset URLs.""" @@ -733,6 +846,26 @@ class TerrainAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Encodes elevation data in Mapbox Terrarium RGB format.""" TERRAINRGB = "terrainrgb" """Encodes elevation data in Mapbox TerrainRGB format.""" + SLOPE = "slope" + """Calculates slope from elevation data.""" + CAST = "cast" + """Casts data to a different type.""" + CEIL = "ceil" + """Rounds values up to the nearest integer.""" + FLOOR = "floor" + """Rounds values down to the nearest integer.""" + MIN = "min" + """Computes the minimum value across bands.""" + MAX = "max" + """Computes the maximum value across bands.""" + MEDIAN = "median" + """Computes the median value across bands.""" + MEAN = "mean" + """Computes the mean value across bands.""" + STD = "std" + """Computes the standard deviation across bands.""" + VAR = "var" + """Computes the variance across bands.""" class TileAddressingScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -755,6 +888,38 @@ class TileMatrixCornerOfOrigin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Origin at the bottom-left corner (Y increases upward).""" +class TileMatrixSetId(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Identifier selecting one of the TileMatrixSetId supported (default: + 'WebMercatorQuad') + + Standard identifier for a coordinate reference system and tiling scheme used for serving map + tiles. + """ + + CANADIAN_NAD83_LCC = "CanadianNAD83_LCC" + """Canadian NAD83 Lambert Conformal Conic projection tile matrix set.""" + EUROPEAN_ETRS89_LAEAQUAD = "EuropeanETRS89_LAEAQuad" + """European ETRS89 Lambert Azimuthal Equal Area Quad tile matrix set.""" + LINZ_ANTARTICA_MAP_TILEGRID = "LINZAntarticaMapTilegrid" + """Land Information New Zealand (LINZ) Antarctica Map tile grid matrix set.""" + NZTM2000_QUAD = "NZTM2000Quad" + """New Zealand Transverse Mercator 2000 Quad tile matrix set.""" + UPS_ANTARCTIC_WGS84_QUAD = "UPSAntarcticWGS84Quad" + """Universal Polar Stereographic Antarctic WGS84 Quad tile matrix set.""" + UPS_ARCTIC_WGS84_QUAD = "UPSArcticWGS84Quad" + """Universal Polar Stereographic Arctic WGS84 Quad tile matrix set.""" + UTM31_WGS84_QUAD = "UTM31WGS84Quad" + """Universal Transverse Mercator Zone 31 WGS84 Quad tile matrix set.""" + WGS1984_QUAD = "WGS1984Quad" + """WGS 1984 Quad tile matrix set.""" + WEB_MERCATOR_QUAD = "WebMercatorQuad" + """Web Mercator Quad tile matrix set.""" + WORLD_CRS84_QUAD = "WorldCRS84Quad" + """World CRS84 Quad tile matrix set.""" + WORLD_MERCATOR_WGS84_QUAD = "WorldMercatorWGS84Quad" + """World Mercator WGS84 Quad tile matrix set.""" + + class TilerImageFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Image format specifier for tile and image requests.""" @@ -774,3 +939,36 @@ class TilerImageFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """WebP format - modern image format with good compression.""" PNGRAW = "pngraw" """Raw PNG format for access to unprocessed data.""" + + +class WarpKernelResampling(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WarpKernel resampling algorithm used when doing re-projection. Defaults to ``nearest``.""" + + NEAREST = "nearest" + """Nearest neighbor.""" + BILINEAR = "bilinear" + """Bilinear interpolation.""" + CUBIC = "cubic" + """Cubic interpolation.""" + CUBIC_SPLINE = "cubic_spline" + """Cubic spline interpolation.""" + LANCZOS = "lanczos" + """Lanczos windowed sinc resampling.""" + AVERAGE = "average" + """Average resampling.""" + MODE = "mode" + """Mode resampling.""" + MAX = "max" + """Maximum value resampling.""" + MIN = "min" + """Minimum value resampling.""" + MED = "med" + """Median value resampling.""" + Q1 = "q1" + """First quartile resampling.""" + Q3 = "q3" + """Third quartile resampling.""" + SUM = "sum" + """Sum resampling.""" + RMS = "rms" + """Root mean square resampling.""" diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_models.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_models.py index 840671abaf7d..bc503bfe31f7 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_models.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_models.py @@ -335,112 +335,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ImageParameters(_Model): - """Parameters for requesting a rendered image from a collection. - - :ivar cql: Cql. Required. - :vartype cql: dict[str, any] - :ivar zoom: Zoom. - :vartype zoom: float - :ivar geometry: Geometry. - :vartype geometry: ~azure.planetarycomputer.models.Geometry - :ivar render_parameters: JSON-encoded visualization parameters. Required. - :vartype render_parameters: str - :ivar columns: Width of the output image in pixels. Required. - :vartype columns: int - :ivar rows: Height of the output image in pixels. Required. - :vartype rows: int - :ivar show_branding: Whether to include branding on the output image. - :vartype show_branding: bool - :ivar image_size: Image size. - :vartype image_size: str - """ - - cql: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Cql. Required.""" - zoom: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Zoom.""" - geometry: Optional["_models.Geometry"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Geometry.""" - render_parameters: str = rest_field( - name="render_params", visibility=["read", "create", "update", "delete", "query"] - ) - """JSON-encoded visualization parameters. Required.""" - columns: int = rest_field(name="cols", visibility=["read", "create", "update", "delete", "query"]) - """Width of the output image in pixels. Required.""" - rows: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Height of the output image in pixels. Required.""" - show_branding: Optional[bool] = rest_field( - name="showBranding", visibility=["read", "create", "update", "delete", "query"] - ) - """Whether to include branding on the output image.""" - image_size: Optional[str] = rest_field(name="imageSize", visibility=["read", "create", "update", "delete", "query"]) - """Image size.""" - - @overload - def __init__( - self, - *, - cql: dict[str, Any], - render_parameters: str, - columns: int, - rows: int, - zoom: Optional[float] = None, - geometry: Optional["_models.Geometry"] = None, - show_branding: Optional[bool] = None, - image_size: Optional[str] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class ImageResponse(_Model): - """Response model for image exports. - - :ivar url: URL of the exported image. Required. - :vartype url: str - """ - - url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """URL of the exported image. Required.""" - - @overload - def __init__( - self, - *, - url: str, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - class IngestionDefinition(_Model): """Microsoft Planetary Computer Pro geo-catalog ingestion creation model. :ivar id: Ingestion id. Required. :vartype id: str - :ivar import_type: Ingestion type. Required. "StaticCatalog" + :ivar import_type: Ingestion type. Required. Known values are: "StaticCatalog" and + "StacGeoparquet". :vartype import_type: str or ~azure.planetarycomputer.models.IngestionType :ivar display_name: Ingestion name. :vartype display_name: str :ivar source_catalog_url: Source catalog URL. Required for StaticCatalog ingestion type. :vartype source_catalog_url: str + :ivar stac_geoparquet_url: Parquet catalog URL. Required for StacGeoparquet ingestion type. + :vartype stac_geoparquet_url: str :ivar skip_existing_items: Skip processing existing items in the catalog. :vartype skip_existing_items: bool :ivar keep_original_assets: Keep original source assets. @@ -456,7 +364,7 @@ class IngestionDefinition(_Model): import_type: Union[str, "_models.IngestionType"] = rest_field( name="importType", visibility=["read", "create", "update"] ) - """Ingestion type. Required. \"StaticCatalog\"""" + """Ingestion type. Required. Known values are: \"StaticCatalog\" and \"StacGeoparquet\".""" display_name: Optional[str] = rest_field( name="displayName", visibility=["read", "create", "update", "delete", "query"] ) @@ -465,6 +373,10 @@ class IngestionDefinition(_Model): name="sourceCatalogUrl", visibility=["read", "create", "update", "delete", "query"] ) """Source catalog URL. Required for StaticCatalog ingestion type.""" + stac_geoparquet_url: Optional[str] = rest_field( + name="stacGeoparquetUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """Parquet catalog URL. Required for StacGeoparquet ingestion type.""" skip_existing_items: Optional[bool] = rest_field( name="skipExistingItems", visibility=["read", "create", "update", "delete", "query"] ) @@ -485,6 +397,7 @@ def __init__( import_type: Union[str, "_models.IngestionType"], display_name: Optional[str] = None, source_catalog_url: Optional[str] = None, + stac_geoparquet_url: Optional[str] = None, skip_existing_items: Optional[bool] = None, keep_original_assets: Optional[bool] = None, ) -> None: ... @@ -3700,6 +3613,54 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class TileMatrixSetLimitsEntry(_Model): + """Limits for a specific tile matrix within a tileset, defining the valid row/column range. + + :ivar tile_matrix: Identifier of the tile matrix level. Required. + :vartype tile_matrix: str + :ivar min_tile_row: Minimum tile row index at this zoom level. Required. + :vartype min_tile_row: int + :ivar max_tile_row: Maximum tile row index at this zoom level. Required. + :vartype max_tile_row: int + :ivar min_tile_col: Minimum tile column index at this zoom level. Required. + :vartype min_tile_col: int + :ivar max_tile_col: Maximum tile column index at this zoom level. Required. + :vartype max_tile_col: int + """ + + tile_matrix: str = rest_field(name="tileMatrix", visibility=["read", "create", "update", "delete", "query"]) + """Identifier of the tile matrix level. Required.""" + min_tile_row: int = rest_field(name="minTileRow", visibility=["read", "create", "update", "delete", "query"]) + """Minimum tile row index at this zoom level. Required.""" + max_tile_row: int = rest_field(name="maxTileRow", visibility=["read", "create", "update", "delete", "query"]) + """Maximum tile row index at this zoom level. Required.""" + min_tile_col: int = rest_field(name="minTileCol", visibility=["read", "create", "update", "delete", "query"]) + """Minimum tile column index at this zoom level. Required.""" + max_tile_col: int = rest_field(name="maxTileCol", visibility=["read", "create", "update", "delete", "query"]) + """Maximum tile column index at this zoom level. Required.""" + + @overload + def __init__( + self, + *, + tile_matrix: str, + min_tile_row: int, + max_tile_row: int, + min_tile_col: int, + max_tile_col: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class TilerAssetGeoJson(_Model): """Represents GeoJSON with feature with an asset property. @@ -3914,7 +3875,7 @@ class TilerInfoGeoJsonFeature(_Model): :ivar id: Unique identifier for the feature. :vartype id: str :ivar bounding_box: Bounding box coordinates for the feature. - :vartype bounding_box: float + :vartype bounding_box: list[float] """ type: Union[str, "_models.FeatureType"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -3925,7 +3886,9 @@ class TilerInfoGeoJsonFeature(_Model): """Properties. Required.""" id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Unique identifier for the feature.""" - bounding_box: Optional[float] = rest_field(name="bbox", visibility=["read", "create", "update", "delete", "query"]) + bounding_box: Optional[list[float]] = rest_field( + name="bbox", visibility=["read", "create", "update", "delete", "query"] + ) """Bounding box coordinates for the feature.""" @overload @@ -3936,7 +3899,7 @@ def __init__( geometry: "_models.Geometry", properties: dict[str, "_models.TilerInfo"], id: Optional[str] = None, # pylint: disable=redefined-builtin - bounding_box: Optional[float] = None, + bounding_box: Optional[list[float]] = None, ) -> None: ... @overload @@ -4002,10 +3965,6 @@ class TilerStacSearchDefinition(_Model): :vartype hash: str :ivar search: Search. Required. :vartype search: dict[str, any] - :ivar where: SQL WHERE clause representing the search filters. Required. - :vartype where: str - :ivar order_by: SQL ORDER BY clause for sorting results. Required. - :vartype order_by: str :ivar last_used: Timestamp when the search was last accessed. Required. :vartype last_used: ~datetime.datetime :ivar use_count: Number of times the search has been accessed. Required. @@ -4018,10 +3977,6 @@ class TilerStacSearchDefinition(_Model): """Unique hash identifier for the search query. Required.""" search: dict[str, Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Search. Required.""" - where: str = rest_field(name="_where", visibility=["read", "create", "update", "delete", "query"]) - """SQL WHERE clause representing the search filters. Required.""" - order_by: str = rest_field(name="orderby", visibility=["read", "create", "update", "delete", "query"]) - """SQL ORDER BY clause for sorting results. Required.""" last_used: datetime.datetime = rest_field( name="lastused", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" ) @@ -4037,8 +3992,6 @@ def __init__( *, hash: str, search: dict[str, Any], - where: str, - order_by: str, last_used: datetime.datetime, use_count: int, metadata: "_models.MosaicMetadata", @@ -4096,6 +4049,240 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class TileSetBoundingBox(_Model): + """Bounding box for a tile set. + + :ivar lower_left: Lower-left corner coordinates [x, y]. Required. + :vartype lower_left: list[float] + :ivar upper_right: Upper-right corner coordinates [x, y]. Required. + :vartype upper_right: list[float] + :ivar crs: Coordinate reference system identifier. + :vartype crs: str + """ + + lower_left: list[float] = rest_field(name="lowerLeft", visibility=["read", "create", "update", "delete", "query"]) + """Lower-left corner coordinates [x, y]. Required.""" + upper_right: list[float] = rest_field(name="upperRight", visibility=["read", "create", "update", "delete", "query"]) + """Upper-right corner coordinates [x, y]. Required.""" + crs: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Coordinate reference system identifier.""" + + @overload + def __init__( + self, + *, + lower_left: list[float], + upper_right: list[float], + crs: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TileSetEntry(_Model): + """Summary information about a single tileset within a list of available tilesets. + + :ivar title: Human-readable title of the tileset. + :vartype title: str + :ivar data_type: Type of data in the tiles (e.g., 'map', 'vector'). + :vartype data_type: str + :ivar crs: Coordinate reference system identifier. + :vartype crs: str + :ivar links: Links related to this tileset. + :vartype links: list[~azure.planetarycomputer.models.TileSetLink] + :ivar bounding_box: Bounding box of the tileset. + :vartype bounding_box: ~azure.planetarycomputer.models.TileSetBoundingBox + :ivar access_constraints: Access constraints for the tileset. + :vartype access_constraints: str + """ + + title: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Human-readable title of the tileset.""" + data_type: Optional[str] = rest_field(name="dataType", visibility=["read", "create", "update", "delete", "query"]) + """Type of data in the tiles (e.g., 'map', 'vector').""" + crs: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Coordinate reference system identifier.""" + links: Optional[list["_models.TileSetLink"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Links related to this tileset.""" + bounding_box: Optional["_models.TileSetBoundingBox"] = rest_field( + name="boundingBox", visibility=["read", "create", "update", "delete", "query"] + ) + """Bounding box of the tileset.""" + access_constraints: Optional[str] = rest_field( + name="accessConstraints", visibility=["read", "create", "update", "delete", "query"] + ) + """Access constraints for the tileset.""" + + @overload + def __init__( + self, + *, + title: Optional[str] = None, + data_type: Optional[str] = None, + crs: Optional[str] = None, + links: Optional[list["_models.TileSetLink"]] = None, + bounding_box: Optional["_models.TileSetBoundingBox"] = None, + access_constraints: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TileSetLink(_Model): + """A link object used in OGC tile resources. + + :ivar href: The URL target of the link. Required. + :vartype href: str + :ivar rel: The relationship type of the link. Required. + :vartype rel: str + :ivar type: The media type of the linked resource. + :vartype type: str + :ivar title: Human-readable title of the link. + :vartype title: str + """ + + href: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The URL target of the link. Required.""" + rel: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The relationship type of the link. Required.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The media type of the linked resource.""" + title: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Human-readable title of the link.""" + + @overload + def __init__( + self, + *, + href: str, + rel: str, + type: Optional[str] = None, + title: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TileSetList(_Model): + """Response containing a list of available tilesets. + + :ivar tilesets: Array of available tilesets. Required. + :vartype tilesets: list[~azure.planetarycomputer.models.TileSetEntry] + """ + + tilesets: list["_models.TileSetEntry"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Array of available tilesets. Required.""" + + @overload + def __init__( + self, + *, + tilesets: list["_models.TileSetEntry"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TileSetMetadata(_Model): + """Detailed metadata about a specific tileset, including tile matrix set limits. + + :ivar title: Human-readable title of the tileset. + :vartype title: str + :ivar data_type: Type of data in the tiles. + :vartype data_type: str + :ivar crs: Coordinate reference system identifier. + :vartype crs: str + :ivar links: Links related to this tileset. + :vartype links: list[~azure.planetarycomputer.models.TileSetLink] + :ivar bounding_box: Bounding box of the tileset. + :vartype bounding_box: ~azure.planetarycomputer.models.TileSetBoundingBox + :ivar access_constraints: Access constraints for the tileset. + :vartype access_constraints: str + :ivar tile_matrix_set_limits: Limits for each tile matrix level in the tileset. + :vartype tile_matrix_set_limits: list[~azure.planetarycomputer.models.TileMatrixSetLimitsEntry] + """ + + title: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Human-readable title of the tileset.""" + data_type: Optional[str] = rest_field(name="dataType", visibility=["read", "create", "update", "delete", "query"]) + """Type of data in the tiles.""" + crs: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Coordinate reference system identifier.""" + links: Optional[list["_models.TileSetLink"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Links related to this tileset.""" + bounding_box: Optional["_models.TileSetBoundingBox"] = rest_field( + name="boundingBox", visibility=["read", "create", "update", "delete", "query"] + ) + """Bounding box of the tileset.""" + access_constraints: Optional[str] = rest_field( + name="accessConstraints", visibility=["read", "create", "update", "delete", "query"] + ) + """Access constraints for the tileset.""" + tile_matrix_set_limits: Optional[list["_models.TileMatrixSetLimitsEntry"]] = rest_field( + name="tileMatrixSetLimits", visibility=["read", "create", "update", "delete", "query"] + ) + """Limits for each tile matrix level in the tileset.""" + + @overload + def __init__( + self, + *, + title: Optional[str] = None, + data_type: Optional[str] = None, + crs: Optional[str] = None, + links: Optional[list["_models.TileSetLink"]] = None, + bounding_box: Optional["_models.TileSetBoundingBox"] = None, + access_constraints: Optional[str] = None, + tile_matrix_set_limits: Optional[list["_models.TileMatrixSetLimitsEntry"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class TileSettings(_Model): """Configuration for map tile visualization. diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/__init__.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/__init__.py index 8ebab4777f3c..77959284ac2c 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/__init__.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/__init__.py @@ -15,7 +15,7 @@ from ._operations import IngestionOperations # type: ignore from ._operations import StacOperations # type: ignore from ._operations import DataOperations # type: ignore -from ._operations import SharedAccessSignatureOperations # type: ignore +from ._operations import SasOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -25,7 +25,7 @@ "IngestionOperations", "StacOperations", "DataOperations", - "SharedAccessSignatureOperations", + "SasOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/_operations.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/_operations.py index 682ae83d26a2..ce16f34a8862 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/_operations.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from io import IOBase import json from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload @@ -33,8 +33,9 @@ from .. import models as _models from .._configuration import PlanetaryComputerProClientConfiguration +# TODO: Remove pylint disable once pygen emitter fixes unused _deserialize_xml import +# https://github.com/Azure/autorest.python/issues/XXXX from .._utils.model_base import Model as _Model, SdkJSONEncoder, _deserialize, _deserialize_xml # pylint: disable=unused-import - # pylint: disable=unused-import from .._utils.serialization import Deserializer, Serializer from .._utils.utils import prepare_multipart_form_data @@ -51,7 +52,7 @@ def build_ingestion_cancel_operation_request(operation_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) # Construct URL _url = "/inma/operations/{operationId}" path_format_arguments = { @@ -69,7 +70,7 @@ def build_ingestion_cancel_operation_request(operation_id: str, **kwargs: Any) - def build_ingestion_cancel_all_operations_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) # Construct URL _url = "/inma/operations" @@ -83,7 +84,7 @@ def build_ingestion_get_operation_request(operation_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +115,7 @@ def build_ingestion_list_operations_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +142,7 @@ def build_ingestion_create_run_request(collection_id: str, ingestion_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +167,7 @@ def build_ingestion_get_run_request(collection_id: str, ingestion_id: str, run_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +195,7 @@ def build_ingestion_list_runs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +225,7 @@ def build_ingestion_create_request(collection_id: str, **kwargs: Any) -> HttpReq _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -250,7 +251,7 @@ def build_ingestion_delete_request(collection_id: str, ingestion_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -275,7 +276,7 @@ def build_ingestion_get_request(collection_id: str, ingestion_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +303,7 @@ def build_ingestion_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -331,7 +332,7 @@ def build_ingestion_update_request(collection_id: str, ingestion_id: str, **kwar _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -359,7 +360,7 @@ def build_ingestion_create_source_request(**kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -381,7 +382,7 @@ def build_ingestion_replace_source_request(id: str, **kwargs: Any) -> HttpReques _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -406,7 +407,7 @@ def build_ingestion_replace_source_request(id: str, **kwargs: Any) -> HttpReques def build_ingestion_delete_source_request(id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) # Construct URL _url = "/inma/ingestion-sources/{id}" path_format_arguments = { @@ -425,7 +426,7 @@ def build_ingestion_get_source_request(id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -451,7 +452,7 @@ def build_ingestion_list_sources_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -474,7 +475,7 @@ def build_ingestion_list_managed_identities_request(**kwargs: Any) -> HttpReques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -495,7 +496,7 @@ def build_stac_create_collection_asset_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -521,7 +522,7 @@ def build_stac_replace_collection_asset_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -548,7 +549,7 @@ def build_stac_delete_collection_asset_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -575,7 +576,7 @@ def build_stac_get_collection_configuration_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -600,7 +601,7 @@ def build_stac_add_mosaic_request(collection_id: str, **kwargs: Any) -> HttpRequ _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -627,7 +628,7 @@ def build_stac_replace_mosaic_request(collection_id: str, mosaic_id: str, **kwar _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -653,7 +654,7 @@ def build_stac_replace_mosaic_request(collection_id: str, mosaic_id: str, **kwar def build_stac_delete_mosaic_request(collection_id: str, mosaic_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) # Construct URL _url = "/stac/collections/{collectionId}/configurations/mosaics/{mosaicId}" path_format_arguments = { @@ -673,7 +674,7 @@ def build_stac_get_mosaic_request(collection_id: str, mosaic_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -698,7 +699,7 @@ def build_stac_list_mosaics_request(collection_id: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -723,7 +724,7 @@ def build_stac_create_collection_request(**kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -740,14 +741,12 @@ def build_stac_create_collection_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stac_create_or_replace_collection_request( # pylint: disable=name-too-long - collection_id: str, **kwargs: Any -) -> HttpRequest: +def build_stac_replace_collection_request(collection_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -773,7 +772,7 @@ def build_stac_delete_collection_request(collection_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -803,7 +802,7 @@ def build_stac_get_collection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -836,7 +835,7 @@ def build_stac_get_collections_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -859,7 +858,7 @@ def build_stac_get_partition_type_request(collection_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -886,7 +885,7 @@ def build_stac_replace_partition_type_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) # Construct URL _url = "/stac/collections/{collectionId}/configurations/partition-type" path_format_arguments = { @@ -910,7 +909,7 @@ def build_stac_create_render_option_request(collection_id: str, **kwargs: Any) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -937,7 +936,7 @@ def build_stac_replace_render_option_request(collection_id: str, render_option_i _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -963,7 +962,7 @@ def build_stac_replace_render_option_request(collection_id: str, render_option_i def build_stac_delete_render_option_request(collection_id: str, render_option_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) # Construct URL _url = "/stac/collections/{collectionId}/configurations/render-options/{renderOptionId}" path_format_arguments = { @@ -983,7 +982,7 @@ def build_stac_get_render_option_request(collection_id: str, render_option_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1008,7 +1007,7 @@ def build_stac_list_render_options_request(collection_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1034,7 +1033,7 @@ def build_stac_get_collection_thumbnail_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", None) # Construct URL @@ -1059,7 +1058,7 @@ def build_stac_get_tile_settings_request(collection_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1084,7 +1083,7 @@ def build_stac_replace_tile_settings_request(collection_id: str, **kwargs: Any) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1110,7 +1109,7 @@ def build_stac_get_conformance_class_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1129,7 +1128,7 @@ def build_stac_get_landing_page_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1149,7 +1148,7 @@ def build_stac_create_item_request(collection_id: str, **kwargs: Any) -> HttpReq _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1171,14 +1170,12 @@ def build_stac_create_item_request(collection_id: str, **kwargs: Any) -> HttpReq return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_stac_create_or_replace_item_request( # pylint: disable=name-too-long - collection_id: str, item_id: str, **kwargs: Any -) -> HttpRequest: +def build_stac_replace_item_request(collection_id: str, item_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1205,7 +1202,7 @@ def build_stac_delete_item_request(collection_id: str, item_id: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1226,11 +1223,18 @@ def build_stac_delete_item_request(collection_id: str, item_id: str, **kwargs: A return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_stac_get_item_request(collection_id: str, item_id: str, **kwargs: Any) -> HttpRequest: +def build_stac_get_item_request( + collection_id: str, + item_id: str, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1244,6 +1248,10 @@ def build_stac_get_item_request(collection_id: str, item_id: str, **kwargs: Any) # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sign is not None: + _params["sign"] = _SERIALIZER.query("sign", sign, "str") + if duration_in_minutes is not None: + _params["duration"] = _SERIALIZER.query("duration_in_minutes", duration_in_minutes, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1257,12 +1265,15 @@ def build_stac_get_item_collection_request( limit: Optional[int] = None, bounding_box: Optional[List[str]] = None, datetime: Optional[str] = None, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1281,6 +1292,12 @@ def build_stac_get_item_collection_request( _params["bbox"] = _SERIALIZER.query("bounding_box", bounding_box, "[str]", div=",") if datetime is not None: _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sign is not None: + _params["sign"] = _SERIALIZER.query("sign", sign, "str") + if duration_in_minutes is not None: + _params["duration"] = _SERIALIZER.query("duration_in_minutes", duration_in_minutes, "int") + if token is not None: + _params["token"] = _SERIALIZER.query("token", token, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1293,7 +1310,7 @@ def build_stac_update_item_request(collection_id: str, item_id: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1321,7 +1338,7 @@ def build_stac_create_queryables_request(collection_id: str, **kwargs: Any) -> H _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1348,7 +1365,7 @@ def build_stac_replace_queryable_request(collection_id: str, queryable_name: str _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1374,7 +1391,7 @@ def build_stac_replace_queryable_request(collection_id: str, queryable_name: str def build_stac_delete_queryable_request(collection_id: str, queryable_name: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) # Construct URL _url = "/stac/collections/{collectionId}/queryables/{queryableName}" path_format_arguments = { @@ -1394,7 +1411,7 @@ def build_stac_list_queryables_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1415,7 +1432,7 @@ def build_stac_get_collection_queryables_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1445,7 +1462,7 @@ def build_stac_search_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1472,7 +1489,7 @@ def build_data_get_tile_matrix_definitions_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1496,7 +1513,7 @@ def build_data_list_tile_matrices_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1511,68 +1528,99 @@ def build_data_list_tile_matrices_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_asset_statistics_request( - collection_id: str, - item_id: str, +def build_data_get_class_map_legend_request( + classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/legend/classmap/{classmapName}" + path_format_arguments = { + "classmapName": _SERIALIZER.url("classmap_name", classmap_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if trim_start is not None: + _params["trim_start"] = _SERIALIZER.query("trim_start", trim_start, "int") + if trim_end is not None: + _params["trim_end"] = _SERIALIZER.query("trim_end", trim_end, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_interval_legend_request( + classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/legend/interval/{classmapName}" + path_format_arguments = { + "classmapName": _SERIALIZER.url("classmap_name", classmap_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if trim_start is not None: + _params["trim_start"] = _SERIALIZER.query("trim_start", trim_start, "int") + if trim_end is not None: + _params["trim_end"] = _SERIALIZER.query("trim_end", trim_end, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_legend_request( + color_map_name: str, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, + height: Optional[float] = None, + width: Optional[float] = None, + trim_start: Optional[int] = None, + trim_end: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "image/png") # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/asset_statistics" + _url = "/data/legend/colormap/{colorMapName}" path_format_arguments = { - "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), - "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "colorMapName": _SERIALIZER.url("color_map_name", color_map_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if assets is not None: - _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] - if expression is not None: - _params["expression"] = _SERIALIZER.query("expression", expression, "str") - if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") - if asset_as_band is not None: - _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") - if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") - if unscale is not None: - _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") - if resampling is not None: - _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if max_size is not None: - _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") - if categorical is not None: - _params["categorical"] = _SERIALIZER.query("categorical", categorical, "bool") - if categories_pixels is not None: - _params["c"] = _SERIALIZER.query("categories_pixels", categories_pixels, "[str]", div=",") - if percentiles is not None: - _params["p"] = _SERIALIZER.query("percentiles", percentiles, "[int]", div=",") - if histogram_bins is not None: - _params["histogram_bins"] = _SERIALIZER.query("histogram_bins", histogram_bins, "str") - if histogram_range is not None: - _params["histogram_range"] = _SERIALIZER.query("histogram_range", histogram_range, "str") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "float") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "float") + if trim_start is not None: + _params["trim_start"] = _SERIALIZER.query("trim_start", trim_start, "int") + if trim_end is not None: + _params["trim_end"] = _SERIALIZER.query("trim_end", trim_end, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1580,15 +1628,49 @@ def build_data_get_asset_statistics_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_list_available_assets_request(collection_id: str, item_id: str, **kwargs: Any) -> HttpRequest: +def build_data_register_mosaics_search_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/register" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_list_tilesets_request( + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/assets" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), @@ -1598,6 +1680,20 @@ def build_data_list_available_assets_request(collection_id: str, item_id: str, * # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1605,24 +1701,52 @@ def build_data_list_available_assets_request(collection_id: str, item_id: str, * return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_bounds_request(collection_id: str, item_id: str, **kwargs: Any) -> HttpRequest: +def build_data_get_tileset_metadata_request( + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/bounds" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles/{tileMatrixSetId}" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1630,78 +1754,94 @@ def build_data_get_bounds_request(collection_id: str, item_id: str, **kwargs: An return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_crop_geo_json_request( # pylint: disable=too-many-locals +def build_data_get_tile_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, - format: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/crop.{format}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), - "format": _SERIALIZER.url("format", format, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") - if coordinate_reference_system is not None: - _params["coord-crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if max_size is not None: - _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") - if height is not None: - _params["height"] = _SERIALIZER.query("height", height, "int") - if width is not None: - _params["width"] = _SERIALIZER.query("width", width, "int") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -1710,55 +1850,82 @@ def build_data_crop_geo_json_request( # pylint: disable=too-many-locals _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_crop_geo_json_with_dimensions_request( # pylint: disable=name-too-long,too-many-locals +def build_data_get_tile_by_format_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, - width: int, - height: int, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/crop/{width}x{height}.{format}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}.{format}" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), - "width": _SERIALIZER.url("width", width, "int"), - "height": _SERIALIZER.url("height", height, "int"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), "format": _SERIALIZER.url("format", format, "str"), } @@ -1766,30 +1933,34 @@ def build_data_crop_geo_json_with_dimensions_request( # pylint: disable=name-to # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") - if coordinate_reference_system is not None: - _params["coord-crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if max_size is not None: - _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -1798,194 +1969,204 @@ def build_data_crop_geo_json_with_dimensions_request( # pylint: disable=name-to _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_geo_json_statistics_request( # pylint: disable=name-too-long +def build_data_get_tile_by_scale_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/statistics" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") - if coordinate_reference_system is not None: - _params["coord-crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if max_size is not None: - _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") - if categorical is not None: - _params["categorical"] = _SERIALIZER.query("categorical", categorical, "bool") - if categories_pixels is not None: - _params["c"] = _SERIALIZER.query("categories_pixels", categories_pixels, "[str]", div=",") - if percentiles is not None: - _params["p"] = _SERIALIZER.query("percentiles", percentiles, "[int]", div=",") - if histogram_bins is not None: - _params["histogram_bins"] = _SERIALIZER.query("histogram_bins", histogram_bins, "str") - if histogram_range is not None: - _params["histogram_range"] = _SERIALIZER.query("histogram_range", histogram_range, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_data_get_info_geo_json_request( - collection_id: str, item_id: str, *, assets: Optional[List[str]] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/info.geojson" - path_format_arguments = { - "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), - "itemId": _SERIALIZER.url("item_id", item_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if assets is not None: - _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_data_get_item_asset_details_request( # pylint: disable=name-too-long - collection_id: str, item_id: str, *, assets: Optional[List[str]] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/info" - path_format_arguments = { - "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), - "itemId": _SERIALIZER.url("item_id", item_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if assets is not None: - _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_part_request( # pylint: disable=too-many-locals +def build_data_get_tile_by_scale_and_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-branches,too-many-statements collection_id: str, item_id: str, - minx: float, - miny: float, - maxx: float, - maxy: float, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/crop/{minx},{miny},{maxx},{maxy}.{format}" + _url = ( + "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x.{format}" + ) path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), - "minx": _SERIALIZER.url("minx", minx, "float"), - "miny": _SERIALIZER.url("miny", miny, "float"), - "maxx": _SERIALIZER.url("maxx", maxx, "float"), - "maxy": _SERIALIZER.url("maxy", maxy, "float"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), "format": _SERIALIZER.url("format", format, "str"), } @@ -1993,36 +2174,32 @@ def build_data_get_part_request( # pylint: disable=too-many-locals # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") - if dst_crs is not None: - _params["dst-crs"] = _SERIALIZER.query("dst_crs", dst_crs, "str") - if coordinate_reference_system is not None: - _params["coord-crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if max_size is not None: - _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") - if height is not None: - _params["height"] = _SERIALIZER.query("height", height, "int") - if width is not None: - _params["width"] = _SERIALIZER.query("width", width, "int") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -2031,6 +2208,22 @@ def build_data_get_part_request( # pylint: disable=too-many-locals _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers if accept is not None: @@ -2039,86 +2232,95 @@ def build_data_get_part_request( # pylint: disable=too-many-locals return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_part_with_dimensions_request( # pylint: disable=name-too-long,too-many-locals +def build_data_get_tile_no_tms_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, - minx: float, - miny: float, - maxx: float, - maxy: float, - width: int, - height: int, - format: str, + z: float, + x: float, + y: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/crop/{minx},{miny},{maxx},{maxy}/{width}x{height}.{format}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles/{z}/{x}/{y}" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), - "minx": _SERIALIZER.url("minx", minx, "float"), - "miny": _SERIALIZER.url("miny", miny, "float"), - "maxx": _SERIALIZER.url("maxx", maxx, "float"), - "maxy": _SERIALIZER.url("maxy", maxy, "float"), - "width": _SERIALIZER.url("width", width, "int"), - "height": _SERIALIZER.url("height", height, "int"), - "format": _SERIALIZER.url("format", format, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") - if dst_crs is not None: - _params["dst-crs"] = _SERIALIZER.query("dst_crs", dst_crs, "str") - if coordinate_reference_system is not None: - _params["coord-crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if max_size is not None: - _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -2127,6 +2329,22 @@ def build_data_get_part_with_dimensions_request( # pylint: disable=name-too-lon _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers if accept is not None: @@ -2135,136 +2353,214 @@ def build_data_get_part_with_dimensions_request( # pylint: disable=name-too-lon return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_point_request( +def build_data_get_tile_no_tms_by_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, - longitude: float, - latitude: float, + z: float, + x: float, + y: float, + format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/point/{longitude},{latitude}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles/{z}/{x}/{y}.{format}" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), - "longitude": _SERIALIZER.url("longitude", longitude, "float"), - "latitude": _SERIALIZER.url("latitude", latitude, "float"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "format": _SERIALIZER.url("format", format, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") - if coordinate_reference_system is not None: - _params["coord-crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_preview_request( # pylint: disable=too-many-locals +def build_data_get_tile_no_tms_by_scale_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, + z: float, + x: float, + y: float, + scale: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/preview" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles/{z}/{x}/{y}@{scale}x" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") if format is not None: _params["format"] = _SERIALIZER.query("format", format, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") - if dst_crs is not None: - _params["dst-crs"] = _SERIALIZER.query("dst_crs", dst_crs, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if max_size is not None: - _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") - if height is not None: - _params["height"] = _SERIALIZER.query("height", height, "int") - if width is not None: - _params["width"] = _SERIALIZER.query("width", width, "int") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -2273,6 +2569,22 @@ def build_data_get_preview_request( # pylint: disable=too-many-locals _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers if accept is not None: @@ -2281,42 +2593,58 @@ def build_data_get_preview_request( # pylint: disable=too-many-locals return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_preview_with_format_request( # pylint: disable=name-too-long,too-many-locals +def build_data_get_tile_no_tms_by_scale_and_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, + z: float, + x: float, + y: float, + scale: float, format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/preview.{format}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tiles/{z}/{x}/{y}@{scale}x.{format}" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), "format": _SERIALIZER.url("format", format, "str"), } @@ -2324,34 +2652,34 @@ def build_data_get_preview_with_format_request( # pylint: disable=name-too-long # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") - if dst_crs is not None: - _params["dst-crs"] = _SERIALIZER.query("dst_crs", dst_crs, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if max_size is not None: - _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") - if height is not None: - _params["height"] = _SERIALIZER.query("height", height, "int") - if width is not None: - _params["width"] = _SERIALIZER.query("width", width, "int") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -2360,6 +2688,22 @@ def build_data_get_preview_with_format_request( # pylint: disable=name-too-long _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers if accept is not None: @@ -2368,85 +2712,50 @@ def build_data_get_preview_with_format_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_create_static_image_request(collection_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/data/collections/{collectionId}/image/static" - path_format_arguments = { - "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_data_get_static_image_request(collection_id: str, id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "image/png") - - # Construct URL - _url = "/data/collections/{collectionId}/image/static/{id}" - path_format_arguments = { - "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), - "id": _SERIALIZER.url("id", id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_data_list_statistics_request( +def build_data_crop_feature_geo_json_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/statistics" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/feature" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), @@ -2456,113 +2765,160 @@ def build_data_list_statistics_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") if max_size is not None: _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") - if categorical is not None: - _params["categorical"] = _SERIALIZER.query("categorical", categorical, "bool") - if categories_pixels is not None: - _params["c"] = _SERIALIZER.query("categories_pixels", categories_pixels, "[str]", div=",") - if percentiles is not None: - _params["p"] = _SERIALIZER.query("percentiles", percentiles, "[int]", div=",") - if histogram_bins is not None: - _params["histogram_bins"] = _SERIALIZER.query("histogram_bins", histogram_bins, "str") - if histogram_range is not None: - _params["histogram_range"] = _SERIALIZER.query("histogram_range", histogram_range, "str") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_tile_json_request( # pylint: disable=too-many-locals +def build_data_crop_feature_geo_json_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, - tile_matrix_set_id: str, + format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - buffer: Optional[str] = None, color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/{tileMatrixSetId}/tilejson.json" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/feature.{format}" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), - "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "format": _SERIALIZER.url("format", format, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") - if tile_format is not None: - _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") - if tile_scale is not None: - _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") - if min_zoom is not None: - _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") - if max_zoom is not None: - _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") - if buffer is not None: - _params["buffer"] = _SERIALIZER.query("buffer", buffer, "str") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -2571,58 +2927,81 @@ def build_data_get_tile_json_request( # pylint: disable=too-many-locals _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_tile_request( # pylint: disable=too-many-locals +def build_data_crop_feature_geo_json_width_by_height_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches collection_id: str, item_id: str, - tile_matrix_set_id: str, - z: float, - x: float, - y: float, - scale: float, + width: int, + height: int, format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - buffer: Optional[str] = None, color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, subdataset_name: Optional[str] = None, - subdataset_bands: Optional[List[str]] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", None) # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x.{format}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/feature/{width}x{height}.{format}" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), - "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), - "z": _SERIALIZER.url("z", z, "float"), - "x": _SERIALIZER.url("x", x, "float"), - "y": _SERIALIZER.url("y", y, "float"), - "scale": _SERIALIZER.url("scale", scale, "float"), + "width": _SERIALIZER.url("width", width, "int"), + "height": _SERIALIZER.url("height", height, "int"), "format": _SERIALIZER.url("format", format, "str"), } @@ -2630,28 +3009,34 @@ def build_data_get_tile_request( # pylint: disable=too-many-locals # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") - if buffer is not None: - _params["buffer"] = _SERIALIZER.query("buffer", buffer, "str") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -2660,100 +3045,76 @@ def build_data_get_tile_request( # pylint: disable=too-many-locals _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") if subdataset_name is not None: _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") if subdataset_bands is not None: - _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[str]", div=",") + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") if accept is not None: _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_wmts_capabilities_request( # pylint: disable=too-many-locals +def build_data_get_item_bounds_request( collection_id: str, item_id: str, - tile_matrix_set_id: str, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - buffer: Optional[str] = None, - color_formula: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/xml") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/collections/{collectionId}/items/{itemId}/{tileMatrixSetId}/WMTSCapabilities.xml" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/bounds" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), "itemId": _SERIALIZER.url("item_id", item_id, "str"), - "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if assets is not None: - _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] - if expression is not None: - _params["expression"] = _SERIALIZER.query("expression", expression, "str") - if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") - if asset_as_band is not None: - _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") - if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") - if unscale is not None: - _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") - if algorithm is not None: - _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") - if algorithm_params is not None: - _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") - if tile_format is not None: - _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") - if tile_scale is not None: - _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") - if min_zoom is not None: - _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") - if max_zoom is not None: - _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") - if buffer is not None: - _params["buffer"] = _SERIALIZER.query("buffer", buffer, "str") - if color_formula is not None: - _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") - if resampling is not None: - _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if rescale is not None: - _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] - if color_map_name is not None: - _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") - if color_map is not None: - _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") - if return_mask is not None: - _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2761,29 +3122,53 @@ def build_data_get_wmts_capabilities_request( # pylint: disable=too-many-locals return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_class_map_legend_request( - classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any +def build_data_get_item_info_request( + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + assets: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/legend/classmap/{classmapName}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/info" path_format_arguments = { - "classmapName": _SERIALIZER.url("classmap_name", classmap_name, "str"), + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if trim_start is not None: - _params["trim_start"] = _SERIALIZER.query("trim_start", trim_start, "int") - if trim_end is not None: - _params["trim_end"] = _SERIALIZER.query("trim_end", trim_end, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2791,29 +3176,53 @@ def build_data_get_class_map_legend_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_interval_legend_request( - classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any +def build_data_get_item_info_geo_json_request( # pylint: disable=name-too-long + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + assets: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/legend/interval/{classmapName}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/info.geojson" path_format_arguments = { - "classmapName": _SERIALIZER.url("classmap_name", classmap_name, "str"), + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if trim_start is not None: - _params["trim_start"] = _SERIALIZER.query("trim_start", trim_start, "int") - if trim_end is not None: - _params["trim_end"] = _SERIALIZER.query("trim_end", trim_end, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2821,39 +3230,50 @@ def build_data_get_interval_legend_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_legend_request( - color_map_name: str, +def build_data_list_item_available_assets_request( # pylint: disable=name-too-long + collection_id: str, + item_id: str, *, - height: Optional[float] = None, - width: Optional[float] = None, - trim_start: Optional[int] = None, - trim_end: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "image/png") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/legend/colormap/{colorMapName}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/assets" path_format_arguments = { - "colorMapName": _SERIALIZER.url("color_map_name", color_map_name, "str"), + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if height is not None: - _params["height"] = _SERIALIZER.query("height", height, "float") - if width is not None: - _params["width"] = _SERIALIZER.query("width", width, "float") - if trim_start is not None: - _params["trim_start"] = _SERIALIZER.query("trim_start", trim_start, "int") - if trim_end is not None: - _params["trim_end"] = _SERIALIZER.query("trim_end", trim_end, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2861,49 +3281,98 @@ def build_data_get_legend_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_mosaics_assets_for_point_request( # pylint: disable=name-too-long - search_id: str, - longitude: float, - latitude: float, +def build_data_get_item_asset_statistics_request( # pylint: disable=name-too-long,too-many-locals,too-many-branches,too-many-statements + collection_id: str, + item_id: str, *, - scan_limit: Optional[int] = None, - items_limit: Optional[int] = None, - time_limit: Optional[int] = None, - exit_when_full: Optional[bool] = None, - skip_covered: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + asset_band_indices: Optional[List[str]] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + asset_expression: Optional[List[str]] = None, + height: Optional[int] = None, + width: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/mosaic/{searchId}/{longitude},{latitude}/assets" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/asset_statistics" path_format_arguments = { - "searchId": _SERIALIZER.url("search_id", search_id, "str"), - "longitude": _SERIALIZER.url("longitude", longitude, "float"), - "latitude": _SERIALIZER.url("latitude", latitude, "float"), + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if scan_limit is not None: - _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") - if items_limit is not None: - _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") - if time_limit is not None: - _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") - if exit_when_full is not None: - _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") - if skip_covered is not None: - _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") - if coordinate_reference_system is not None: - _params["coord-crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if categorical is not None: + _params["categorical"] = _SERIALIZER.query("categorical", categorical, "bool") + if categories_pixels is not None: + _params["c"] = _SERIALIZER.query("categories_pixels", categories_pixels, "[int]", div=",") + if percentiles is not None: + _params["p"] = _SERIALIZER.query("percentiles", percentiles, "[int]", div=",") + if histogram_bins is not None: + _params["histogram_bins"] = _SERIALIZER.query("histogram_bins", histogram_bins, "str") + if histogram_range is not None: + _params["histogram_range"] = _SERIALIZER.query("histogram_range", histogram_range, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if asset_expression is not None: + _params["asset_expression"] = _SERIALIZER.query("asset_expression", asset_expression, "[str]", div=",") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2911,52 +3380,107 @@ def build_data_get_mosaics_assets_for_point_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_mosaics_assets_for_tile_request( # pylint: disable=name-too-long - search_id: str, - tile_matrix_set_id: str, - z: float, - x: float, - y: float, - *, +def build_data_list_item_statistics_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches collection_id: str, - scan_limit: Optional[int] = None, - items_limit: Optional[int] = None, - time_limit: Optional[int] = None, - exit_when_full: Optional[bool] = None, - skip_covered: Optional[bool] = None, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/mosaic/{searchId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}/assets" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/statistics" path_format_arguments = { - "searchId": _SERIALIZER.url("search_id", search_id, "str"), - "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), - "z": _SERIALIZER.url("z", z, "float"), - "x": _SERIALIZER.url("x", x, "float"), - "y": _SERIALIZER.url("y", y, "float"), + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if scan_limit is not None: - _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") - if items_limit is not None: - _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") - if time_limit is not None: - _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") - if exit_when_full is not None: - _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") - if skip_covered is not None: - _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") - _params["collection"] = _SERIALIZER.query("collection_id", collection_id, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if categorical is not None: + _params["categorical"] = _SERIALIZER.query("categorical", categorical, "bool") + if categories_pixels is not None: + _params["c"] = _SERIALIZER.query("categories_pixels", categories_pixels, "[int]", div=",") + if percentiles is not None: + _params["p"] = _SERIALIZER.query("percentiles", percentiles, "[int]", div=",") + if histogram_bins is not None: + _params["histogram_bins"] = _SERIALIZER.query("histogram_bins", histogram_bins, "str") + if histogram_range is not None: + _params["histogram_range"] = _SERIALIZER.query("histogram_range", histogram_range, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2964,45 +3488,114 @@ def build_data_get_mosaics_assets_for_tile_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_mosaics_search_info_request( # pylint: disable=name-too-long - search_id: str, **kwargs: Any +def build_data_get_item_geo_json_statistics_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/mosaic/{searchId}/info" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/statistics" path_format_arguments = { - "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_data_register_mosaics_search_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/data/mosaic/register" - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if categorical is not None: + _params["categorical"] = _SERIALIZER.query("categorical", categorical, "bool") + if categories_pixels is not None: + _params["c"] = _SERIALIZER.query("categories_pixels", categories_pixels, "[int]", div=",") + if percentiles is not None: + _params["p"] = _SERIALIZER.query("percentiles", percentiles, "[int]", div=",") + if histogram_bins is not None: + _params["histogram_bins"] = _SERIALIZER.query("histogram_bins", histogram_bins, "str") + if histogram_range is not None: + _params["histogram_range"] = _SERIALIZER.query("histogram_range", histogram_range, "str") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") # Construct headers if content_type is not None: @@ -3012,99 +3605,95 @@ def build_data_register_mosaics_search_request(**kwargs: Any) -> HttpRequest: # return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_mosaics_tile_json_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches - search_id: str, - tile_matrix_set_id: str, +def build_data_get_item_tile_json_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches + collection_id: str, + item_id: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, - scan_limit: Optional[int] = None, - items_limit: Optional[int] = None, - time_limit: Optional[int] = None, - exit_when_full: Optional[bool] = None, - skip_covered: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, tile_scale: Optional[int] = None, - buffer: Optional[str] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/mosaic/{searchId}/{tileMatrixSetId}/tilejson.json" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/tilejson.json" path_format_arguments = { - "searchId": _SERIALIZER.url("search_id", search_id, "str"), - "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") - if scan_limit is not None: - _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") - if items_limit is not None: - _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") - if time_limit is not None: - _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") - if exit_when_full is not None: - _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") - if skip_covered is not None: - _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") - if min_zoom is not None: - _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") - if max_zoom is not None: - _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") if tile_format is not None: _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") if tile_scale is not None: _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") if buffer is not None: - _params["buffer"] = _SERIALIZER.query("buffer", buffer, "str") + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") - if collection is not None: - _params["collection"] = _SERIALIZER.query("collection", collection, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if pixel_selection is not None: - _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -3113,6 +3702,22 @@ def build_data_get_mosaics_tile_json_request( # pylint: disable=too-many-locals _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -3120,97 +3725,94 @@ def build_data_get_mosaics_tile_json_request( # pylint: disable=too-many-locals return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_mosaics_tile_request( # pylint: disable=too-many-locals,too-many-branches,too-many-statements - search_id: str, +def build_data_get_item_tile_json_tms_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + item_id: str, tile_matrix_set_id: str, - z: float, - x: float, - y: float, - scale: float, - format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, - scan_limit: Optional[int] = None, - items_limit: Optional[int] = None, - time_limit: Optional[int] = None, - exit_when_full: Optional[bool] = None, - skip_covered: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - buffer: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/data/mosaic/{searchId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x.{format}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/{tileMatrixSetId}/tilejson.json" path_format_arguments = { - "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), - "z": _SERIALIZER.url("z", z, "float"), - "x": _SERIALIZER.url("x", x, "float"), - "y": _SERIALIZER.url("y", y, "float"), - "scale": _SERIALIZER.url("scale", scale, "float"), - "format": _SERIALIZER.url("format", format, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") - if scan_limit is not None: - _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") - if items_limit is not None: - _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") - if time_limit is not None: - _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") - if exit_when_full is not None: - _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") - if skip_covered is not None: - _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") if buffer is not None: - _params["buffer"] = _SERIALIZER.query("buffer", buffer, "str") + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") - if collection is not None: - _params["collection"] = _SERIALIZER.query("collection", collection, "str") if resampling is not None: _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") - if pixel_selection is not None: - _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") if rescale is not None: _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] if color_map_name is not None: @@ -3219,72 +3821,104 @@ def build_data_get_mosaics_tile_request( # pylint: disable=too-many-locals,too- _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers - if accept is not None: - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_data_get_mosaics_wmts_capabilities_request( # pylint: disable=name-too-long,too-many-locals - search_id: str, - tile_matrix_set_id: str, +def build_data_get_item_wmts_capabilities_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + item_id: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, tile_scale: Optional[int] = None, min_zoom: Optional[int] = None, max_zoom: Optional[int] = None, - buffer: Optional[str] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/data/mosaic/{searchId}/{tileMatrixSetId}/WMTSCapabilities.xml" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/WMTSCapabilities.xml" path_format_arguments = { - "searchId": _SERIALIZER.url("search_id", search_id, "str"), - "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] if assets is not None: _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] if expression is not None: _params["expression"] = _SERIALIZER.query("expression", expression, "str") if asset_band_indices is not None: - _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "str") + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") if asset_as_band is not None: _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") if no_data is not None: - _params["nodata"] = _SERIALIZER.query("no_data", no_data, "float") + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") if unscale is not None: _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") if algorithm is not None: _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") if algorithm_params is not None: _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") if tile_format is not None: _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") if tile_scale is not None: @@ -3294,7 +3928,7 @@ def build_data_get_mosaics_wmts_capabilities_request( # pylint: disable=name-to if max_zoom is not None: _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") if buffer is not None: - _params["buffer"] = _SERIALIZER.query("buffer", buffer, "str") + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") if color_formula is not None: _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") if resampling is not None: @@ -3307,30 +3941,141 @@ def build_data_get_mosaics_wmts_capabilities_request( # pylint: disable=name-to _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") if return_mask is not None: _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") - + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_shared_access_signature_get_sign_request( # pylint: disable=name-too-long - *, href: str, duration_in_minutes: Optional[int] = None, **kwargs: Any +def build_data_get_item_wmts_capabilities_tms_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) - accept = _headers.pop("Accept", "application/json") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/sas/sign" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/{tileMatrixSetId}/WMTSCapabilities.xml" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["href"] = _SERIALIZER.query("href", href, "str") - if duration_in_minutes is not None: - _params["duration"] = _SERIALIZER.query("duration_in_minutes", duration_in_minutes, "int") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -3338,27 +4083,84 @@ def build_shared_access_signature_get_sign_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_shared_access_signature_get_token_request( # pylint: disable=name-too-long - collection_id: str, *, duration_in_minutes: Optional[int] = None, **kwargs: Any +def build_data_get_item_point_request( # pylint: disable=too-many-locals + collection_id: str, + item_id: str, + longitude: float, + latitude: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/sas/token/{collectionId}" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/point/{longitude},{latitude}" path_format_arguments = { "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "longitude": _SERIALIZER.url("longitude", longitude, "float"), + "latitude": _SERIALIZER.url("latitude", latitude, "float"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if duration_in_minutes is not None: - _params["duration"] = _SERIALIZER.query("duration_in_minutes", duration_in_minutes, "int") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -3366,790 +4168,16298 @@ def build_shared_access_signature_get_token_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_shared_access_signature_revoke_token_request( # pylint: disable=name-too-long - *, duration_in_minutes: Optional[int] = None, **kwargs: Any +def build_data_get_item_preview_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + color_formula: Optional[str] = None, + dst_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-30-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + # Construct URL - _url = "/sas/token/revoke" + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/preview" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if duration_in_minutes is not None: - _params["duration"] = _SERIALIZER.query("duration_in_minutes", duration_in_minutes, "int") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if dst_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("dst_crs", dst_crs, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class IngestionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - Instead, you should access the following operations through - :class:`~azure.planetarycomputer.PlanetaryComputerProClient`'s - :attr:`ingestion` attribute. - """ +def build_data_get_item_preview_with_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + item_id: str, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + dst_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PlanetaryComputerProClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - @distributed_trace - def cancel_operation( # pylint: disable=inconsistent-return-statements - self, operation_id: str, **kwargs: Any - ) -> None: - """Cancel a running operation of a geo-catalog collection. - - :param operation_id: Operation id. Required. - :type operation_id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/preview.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "format": _SERIALIZER.url("format", format, "str"), + } - _request = build_ingestion_cancel_operation_request( - operation_id=operation_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if dst_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("dst_crs", dst_crs, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") - response = pipeline_response.http_response + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def cancel_all_operations(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Cancel all running operations of a geo-catalog collection. +def build_data_get_item_bbox_crop_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches + collection_id: str, + item_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/bbox/{minx},{miny},{maxx},{maxy}.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "minx": _SERIALIZER.url("minx", minx, "float"), + "miny": _SERIALIZER.url("miny", miny, "float"), + "maxx": _SERIALIZER.url("maxx", maxx, "float"), + "maxy": _SERIALIZER.url("maxy", maxy, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } - cls: ClsType[None] = kwargs.pop("cls", None) + _url: str = _url.format(**path_format_arguments) # type: ignore - _request = build_ingestion_cancel_all_operations_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - response = pipeline_response.http_response + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, None, {}) # type: ignore +def build_data_get_item_bbox_crop_with_dimensions_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + item_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + width: int, + height: int, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @distributed_trace - def get_operation(self, operation_id: str, **kwargs: Any) -> _models.Operation: - """Get an operation of a geo-catalog collection. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - :param operation_id: Operation id. Required. - :type operation_id: str - :return: Operation. The Operation is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.Operation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Operation] = kwargs.pop("cls", None) - - _request = build_ingestion_get_operation_request( - operation_id=operation_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/items/{itemId}/bbox/{minx},{miny},{maxx},{maxy}/{width}x{height}.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "itemId": _SERIALIZER.url("item_id", item_id, "str"), + "minx": _SERIALIZER.url("minx", minx, "float"), + "miny": _SERIALIZER.url("miny", miny, "float"), + "maxx": _SERIALIZER.url("maxx", maxx, "float"), + "maxy": _SERIALIZER.url("maxy", maxy, "float"), + "width": _SERIALIZER.url("width", width, "int"), + "height": _SERIALIZER.url("height", height, "int"), + "format": _SERIALIZER.url("format", format, "str"), + } - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + _url: str = _url.format(**path_format_arguments) # type: ignore - response = pipeline_response.http_response + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Operation, response.json()) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized # type: ignore +def build_data_list_collection_tilesets_request( # pylint: disable=name-too-long + collection_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @distributed_trace - def list_operations( - self, - *, - top: Optional[int] = None, - skip: Optional[int] = None, - collection_id: Optional[str] = None, - status: Optional[Union[str, _models.OperationStatus]] = None, - **kwargs: Any - ) -> ItemPaged["_models.Operation"]: - """Get operations of a geo-catalog collection. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") - :keyword top: The number of items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of items to skip. Default value is None. - :paramtype skip: int - :keyword collection_id: Operation id used to filter the results. Default value is None. - :paramtype collection_id: str - :keyword status: Operation status used to filter the results. Known values are: "Pending", - "Running", "Succeeded", "Canceled", "Canceling", and "Failed". Default value is None. - :paramtype status: str or ~azure.planetarycomputer.models.OperationStatus - :return: An iterator like instance of Operation - :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + } - cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + _url: str = _url.format(**path_format_arguments) # type: ignore - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") - def prepare_request(next_link=None): - if not next_link: + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - _request = build_ingestion_list_operations_request( - top=top, - skip=skip, - collection_id=collection_id, - status=status, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request +def build_data_get_collection_tileset_metadata_request( # pylint: disable=name-too-long + collection_id: str, + tile_matrix_set_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") - def get_next(next_link=None): - _request = prepare_request(next_link) + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{tileMatrixSetId}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + } - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _url: str = _url.format(**path_format_arguments) # type: ignore - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") - return pipeline_response + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return ItemPaged(get_next, extract_data) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - @distributed_trace - def create_run(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> _models.IngestionRun: - """Create a new run of an ingestion. - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param ingestion_id: Ingestion id. Required. - :type ingestion_id: str - :return: IngestionRun. The IngestionRun is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} +def build_data_get_collection_tile_by_scale_and_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - cls: ClsType[_models.IngestionRun] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - _request = build_ingestion_create_run_request( - collection_id=collection_id, - ingestion_id=ingestion_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + _url: str = _url.format(**path_format_arguments) # type: ignore - response = pipeline_response.http_response + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") - if response.status_code not in [201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.IngestionRun, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore +def build_data_get_collection_tile_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return deserialized # type: ignore + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - @distributed_trace - def get_run(self, collection_id: str, ingestion_id: str, run_id: str, **kwargs: Any) -> _models.IngestionRun: - """Get a run of an ingestion. + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + } - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param ingestion_id: Ingestion id. Required. - :type ingestion_id: str - :param run_id: Run id. Required. - :type run_id: str - :return: IngestionRun. The IngestionRun is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + _url: str = _url.format(**path_format_arguments) # type: ignore - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") - cls: ClsType[_models.IngestionRun] = kwargs.pop("cls", None) - - _request = build_ingestion_get_run_request( - collection_id=collection_id, - ingestion_id=ingestion_id, - run_id=run_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.IngestionRun, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore +def build_data_get_collection_tile_by_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return deserialized # type: ignore + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - @distributed_trace - def list_runs( - self, - collection_id: str, - ingestion_id: str, - *, - top: Optional[int] = None, - skip: Optional[int] = None, - **kwargs: Any - ) -> ItemPaged["_models.IngestionRun"]: - """Get the runs of an ingestion. + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param ingestion_id: Ingestion id. Required. - :type ingestion_id: str - :keyword top: The number of items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of IngestionRun - :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.IngestionRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _url: str = _url.format(**path_format_arguments) # type: ignore - cls: ClsType[List[_models.IngestionRun]] = kwargs.pop("cls", None) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - def prepare_request(next_link=None): - if not next_link: + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - _request = build_ingestion_list_runs_request( - collection_id=collection_id, - ingestion_id=ingestion_id, - top=top, - skip=skip, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) +def build_data_get_collection_tile_by_scale_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return _request + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.IngestionRun], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), + } - def get_next(next_link=None): - _request = prepare_request(next_link) + _url: str = _url.format(**path_format_arguments) # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") - @overload - def create( - self, - collection_id: str, - body: _models.IngestionDefinition, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.IngestionDefinition: - """Create a new ingestion. + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: Definition of the ingestion. Required. - :type body: ~azure.planetarycomputer.models.IngestionDefinition - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - @overload - def create( - self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionDefinition: - """Create a new ingestion. - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: Definition of the ingestion. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ +def build_data_get_collection_tile_no_tms_by_scale_and_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - def create( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionDefinition: - """Create a new ingestion. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: Definition of the ingestion. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{z}/{x}/{y}@{scale}x.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } - @distributed_trace - def create( - self, collection_id: str, body: Union[_models.IngestionDefinition, JSON, IO[bytes]], **kwargs: Any - ) -> _models.IngestionDefinition: - """Create a new ingestion. + _url: str = _url.format(**path_format_arguments) # type: ignore - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: Definition of the ingestion. Is one of the following types: IngestionDefinition, - JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.IngestionDefinition or JSON or IO[bytes] - :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.IngestionDefinition] = kwargs.pop("cls", None) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_ingestion_create_request( - collection_id=collection_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) +def build_data_get_collection_tile_no_tms_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.IngestionDefinition, response.json()) + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{z}/{x}/{y}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + } - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore - return deserialized # type: ignore + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") - def _delete_initial(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_ingestion_delete_request( - collection_id=collection_id, - ingestion_id=ingestion_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) +def build_data_get_collection_tile_no_tms_by_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) - response = pipeline_response.http_response + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{z}/{x}/{y}.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + _url: str = _url.format(**path_format_arguments) # type: ignore - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") - deserialized = response.iter_bytes() + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return deserialized # type: ignore - @distributed_trace - def begin_delete(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> LROPoller[None]: - """Delete an ingestion from a catalog. All runs of the ingestion will be deleted. Ingestion must - not have any runs in progress or queued. +def build_data_get_collection_tile_no_tms_by_scale_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{z}/{x}/{y}@{scale}x" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_tile_json_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tilejson.json" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_tile_json_tms_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + tile_matrix_set_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/{tileMatrixSetId}/tilejson.json" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_wmts_capabilities_request( # pylint: disable=name-too-long,too-many-locals + collection_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/WMTSCapabilities.xml" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_wmts_capabilities_tms_request( # pylint: disable=name-too-long,too-many-locals + collection_id: str, + tile_matrix_set_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/{tileMatrixSetId}/WMTSCapabilities.xml" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_assets_for_tile_request( # pylint: disable=name-too-long,too-many-locals + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}/assets" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_assets_for_tile_no_tms_request( # pylint: disable=name-too-long,too-many-locals + collection_id: str, + z: float, + x: float, + y: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/tiles/{z}/{x}/{y}/assets" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_assets_for_bbox_request( # pylint: disable=name-too-long,too-many-locals + collection_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/bbox/{minx},{miny},{maxx},{maxy}/assets" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "minx": _SERIALIZER.url("minx", minx, "float"), + "miny": _SERIALIZER.url("miny", miny, "float"), + "maxx": _SERIALIZER.url("maxx", maxx, "float"), + "maxy": _SERIALIZER.url("maxy", maxy, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_info_request(collection_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/info" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_bbox_crop_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/bbox/{minx},{miny},{maxx},{maxy}.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "minx": _SERIALIZER.url("minx", minx, "float"), + "miny": _SERIALIZER.url("miny", miny, "float"), + "maxx": _SERIALIZER.url("maxx", maxx, "float"), + "maxy": _SERIALIZER.url("maxy", maxy, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_bbox_crop_with_dimensions_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + width: int, + height: int, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/bbox/{minx},{miny},{maxx},{maxy}/{width}x{height}.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "minx": _SERIALIZER.url("minx", minx, "float"), + "miny": _SERIALIZER.url("miny", miny, "float"), + "maxx": _SERIALIZER.url("maxx", maxx, "float"), + "maxy": _SERIALIZER.url("maxy", maxy, "float"), + "width": _SERIALIZER.url("width", width, "int"), + "height": _SERIALIZER.url("height", height, "int"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_crop_collection_feature_geo_json_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/feature" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_crop_collection_feature_geo_json_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/feature.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_crop_collection_feature_geo_json_width_by_height_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + collection_id: str, + width: int, + height: int, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/feature/{width}x{height}.{format}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "width": _SERIALIZER.url("width", width, "int"), + "height": _SERIALIZER.url("height", height, "int"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_point_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches + collection_id: str, + longitude: float, + latitude: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/point/{longitude},{latitude}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "longitude": _SERIALIZER.url("longitude", longitude, "float"), + "latitude": _SERIALIZER.url("latitude", latitude, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_collection_point_assets_request( # pylint: disable=name-too-long,too-many-locals + collection_id: str, + longitude: float, + latitude: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/collections/{collectionId}/point/{longitude},{latitude}/assets" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + "longitude": _SERIALIZER.url("longitude", longitude, "float"), + "latitude": _SERIALIZER.url("latitude", latitude, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if ids is not None: + _params["ids"] = _SERIALIZER.query("ids", ids, "str") + if bbox is not None: + _params["bbox"] = _SERIALIZER.query("bbox", bbox, "str") + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if sortby is not None: + _params["sortby"] = _SERIALIZER.query("sortby", sortby, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_list_searches_tilesets_request( # pylint: disable=name-too-long + search_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tileset_metadata_request( # pylint: disable=name-too-long + search_id: str, + tile_matrix_set_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{tileMatrixSetId}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_by_scale_and_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x.{format}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_by_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}.{format}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_by_scale_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_assets_for_tile_request( # pylint: disable=name-too-long + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + collection_id: str, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{tileMatrixSetId}/{z}/{x}/{y}/assets" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + _params["collection"] = _SERIALIZER.query("collection_id", collection_id, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_json_tms_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + tile_matrix_set_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/{tileMatrixSetId}/tilejson.json" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_wmts_capabilities_tms_request( # pylint: disable=name-too-long + search_id: str, + tile_matrix_set_id: str, + *, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/{tileMatrixSetId}/WMTSCapabilities.xml" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "tileMatrixSetId": _SERIALIZER.url("tile_matrix_set_id", tile_matrix_set_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_info_request(search_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/info" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_bbox_crop_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/bbox/{minx},{miny},{maxx},{maxy}.{format}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "minx": _SERIALIZER.url("minx", minx, "float"), + "miny": _SERIALIZER.url("miny", miny, "float"), + "maxx": _SERIALIZER.url("maxx", maxx, "float"), + "maxy": _SERIALIZER.url("maxy", maxy, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_bbox_crop_with_dimensions_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + width: int, + height: int, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/bbox/{minx},{miny},{maxx},{maxy}/{width}x{height}.{format}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "minx": _SERIALIZER.url("minx", minx, "float"), + "miny": _SERIALIZER.url("miny", miny, "float"), + "maxx": _SERIALIZER.url("maxx", maxx, "float"), + "maxy": _SERIALIZER.url("maxy", maxy, "float"), + "width": _SERIALIZER.url("width", width, "int"), + "height": _SERIALIZER.url("height", height, "int"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_bbox_assets_request( # pylint: disable=name-too-long + search_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/bbox/{minx},{miny},{maxx},{maxy}/assets" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "minx": _SERIALIZER.url("minx", minx, "float"), + "miny": _SERIALIZER.url("miny", miny, "float"), + "maxx": _SERIALIZER.url("maxx", maxx, "float"), + "maxy": _SERIALIZER.url("maxy", maxy, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_crop_searches_feature_geo_json_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/feature" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_crop_searches_feature_geo_json_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/feature.{format}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if height is not None: + _params["height"] = _SERIALIZER.query("height", height, "int") + if width is not None: + _params["width"] = _SERIALIZER.query("width", width, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_crop_searches_feature_geo_json_width_by_height_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + width: int, + height: int, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/feature/{width}x{height}.{format}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "width": _SERIALIZER.url("width", width, "int"), + "height": _SERIALIZER.url("height", height, "int"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if max_size is not None: + _params["max_size"] = _SERIALIZER.query("max_size", max_size, "int") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if destination_crs is not None: + _params["dst_crs"] = _SERIALIZER.query("destination_crs", destination_crs, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_wmts_capabilities_request( # pylint: disable=name-too-long + search_id: str, + *, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/WMTSCapabilities.xml" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_json_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + padding: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection_id: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + rescale: Optional[List[str]] = None, + colormap_name: Optional[Union[str, _models.ColorMapNames]] = None, + colormap: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tilejson.json" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if tile_format is not None: + _params["tile_format"] = _SERIALIZER.query("tile_format", tile_format, "str") + if tile_scale is not None: + _params["tile_scale"] = _SERIALIZER.query("tile_scale", tile_scale, "int") + if min_zoom is not None: + _params["minzoom"] = _SERIALIZER.query("min_zoom", min_zoom, "int") + if max_zoom is not None: + _params["maxzoom"] = _SERIALIZER.query("max_zoom", max_zoom, "int") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection_id is not None: + _params["collection"] = _SERIALIZER.query("collection_id", collection_id, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if colormap_name is not None: + _params["colormap_name"] = _SERIALIZER.query("colormap_name", colormap_name, "str") + if colormap is not None: + _params["colormap"] = _SERIALIZER.query("colormap", colormap, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_no_tms_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{z}/{x}/{y}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_no_tms_by_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{z}/{x}/{y}.{format}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if scale is not None: + _params["scale"] = _SERIALIZER.query("scale", scale, "int") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_no_tms_by_scale_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{z}/{x}/{y}@{scale}x" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if format is not None: + _params["format"] = _SERIALIZER.query("format", format, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_tile_no_tms_by_scale_and_format_request( # pylint: disable=name-too-long,too-many-locals,too-many-statements,too-many-branches + search_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", None) + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{z}/{x}/{y}@{scale}x.{format}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + "scale": _SERIALIZER.url("scale", scale, "float"), + "format": _SERIALIZER.url("format", format, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if algorithm is not None: + _params["algorithm"] = _SERIALIZER.query("algorithm", algorithm, "str") + if algorithm_params is not None: + _params["algorithm_params"] = _SERIALIZER.query("algorithm_params", algorithm_params, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + if buffer is not None: + _params["buffer"] = _SERIALIZER.query("buffer", buffer, "float") + if color_formula is not None: + _params["color_formula"] = _SERIALIZER.query("color_formula", color_formula, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + if pixel_selection is not None: + _params["pixel_selection"] = _SERIALIZER.query("pixel_selection", pixel_selection, "str") + if rescale is not None: + _params["rescale"] = [_SERIALIZER.query("rescale", q, "str") if q is not None else "" for q in rescale] + if color_map_name is not None: + _params["colormap_name"] = _SERIALIZER.query("color_map_name", color_map_name, "str") + if color_map is not None: + _params["colormap"] = _SERIALIZER.query("color_map", color_map, "str") + if return_mask is not None: + _params["return_mask"] = _SERIALIZER.query("return_mask", return_mask, "bool") + if padding is not None: + _params["padding"] = _SERIALIZER.query("padding", padding, "int") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_assets_for_tile_no_tms_request( # pylint: disable=name-too-long + search_id: str, + z: float, + x: float, + y: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/tiles/{z}/{x}/{y}/assets" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "z": _SERIALIZER.url("z", z, "float"), + "x": _SERIALIZER.url("x", x, "float"), + "y": _SERIALIZER.url("y", y, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if tile_matrix_set_id is not None: + _params["TileMatrixSetId"] = _SERIALIZER.query("tile_matrix_set_id", tile_matrix_set_id, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +# TODO: Remove pylint disable once pygen emitter generates fewer statements in request builders +def build_data_get_searches_point_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches + search_id: str, + longitude: float, + latitude: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/point/{longitude},{latitude}" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "longitude": _SERIALIZER.url("longitude", longitude, "float"), + "latitude": _SERIALIZER.url("latitude", latitude, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if bidx is not None: + _params["bidx"] = [_SERIALIZER.query("bidx", q, "int") if q is not None else "" for q in bidx] + if assets is not None: + _params["assets"] = [_SERIALIZER.query("assets", q, "str") if q is not None else "" for q in assets] + if expression is not None: + _params["expression"] = _SERIALIZER.query("expression", expression, "str") + if asset_band_indices is not None: + _params["asset_bidx"] = _SERIALIZER.query("asset_band_indices", asset_band_indices, "[str]", div=",") + if asset_as_band is not None: + _params["asset_as_band"] = _SERIALIZER.query("asset_as_band", asset_as_band, "bool") + if no_data is not None: + _params["nodata"] = _SERIALIZER.query("no_data", no_data, "str") + if unscale is not None: + _params["unscale"] = _SERIALIZER.query("unscale", unscale, "bool") + if reproject is not None: + _params["reproject"] = _SERIALIZER.query("reproject", reproject, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + if resampling is not None: + _params["resampling"] = _SERIALIZER.query("resampling", resampling, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_get_searches_point_with_assets_request( # pylint: disable=name-too-long + search_id: str, + longitude: float, + latitude: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/data/mosaic/searches/{searchId}/point/{longitude},{latitude}/assets" + path_format_arguments = { + "searchId": _SERIALIZER.url("search_id", search_id, "str"), + "longitude": _SERIALIZER.url("longitude", longitude, "float"), + "latitude": _SERIALIZER.url("latitude", latitude, "float"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scan_limit is not None: + _params["scan_limit"] = _SERIALIZER.query("scan_limit", scan_limit, "int") + if items_limit is not None: + _params["items_limit"] = _SERIALIZER.query("items_limit", items_limit, "int") + if time_limit is not None: + _params["time_limit"] = _SERIALIZER.query("time_limit", time_limit, "int") + if exit_when_full is not None: + _params["exitwhenfull"] = _SERIALIZER.query("exit_when_full", exit_when_full, "bool") + if skip_covered is not None: + _params["skipcovered"] = _SERIALIZER.query("skip_covered", skip_covered, "bool") + if subdataset_name is not None: + _params["subdataset_name"] = _SERIALIZER.query("subdataset_name", subdataset_name, "str") + if subdataset_bands is not None: + _params["subdataset_bands"] = _SERIALIZER.query("subdataset_bands", subdataset_bands, "[int]", div=",") + if crs is not None: + _params["crs"] = _SERIALIZER.query("crs", crs, "str") + if datetime is not None: + _params["datetime"] = _SERIALIZER.query("datetime", datetime, "str") + if sel is not None: + _params["sel"] = [_SERIALIZER.query("sel", q, "str") if q is not None else "" for q in sel] + if sel_method is not None: + _params["sel_method"] = _SERIALIZER.query("sel_method", sel_method, "str") + if collection is not None: + _params["collection"] = _SERIALIZER.query("collection", collection, "str") + if coordinate_reference_system is not None: + _params["coord_crs"] = _SERIALIZER.query("coordinate_reference_system", coordinate_reference_system, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sas_get_sign_request(*, href: str, duration_in_minutes: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/sas/sign" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["href"] = _SERIALIZER.query("href", href, "str") + if duration_in_minutes is not None: + _params["duration"] = _SERIALIZER.query("duration_in_minutes", duration_in_minutes, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sas_get_token_request( + collection_id: str, *, duration_in_minutes: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/sas/token/{collectionId}" + path_format_arguments = { + "collectionId": _SERIALIZER.url("collection_id", collection_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if duration_in_minutes is not None: + _params["duration"] = _SERIALIZER.query("duration_in_minutes", duration_in_minutes, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sas_revoke_token_request(*, duration_in_minutes: Optional[int] = None, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-15")) + # Construct URL + _url = "/sas/token/revoke" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if duration_in_minutes is not None: + _params["duration"] = _SERIALIZER.query("duration_in_minutes", duration_in_minutes, "int") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +class IngestionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.planetarycomputer.PlanetaryComputerProClient`'s + :attr:`ingestion` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlanetaryComputerProClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def cancel_operation( # pylint: disable=inconsistent-return-statements + self, operation_id: str, **kwargs: Any + ) -> None: + """Cancel a running operation of a geo-catalog collection. + + :param operation_id: Operation id. Required. + :type operation_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_ingestion_cancel_operation_request( + operation_id=operation_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def cancel_all_operations(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Cancel all pending and running operations across the entire GeoCatalog instance. This is a + catalog-wide operation and is not scoped to a specific collection. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_ingestion_cancel_all_operations_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_operation(self, operation_id: str, **kwargs: Any) -> _models.Operation: + """Get an operation of a geo-catalog collection. + + :param operation_id: Operation id. Required. + :type operation_id: str + :return: Operation. The Operation is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.Operation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Operation] = kwargs.pop("cls", None) + + _request = build_ingestion_get_operation_request( + operation_id=operation_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Operation, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_operations( + self, + *, + top: Optional[int] = None, + skip: Optional[int] = None, + collection_id: Optional[str] = None, + status: Optional[Union[str, _models.OperationStatus]] = None, + **kwargs: Any + ) -> ItemPaged["_models.Operation"]: + """Get operations of a geo-catalog collection. + + :keyword top: The number of items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword collection_id: Operation id used to filter the results. Default value is None. + :paramtype collection_id: str + :keyword status: Operation status used to filter the results. Known values are: "Pending", + "Running", "Succeeded", "Canceled", "Canceling", and "Failed". Default value is None. + :paramtype status: str or ~azure.planetarycomputer.models.OperationStatus + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ingestion_list_operations_request( + top=top, + skip=skip, + collection_id=collection_id, + status=status, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def create_run(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> _models.IngestionRun: + """Create a new run of an ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param ingestion_id: Ingestion id. Required. + :type ingestion_id: str + :return: IngestionRun. The IngestionRun is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionRun + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.IngestionRun] = kwargs.pop("cls", None) + + _request = build_ingestion_create_run_request( + collection_id=collection_id, + ingestion_id=ingestion_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.IngestionRun, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_run(self, collection_id: str, ingestion_id: str, run_id: str, **kwargs: Any) -> _models.IngestionRun: + """Get a run of an ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param ingestion_id: Ingestion id. Required. + :type ingestion_id: str + :param run_id: Run id. Required. + :type run_id: str + :return: IngestionRun. The IngestionRun is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionRun + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.IngestionRun] = kwargs.pop("cls", None) + + _request = build_ingestion_get_run_request( + collection_id=collection_id, + ingestion_id=ingestion_id, + run_id=run_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.IngestionRun, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_runs( + self, + collection_id: str, + ingestion_id: str, + *, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> ItemPaged["_models.IngestionRun"]: + """Get the runs of an ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param ingestion_id: Ingestion id. Required. + :type ingestion_id: str + :keyword top: The number of items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of IngestionRun + :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.IngestionRun] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.IngestionRun]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ingestion_list_runs_request( + collection_id=collection_id, + ingestion_id=ingestion_id, + top=top, + skip=skip, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.IngestionRun], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def create( + self, + collection_id: str, + body: _models.IngestionDefinition, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.IngestionDefinition: + """Create a new ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: Definition of the ingestion. Required. + :type body: ~azure.planetarycomputer.models.IngestionDefinition + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.IngestionDefinition: + """Create a new ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: Definition of the ingestion. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.IngestionDefinition: + """Create a new ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: Definition of the ingestion. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, collection_id: str, body: Union[_models.IngestionDefinition, JSON, IO[bytes]], **kwargs: Any + ) -> _models.IngestionDefinition: + """Create a new ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: Definition of the ingestion. Is one of the following types: IngestionDefinition, + JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.IngestionDefinition or JSON or IO[bytes] + :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IngestionDefinition] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ingestion_create_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.IngestionDefinition, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _delete_initial(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_ingestion_delete_request( + collection_id=collection_id, + ingestion_id=ingestion_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> LROPoller[None]: + """Delete an ingestion from a catalog. All runs of the ingestion will be deleted. Ingestion must + not have any runs in progress or queued. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param ingestion_id: Ingestion id. Required. + :type ingestion_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + collection_id=collection_id, + ingestion_id=ingestion_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> _models.IngestionDefinition: + """Get the definition of an ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param ingestion_id: Ingestion id. Required. + :type ingestion_id: str + :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.IngestionDefinition] = kwargs.pop("cls", None) + + _request = build_ingestion_get_request( + collection_id=collection_id, + ingestion_id=ingestion_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.IngestionDefinition, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, collection_id: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + ) -> ItemPaged["_models.IngestionDefinition"]: + """Get ingestions of a catalog. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :keyword top: The number of items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of IngestionDefinition + :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.IngestionDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.IngestionDefinition]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ingestion_list_request( + collection_id=collection_id, + top=top, + skip=skip, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.IngestionDefinition], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def update( + self, + collection_id: str, + ingestion_id: str, + body: _models.IngestionDefinition, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.IngestionDefinition: + """Update an existing ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param ingestion_id: Ingestion id. Required. + :type ingestion_id: str + :param body: Ingestion properties to update. Required. + :type body: ~azure.planetarycomputer.models.IngestionDefinition + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + collection_id: str, + ingestion_id: str, + body: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.IngestionDefinition: + """Update an existing ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param ingestion_id: Ingestion id. Required. + :type ingestion_id: str + :param body: Ingestion properties to update. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + collection_id: str, + ingestion_id: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.IngestionDefinition: + """Update an existing ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param ingestion_id: Ingestion id. Required. + :type ingestion_id: str + :param body: Ingestion properties to update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + collection_id: str, + ingestion_id: str, + body: Union[_models.IngestionDefinition, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.IngestionDefinition: + """Update an existing ingestion. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param ingestion_id: Ingestion id. Required. + :type ingestion_id: str + :param body: Ingestion properties to update. Is one of the following types: + IngestionDefinition, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.IngestionDefinition or JSON or IO[bytes] + :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + cls: ClsType[_models.IngestionDefinition] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ingestion_update_request( + collection_id=collection_id, + ingestion_id=ingestion_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.IngestionDefinition, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_source( + self, body: _models.IngestionSource, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.IngestionSource: + """Create a new ingestion source in a geo-catalog. + + :param body: Definition of the ingestion source. Required. + :type body: ~azure.planetarycomputer.models.IngestionSource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: IngestionSource. The IngestionSource is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionSource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_source( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.IngestionSource: + """Create a new ingestion source in a geo-catalog. + + :param body: Definition of the ingestion source. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: IngestionSource. The IngestionSource is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionSource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_source( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.IngestionSource: + """Create a new ingestion source in a geo-catalog. + + :param body: Definition of the ingestion source. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: IngestionSource. The IngestionSource is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionSource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_source( + self, body: Union[_models.IngestionSource, JSON, IO[bytes]], **kwargs: Any + ) -> _models.IngestionSource: + """Create a new ingestion source in a geo-catalog. + + :param body: Definition of the ingestion source. Is one of the following types: + IngestionSource, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.IngestionSource or JSON or IO[bytes] + :return: IngestionSource. The IngestionSource is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionSource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IngestionSource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ingestion_create_source_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.IngestionSource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def replace_source( + self, id: str, body: _models.IngestionSource, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.IngestionSource: + """Update an existing ingestion source in a geo-catalog. + + :param id: Ingestion source id. Required. + :type id: str + :param body: Definition of the ingestion source. Required. + :type body: ~azure.planetarycomputer.models.IngestionSource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: IngestionSource. The IngestionSource is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionSource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_source( + self, id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.IngestionSource: + """Update an existing ingestion source in a geo-catalog. + + :param id: Ingestion source id. Required. + :type id: str + :param body: Definition of the ingestion source. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: IngestionSource. The IngestionSource is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionSource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_source( + self, id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.IngestionSource: + """Update an existing ingestion source in a geo-catalog. + + :param id: Ingestion source id. Required. + :type id: str + :param body: Definition of the ingestion source. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: IngestionSource. The IngestionSource is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionSource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def replace_source( + self, id: str, body: Union[_models.IngestionSource, JSON, IO[bytes]], **kwargs: Any + ) -> _models.IngestionSource: + """Update an existing ingestion source in a geo-catalog. + + :param id: Ingestion source id. Required. + :type id: str + :param body: Definition of the ingestion source. Is one of the following types: + IngestionSource, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.IngestionSource or JSON or IO[bytes] + :return: IngestionSource. The IngestionSource is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionSource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.IngestionSource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_ingestion_replace_source_request( + id=id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.IngestionSource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_source(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete an ingestion source from a geo-catalog. + + :param id: Ingestion source id. Required. + :type id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_ingestion_delete_source_request( + id=id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_source(self, id: str, **kwargs: Any) -> _models.IngestionSource: + """Get an ingestion source in a geo-catalog. + + :param id: Ingestion source id. Required. + :type id: str + :return: IngestionSource. The IngestionSource is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.IngestionSource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.IngestionSource] = kwargs.pop("cls", None) + + _request = build_ingestion_get_source_request( + id=id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.IngestionSource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_sources( + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + ) -> ItemPaged["_models.IngestionSourceSummary"]: + """Get ingestion sources in a geo-catalog. + + :keyword top: The number of items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of IngestionSourceSummary + :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.IngestionSourceSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.IngestionSourceSummary]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ingestion_list_sources_request( + top=top, + skip=skip, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.IngestionSourceSummary], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_managed_identities(self, **kwargs: Any) -> ItemPaged["_models.ManagedIdentityMetadata"]: + """Get all managed identities with access to storage accounts configured for a geo-catalog. + + :return: An iterator like instance of ManagedIdentityMetadata + :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.ManagedIdentityMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedIdentityMetadata]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ingestion_list_managed_identities_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ManagedIdentityMetadata], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class StacOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.planetarycomputer.PlanetaryComputerProClient`'s + :attr:`stac` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlanetaryComputerProClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create_collection_asset( + self, collection_id: str, body: _models.StacAssetData, **kwargs: Any + ) -> _models.StacCollection: + """Create Collection Asset. + + Create a new asset in the Collection metadata and write the associated file to managed storage. + + :param collection_id: STAC Collection ID. Required. + :type collection_id: str + :param body: Multi-part form data. Required. + :type body: ~azure.planetarycomputer.models.StacAssetData + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_collection_asset(self, collection_id: str, body: JSON, **kwargs: Any) -> _models.StacCollection: + """Create Collection Asset. + + Create a new asset in the Collection metadata and write the associated file to managed storage. + + :param collection_id: STAC Collection ID. Required. + :type collection_id: str + :param body: Multi-part form data. Required. + :type body: JSON + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_collection_asset( + self, collection_id: str, body: Union[_models.StacAssetData, JSON], **kwargs: Any + ) -> _models.StacCollection: + """Create Collection Asset. + + Create a new asset in the Collection metadata and write the associated file to managed storage. + + :param collection_id: STAC Collection ID. Required. + :type collection_id: str + :param body: Multi-part form data. Is either a StacAssetData type or a JSON type. Required. + :type body: ~azure.planetarycomputer.models.StacAssetData or JSON + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) + + _body = body.as_dict() if isinstance(body, _Model) else body + _file_fields: list[str] = ["file"] + _data_fields: list[str] = ["data"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_stac_create_collection_asset_request( + collection_id=collection_id, + api_version=self._config.api_version, + files=_files, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def replace_collection_asset( + self, collection_id: str, asset_id: str, body: _models.StacAssetData, **kwargs: Any + ) -> _models.StacCollection: + """Update Collection Asset. + + Update an existing asset in a given collection. + + :param collection_id: STAC Collection ID. Required. + :type collection_id: str + :param asset_id: STAC Asset ID. Required. + :type asset_id: str + :param body: Multi-part form data. Required. + :type body: ~azure.planetarycomputer.models.StacAssetData + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_collection_asset( + self, collection_id: str, asset_id: str, body: JSON, **kwargs: Any + ) -> _models.StacCollection: + """Update Collection Asset. + + Update an existing asset in a given collection. + + :param collection_id: STAC Collection ID. Required. + :type collection_id: str + :param asset_id: STAC Asset ID. Required. + :type asset_id: str + :param body: Multi-part form data. Required. + :type body: JSON + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def replace_collection_asset( + self, collection_id: str, asset_id: str, body: Union[_models.StacAssetData, JSON], **kwargs: Any + ) -> _models.StacCollection: + """Update Collection Asset. + + Update an existing asset in a given collection. + + :param collection_id: STAC Collection ID. Required. + :type collection_id: str + :param asset_id: STAC Asset ID. Required. + :type asset_id: str + :param body: Multi-part form data. Is either a StacAssetData type or a JSON type. Required. + :type body: ~azure.planetarycomputer.models.StacAssetData or JSON + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) + + _body = body.as_dict() if isinstance(body, _Model) else body + _file_fields: list[str] = ["file"] + _data_fields: list[str] = ["data"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_stac_replace_collection_asset_request( + collection_id=collection_id, + asset_id=asset_id, + api_version=self._config.api_version, + files=_files, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_collection_asset(self, collection_id: str, asset_id: str, **kwargs: Any) -> _models.StacCollection: + """Delete Collection Asset. + + Delete an asset from a given collection. + + :param collection_id: STAC Collection ID. Required. + :type collection_id: str + :param asset_id: STAC Asset ID. Required. + :type asset_id: str + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) + + _request = build_stac_delete_collection_asset_request( + collection_id=collection_id, + asset_id=asset_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_collection_configuration(self, collection_id: str, **kwargs: Any) -> _models.UserCollectionSettings: + """Get Config. + + Get the complete user configuration for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :return: UserCollectionSettings. The UserCollectionSettings is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.UserCollectionSettings + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.UserCollectionSettings] = kwargs.pop("cls", None) + + _request = build_stac_get_collection_configuration_request( + collection_id=collection_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.UserCollectionSettings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def add_mosaic( + self, collection_id: str, body: _models.StacMosaic, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.StacMosaic: + """Add Collection Mosaic. + + Add a mosaic definition to a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Mosaic definition to be created or updated. Required. + :type body: ~azure.planetarycomputer.models.StacMosaic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacMosaic. The StacMosaic is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacMosaic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_mosaic( + self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.StacMosaic: + """Add Collection Mosaic. + + Add a mosaic definition to a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Mosaic definition to be created or updated. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacMosaic. The StacMosaic is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacMosaic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add_mosaic( + self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.StacMosaic: + """Add Collection Mosaic. + + Add a mosaic definition to a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Mosaic definition to be created or updated. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: StacMosaic. The StacMosaic is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacMosaic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def add_mosaic( + self, collection_id: str, body: Union[_models.StacMosaic, JSON, IO[bytes]], **kwargs: Any + ) -> _models.StacMosaic: + """Add Collection Mosaic. + + Add a mosaic definition to a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Mosaic definition to be created or updated. Is one of the following types: + StacMosaic, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.StacMosaic or JSON or IO[bytes] + :return: StacMosaic. The StacMosaic is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacMosaic + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StacMosaic] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_add_mosaic_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacMosaic, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def replace_mosaic( + self, + collection_id: str, + mosaic_id: str, + body: _models.StacMosaic, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacMosaic: + """Update Collection Mosaic. + + Update a mosaic definition from a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param mosaic_id: Unique identifier for the mosaic configuration. Required. + :type mosaic_id: str + :param body: Mosaic definition to be created or updated. Required. + :type body: ~azure.planetarycomputer.models.StacMosaic + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacMosaic. The StacMosaic is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacMosaic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_mosaic( + self, collection_id: str, mosaic_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.StacMosaic: + """Update Collection Mosaic. + + Update a mosaic definition from a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param mosaic_id: Unique identifier for the mosaic configuration. Required. + :type mosaic_id: str + :param body: Mosaic definition to be created or updated. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacMosaic. The StacMosaic is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacMosaic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_mosaic( + self, + collection_id: str, + mosaic_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacMosaic: + """Update Collection Mosaic. + + Update a mosaic definition from a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param mosaic_id: Unique identifier for the mosaic configuration. Required. + :type mosaic_id: str + :param body: Mosaic definition to be created or updated. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: StacMosaic. The StacMosaic is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacMosaic + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def replace_mosaic( + self, collection_id: str, mosaic_id: str, body: Union[_models.StacMosaic, JSON, IO[bytes]], **kwargs: Any + ) -> _models.StacMosaic: + """Update Collection Mosaic. + + Update a mosaic definition from a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param mosaic_id: Unique identifier for the mosaic configuration. Required. + :type mosaic_id: str + :param body: Mosaic definition to be created or updated. Is one of the following types: + StacMosaic, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.StacMosaic or JSON or IO[bytes] + :return: StacMosaic. The StacMosaic is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacMosaic + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StacMosaic] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_replace_mosaic_request( + collection_id=collection_id, + mosaic_id=mosaic_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacMosaic, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_mosaic( # pylint: disable=inconsistent-return-statements + self, collection_id: str, mosaic_id: str, **kwargs: Any + ) -> None: + """Delete Collection Mosaic. + + Delete a mosaic definition from a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param mosaic_id: Unique identifier for the mosaic configuration. Required. + :type mosaic_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_stac_delete_mosaic_request( + collection_id=collection_id, + mosaic_id=mosaic_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_mosaic(self, collection_id: str, mosaic_id: str, **kwargs: Any) -> _models.StacMosaic: + """Get Collection Mosaic. + + Get a mosaic definition from a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param mosaic_id: Unique identifier for the mosaic configuration. Required. + :type mosaic_id: str + :return: StacMosaic. The StacMosaic is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacMosaic + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacMosaic] = kwargs.pop("cls", None) + + _request = build_stac_get_mosaic_request( + collection_id=collection_id, + mosaic_id=mosaic_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacMosaic, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_mosaics(self, collection_id: str, **kwargs: Any) -> List[_models.StacMosaic]: + """Get Collection Mosaics. + + Get the mosaic definitions for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :return: list of StacMosaic + :rtype: list[~azure.planetarycomputer.models.StacMosaic] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.StacMosaic]] = kwargs.pop("cls", None) + + _request = build_stac_list_mosaics_request( + collection_id=collection_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.StacMosaic], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_collection_initial( + self, body: Union[_models.StacCollection, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_create_collection_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_collection( + self, body: _models.StacCollection, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Create Collection. + + Create a new collection in the GeoCatalog instance. + + :param body: Request collection body. Required. + :type body: ~azure.planetarycomputer.models.StacCollection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_collection( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Create Collection. + + Create a new collection in the GeoCatalog instance. + + :param body: Request collection body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_collection( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Create Collection. + + Create a new collection in the GeoCatalog instance. + + :param body: Request collection body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_collection( + self, body: Union[_models.StacCollection, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Create Collection. + + Create a new collection in the GeoCatalog instance. + + :param body: Request collection body. Is one of the following types: StacCollection, JSON, + IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.StacCollection or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_collection_initial( + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @overload + def replace_collection( + self, collection_id: str, body: _models.StacCollection, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.StacCollection: + """Replace Collection. + + Replace an existing collection in the GeoCatalog instance. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: Request collection body. Required. + :type body: ~azure.planetarycomputer.models.StacCollection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_collection( + self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.StacCollection: + """Replace Collection. + + Replace an existing collection in the GeoCatalog instance. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: Request collection body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_collection( + self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.StacCollection: + """Replace Collection. + + Replace an existing collection in the GeoCatalog instance. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: Request collection body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def replace_collection( + self, collection_id: str, body: Union[_models.StacCollection, JSON, IO[bytes]], **kwargs: Any + ) -> _models.StacCollection: + """Replace Collection. + + Replace an existing collection in the GeoCatalog instance. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: Request collection body. Is one of the following types: StacCollection, JSON, + IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.StacCollection or JSON or IO[bytes] + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_replace_collection_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_collection_initial(self, collection_id: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_stac_delete_collection_request( + collection_id=collection_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_collection(self, collection_id: str, **kwargs: Any) -> LROPoller[None]: + """Delete Collection. + + Delete a collection in the GeoCatalog instance. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_collection_initial( + collection_id=collection_id, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_collection( + self, + collection_id: str, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> _models.StacCollection: + """Get Collection. + + Get a collection in the GeoCatalog instance. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int + :return: StacCollection. The StacCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) + + _request = build_stac_get_collection_request( + collection_id=collection_id, + sign=sign, + duration_in_minutes=duration_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_collections( + self, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> _models.StacCatalogCollections: + """Get Collections. + + List all collections in the GeoCatalog instance. + + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int + :return: StacCatalogCollections. The StacCatalogCollections is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacCatalogCollections + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacCatalogCollections] = kwargs.pop("cls", None) + + _request = build_stac_get_collections_request( + sign=sign, + duration_in_minutes=duration_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacCatalogCollections, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_partition_type(self, collection_id: str, **kwargs: Any) -> _models.PartitionType: + """Get Partitiontype. + + Get the partitiontype for a GeoCatalog Collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :return: PartitionType. The PartitionType is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.PartitionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PartitionType] = kwargs.pop("cls", None) + + _request = build_stac_get_partition_type_request( + collection_id=collection_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PartitionType, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def replace_partition_type( + self, collection_id: str, body: _models.PartitionType, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Create Partitiontype. + + Updates partition type for a GeoCatalog Collection. This will + determine the partitioning scheme for items within the database, + and can only be set before any items are loaded. + + Ideal partitioning schemes result in partitions of roughly 100k items each. + + The default partitioning scheme is "none" which does not partition items. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Partition type configuration determining how items are partitioned in storage. + Required. + :type body: ~azure.planetarycomputer.models.PartitionType + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_partition_type( + self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Create Partitiontype. + + Updates partition type for a GeoCatalog Collection. This will + determine the partitioning scheme for items within the database, + and can only be set before any items are loaded. + + Ideal partitioning schemes result in partitions of roughly 100k items each. + + The default partitioning scheme is "none" which does not partition items. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Partition type configuration determining how items are partitioned in storage. + Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_partition_type( + self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Create Partitiontype. + + Updates partition type for a GeoCatalog Collection. This will + determine the partitioning scheme for items within the database, + and can only be set before any items are loaded. + + Ideal partitioning schemes result in partitions of roughly 100k items each. + + The default partitioning scheme is "none" which does not partition items. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Partition type configuration determining how items are partitioned in storage. + Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def replace_partition_type( # pylint: disable=inconsistent-return-statements + self, collection_id: str, body: Union[_models.PartitionType, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """Create Partitiontype. + + Updates partition type for a GeoCatalog Collection. This will + determine the partitioning scheme for items within the database, + and can only be set before any items are loaded. + + Ideal partitioning schemes result in partitions of roughly 100k items each. + + The default partitioning scheme is "none" which does not partition items. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Partition type configuration determining how items are partitioned in storage. Is + one of the following types: PartitionType, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.PartitionType or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_replace_partition_type_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_render_option( + self, collection_id: str, body: _models.RenderOption, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RenderOption: + """Add Collection Render Option. + + Add a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Render option configuration to be created or updated. Required. + :type body: ~azure.planetarycomputer.models.RenderOption + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RenderOption. The RenderOption is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.RenderOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_render_option( + self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RenderOption: + """Add Collection Render Option. + + Add a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Render option configuration to be created or updated. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RenderOption. The RenderOption is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.RenderOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_render_option( + self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RenderOption: + """Add Collection Render Option. + + Add a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Render option configuration to be created or updated. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RenderOption. The RenderOption is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.RenderOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_render_option( + self, collection_id: str, body: Union[_models.RenderOption, JSON, IO[bytes]], **kwargs: Any + ) -> _models.RenderOption: + """Add Collection Render Option. + + Add a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Render option configuration to be created or updated. Is one of the following + types: RenderOption, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.RenderOption or JSON or IO[bytes] + :return: RenderOption. The RenderOption is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.RenderOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RenderOption] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_create_render_option_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RenderOption, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def replace_render_option( + self, + collection_id: str, + render_option_id: str, + body: _models.RenderOption, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RenderOption: + """Update Collection Render Option. + + Update a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param render_option_id: Unique identifier for the render option. Required. + :type render_option_id: str + :param body: Render option configuration to be created or updated. Required. + :type body: ~azure.planetarycomputer.models.RenderOption + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RenderOption. The RenderOption is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.RenderOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_render_option( + self, + collection_id: str, + render_option_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RenderOption: + """Update Collection Render Option. + + Update a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param render_option_id: Unique identifier for the render option. Required. + :type render_option_id: str + :param body: Render option configuration to be created or updated. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RenderOption. The RenderOption is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.RenderOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_render_option( + self, + collection_id: str, + render_option_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RenderOption: + """Update Collection Render Option. + + Update a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param render_option_id: Unique identifier for the render option. Required. + :type render_option_id: str + :param body: Render option configuration to be created or updated. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RenderOption. The RenderOption is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.RenderOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def replace_render_option( + self, + collection_id: str, + render_option_id: str, + body: Union[_models.RenderOption, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.RenderOption: + """Update Collection Render Option. + + Update a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param render_option_id: Unique identifier for the render option. Required. + :type render_option_id: str + :param body: Render option configuration to be created or updated. Is one of the following + types: RenderOption, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.RenderOption or JSON or IO[bytes] + :return: RenderOption. The RenderOption is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.RenderOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RenderOption] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_replace_render_option_request( + collection_id=collection_id, + render_option_id=render_option_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RenderOption, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_render_option( # pylint: disable=inconsistent-return-statements + self, collection_id: str, render_option_id: str, **kwargs: Any + ) -> None: + """Delete Collection Render Option. + + Delete a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param render_option_id: Unique identifier for the render option. Required. + :type render_option_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_stac_delete_render_option_request( + collection_id=collection_id, + render_option_id=render_option_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_render_option(self, collection_id: str, render_option_id: str, **kwargs: Any) -> _models.RenderOption: + """Get Collection Render Option. + + Get a render option for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param render_option_id: Unique identifier for the render option. Required. + :type render_option_id: str + :return: RenderOption. The RenderOption is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.RenderOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RenderOption] = kwargs.pop("cls", None) + + _request = build_stac_get_render_option_request( + collection_id=collection_id, + render_option_id=render_option_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RenderOption, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_render_options(self, collection_id: str, **kwargs: Any) -> List[_models.RenderOption]: + """Get Collection Render Options. + + Get all render options for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :return: list of RenderOption + :rtype: list[~azure.planetarycomputer.models.RenderOption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RenderOption]] = kwargs.pop("cls", None) + + _request = build_stac_list_render_options_request( + collection_id=collection_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.RenderOption], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_collection_thumbnail(self, collection_id: str, **kwargs: Any) -> Iterator[bytes]: + """Get Collection Thumbnail. + + Get thumbnail for given collection. + + :param collection_id: STAC Collection ID. Required. + :type collection_id: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_stac_get_collection_thumbnail_request( + collection_id=collection_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tile_settings(self, collection_id: str, **kwargs: Any) -> _models.TileSettings: + """Get Collection Tile Settings. + + Get the tile settings for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :return: TileSettings. The TileSettings is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSettings + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSettings] = kwargs.pop("cls", None) + + _request = build_stac_get_tile_settings_request( + collection_id=collection_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSettings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def replace_tile_settings( + self, collection_id: str, body: _models.TileSettings, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TileSettings: + """Update Collection Tile Settings. + + Update the tile settings for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Tile settings configuration to be updated. Required. + :type body: ~azure.planetarycomputer.models.TileSettings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TileSettings. The TileSettings is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSettings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_tile_settings( + self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TileSettings: + """Update Collection Tile Settings. + + Update the tile settings for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Tile settings configuration to be updated. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TileSettings. The TileSettings is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSettings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_tile_settings( + self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TileSettings: + """Update Collection Tile Settings. + + Update the tile settings for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Tile settings configuration to be updated. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: TileSettings. The TileSettings is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSettings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def replace_tile_settings( + self, collection_id: str, body: Union[_models.TileSettings, JSON, IO[bytes]], **kwargs: Any + ) -> _models.TileSettings: + """Update Collection Tile Settings. + + Update the tile settings for a given collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Tile settings configuration to be updated. Is one of the following types: + TileSettings, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.TileSettings or JSON or IO[bytes] + :return: TileSettings. The TileSettings is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSettings + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TileSettings] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_replace_tile_settings_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSettings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_conformance_class(self, **kwargs: Any) -> _models.StacConformanceClasses: + """Conformance Classes. + + Returns the STAC conformance classes. + + :return: StacConformanceClasses. The StacConformanceClasses is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacConformanceClasses + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacConformanceClasses] = kwargs.pop("cls", None) + + _request = build_stac_get_conformance_class_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacConformanceClasses, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_landing_page(self, **kwargs: Any) -> _models.StacLandingPage: + """Landing Page. + + Return the STAC landing page. + + :return: StacLandingPage. The StacLandingPage is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacLandingPage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacLandingPage] = kwargs.pop("cls", None) + + _request = build_stac_get_landing_page_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacLandingPage, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_item_initial( + self, collection_id: str, body: Union[_models.StacItemOrStacItemCollection, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_create_item_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_item( + self, + collection_id: str, + body: _models.StacItemOrStacItemCollection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Create a new STAC item or a set of items in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: STAC Item or StacItemCollection + + Represents a STAC Item or StacItemCollection as defined by the STAC 1.0.0 standard. + + **Item**: A GeoJSON Feature that represents a single spatiotemporal asset. + It includes metadata such as geometry, datetime, and links to related assets. + Example: A satellite image with its metadata. + + **StacItemCollection**: A GeoJSON FeatureCollection that contains multiple Items. + It is used to group multiple related Items together, such as a collection of satellite images. + + This union allows the request body to accept either a single Item or a collection of Items. + Required. + :type body: ~azure.planetarycomputer.models.StacItemOrStacItemCollection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_item( + self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Create a new STAC item or a set of items in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: STAC Item or StacItemCollection + + Represents a STAC Item or StacItemCollection as defined by the STAC 1.0.0 standard. + + **Item**: A GeoJSON Feature that represents a single spatiotemporal asset. + It includes metadata such as geometry, datetime, and links to related assets. + Example: A satellite image with its metadata. + + **StacItemCollection**: A GeoJSON FeatureCollection that contains multiple Items. + It is used to group multiple related Items together, such as a collection of satellite images. + + This union allows the request body to accept either a single Item or a collection of Items. + Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_item( + self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Create a new STAC item or a set of items in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: STAC Item or StacItemCollection + + Represents a STAC Item or StacItemCollection as defined by the STAC 1.0.0 standard. + + **Item**: A GeoJSON Feature that represents a single spatiotemporal asset. + It includes metadata such as geometry, datetime, and links to related assets. + Example: A satellite image with its metadata. + + **StacItemCollection**: A GeoJSON FeatureCollection that contains multiple Items. + It is used to group multiple related Items together, such as a collection of satellite images. + + This union allows the request body to accept either a single Item or a collection of Items. + Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_item( + self, collection_id: str, body: Union[_models.StacItemOrStacItemCollection, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Create a new STAC item or a set of items in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param body: STAC Item or StacItemCollection + + Represents a STAC Item or StacItemCollection as defined by the STAC 1.0.0 standard. + + **Item**: A GeoJSON Feature that represents a single spatiotemporal asset. + It includes metadata such as geometry, datetime, and links to related assets. + Example: A satellite image with its metadata. + + **StacItemCollection**: A GeoJSON FeatureCollection that contains multiple Items. + It is used to group multiple related Items together, such as a collection of satellite images. + + This union allows the request body to accept either a single Item or a collection of Items. Is + one of the following types: StacItemOrStacItemCollection, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.StacItemOrStacItemCollection or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_item_initial( + collection_id=collection_id, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _replace_item_initial( + self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_replace_item_request( + collection_id=collection_id, + item_id=item_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_replace_item( + self, + collection_id: str, + item_id: str, + body: _models.StacItem, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Replace a STAC item in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :param body: STAC Item. Required. + :type body: ~azure.planetarycomputer.models.StacItem + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_replace_item( + self, collection_id: str, item_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Replace a STAC item in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :param body: STAC Item. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_replace_item( + self, + collection_id: str, + item_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Replace a STAC item in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :param body: STAC Item. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_replace_item( + self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Replace a STAC item in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :param body: STAC Item. Is one of the following types: StacItem, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.StacItem or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._replace_item_initial( + collection_id=collection_id, + item_id=item_id, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_item_initial(self, collection_id: str, item_id: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_stac_delete_item_request( + collection_id=collection_id, + item_id=item_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_item(self, collection_id: str, item_id: str, **kwargs: Any) -> LROPoller[None]: + """Delete a STAC item from a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_item_initial( + collection_id=collection_id, + item_id=item_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_item( + self, + collection_id: str, + item_id: str, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> _models.StacItem: + """Fetch a single STAC Item. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int + :return: StacItem. The StacItem is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacItem] = kwargs.pop("cls", None) + + _request = build_stac_get_item_request( + collection_id=collection_id, + item_id=item_id, + sign=sign, + duration_in_minutes=duration_in_minutes, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_item_collection( + self, + collection_id: str, + *, + limit: Optional[int] = None, + bounding_box: Optional[List[str]] = None, + datetime: Optional[str] = None, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + token: Optional[str] = None, + **kwargs: Any + ) -> _models.StacItemCollection: + """Fetch features of the feature collection with id ``collectionId``. + + Every feature in a dataset belongs to a collection. A dataset may + consist of multiple feature collections. A feature collection is often a + collection of features of a similar type, based on a common schema. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :keyword limit: The optional limit parameter recommends the number of items that should be + present in the response document. + + If the limit parameter value is greater than advertised limit maximum, the server must return + the + maximum possible number of items, rather than responding with an error. + + Only items are counted that are on the first level of the collection in the response document. + Nested objects contained within the explicitly requested items must not be counted. + + Minimum = 1. Maximum = 10000. Default = 10. Default value is None. + :paramtype limit: int + :keyword bounding_box: Only features that have a geometry that intersects the bounding box are + selected. + The bounding box is provided as four or six numbers, depending on whether the + coordinate reference system includes a vertical axis (height or depth): + + + + * Lower left corner, coordinate axis 1 + * Lower left corner, coordinate axis 2 + * Minimum value, coordinate axis 3 (optional) + * Upper right corner, coordinate axis 1 + * Upper right corner, coordinate axis 2 + * Maximum value, coordinate axis 3 (optional) + + The coordinate reference system of the values is WGS 84 longitude/latitude + (`http://www.opengis.net/def/crs/OGC/1.3/CRS84 + `_). + + For WGS 84 longitude/latitude the values are in most cases the sequence of + minimum longitude, minimum latitude, maximum longitude and maximum latitude. + However, in cases where the box spans the antimeridian the first value + (west-most box edge) is larger than the third value (east-most box edge). + + If the vertical axis is included, the third and the sixth number are + the bottom and the top of the 3-dimensional bounding box. + + If a feature has multiple spatial geometry properties, it is the decision of the + server whether only a single spatial geometry property is used to determine + the extent or all relevant geometries. Default value is None. + :paramtype bounding_box: list[str] + :keyword datetime: Either a date-time or an interval, open or closed. Date and time expressions + adhere to RFC 3339. Open intervals are expressed using double-dots. + + Examples: + + + + * A date-time: "2018-02-12T23:20:50Z" + * A closed interval: "2018-02-12T00:00:00Z/2018-03-18T12:31:12Z" + * Open intervals: "2018-02-12T00:00:00Z/.." or "../2018-03-18T12:31:12Z" + + Only features that have a temporal property that intersects the value of + ``datetime`` are selected. + + If a feature has multiple temporal properties, it is the decision of the + server whether only a single temporal property is used to determine + the extent or all relevant temporal properties. Default value is None. + :paramtype datetime: str + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int + :keyword token: Pagination token for fetching the next set of results. Default value is None. + :paramtype token: str + :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.StacItemCollection] = kwargs.pop("cls", None) + + _request = build_stac_get_item_collection_request( + collection_id=collection_id, + limit=limit, + bounding_box=bounding_box, + datetime=datetime, + sign=sign, + duration_in_minutes=duration_in_minutes, + token=token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacItemCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_item_initial( + self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_update_item_request( + collection_id=collection_id, + item_id=item_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_item( + self, + collection_id: str, + item_id: str, + body: _models.StacItem, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a STAC item in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :param body: STAC Item. Required. + :type body: ~azure.planetarycomputer.models.StacItem + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_item( + self, + collection_id: str, + item_id: str, + body: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a STAC item in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :param body: STAC Item. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_item( + self, + collection_id: str, + item_id: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> LROPoller[None]: + """Update a STAC item in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :param body: STAC Item. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_item( + self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Update a STAC item in a collection. + + :param collection_id: Catalog collection id. Required. + :type collection_id: str + :param item_id: STAC Item id. Required. + :type item_id: str + :param body: STAC Item. Is one of the following types: StacItem, JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.StacItem or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_item_initial( + collection_id=collection_id, + item_id=item_id, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @overload + def create_queryables( + self, + collection_id: str, + body: List[_models.StacQueryable], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.StacQueryable]: + """Set Collection Queryables. + + Set queryables for a collection given a list of queryable definitions. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Request queryable definition body. Required. + :type body: list[~azure.planetarycomputer.models.StacQueryable] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of StacQueryable + :rtype: list[~azure.planetarycomputer.models.StacQueryable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_queryables( + self, collection_id: str, body: List[JSON], *, content_type: str = "application/json", **kwargs: Any + ) -> List[_models.StacQueryable]: + """Set Collection Queryables. + + Set queryables for a collection given a list of queryable definitions. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Request queryable definition body. Required. + :type body: list[JSON] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of StacQueryable + :rtype: list[~azure.planetarycomputer.models.StacQueryable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_queryables( + self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> List[_models.StacQueryable]: + """Set Collection Queryables. + + Set queryables for a collection given a list of queryable definitions. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Request queryable definition body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: list of StacQueryable + :rtype: list[~azure.planetarycomputer.models.StacQueryable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_queryables( + self, collection_id: str, body: Union[List[_models.StacQueryable], List[JSON], IO[bytes]], **kwargs: Any + ) -> List[_models.StacQueryable]: + """Set Collection Queryables. + + Set queryables for a collection given a list of queryable definitions. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param body: Request queryable definition body. Is one of the following types: [StacQueryable], + [JSON], IO[bytes] Required. + :type body: list[~azure.planetarycomputer.models.StacQueryable] or list[JSON] or IO[bytes] + :return: list of StacQueryable + :rtype: list[~azure.planetarycomputer.models.StacQueryable] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.StacQueryable]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_create_queryables_request( + collection_id=collection_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.StacQueryable], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def replace_queryable( + self, + collection_id: str, + queryable_name: str, + body: _models.StacQueryable, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacQueryable: + """Update Collection Queryables. + + Updates a queryable given a queryable definition and corresponding collection id. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param queryable_name: Name of the queryable property to operate on. Required. + :type queryable_name: str + :param body: Request queryable definition body. Required. + :type body: ~azure.planetarycomputer.models.StacQueryable + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacQueryable. The StacQueryable is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacQueryable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_queryable( + self, + collection_id: str, + queryable_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacQueryable: + """Update Collection Queryables. + + Updates a queryable given a queryable definition and corresponding collection id. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param queryable_name: Name of the queryable property to operate on. Required. + :type queryable_name: str + :param body: Request queryable definition body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacQueryable. The StacQueryable is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacQueryable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def replace_queryable( + self, + collection_id: str, + queryable_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacQueryable: + """Update Collection Queryables. + + Updates a queryable given a queryable definition and corresponding collection id. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param queryable_name: Name of the queryable property to operate on. Required. + :type queryable_name: str + :param body: Request queryable definition body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: StacQueryable. The StacQueryable is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacQueryable + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def replace_queryable( + self, + collection_id: str, + queryable_name: str, + body: Union[_models.StacQueryable, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.StacQueryable: + """Update Collection Queryables. + + Updates a queryable given a queryable definition and corresponding collection id. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param queryable_name: Name of the queryable property to operate on. Required. + :type queryable_name: str + :param body: Request queryable definition body. Is one of the following types: StacQueryable, + JSON, IO[bytes] Required. + :type body: ~azure.planetarycomputer.models.StacQueryable or JSON or IO[bytes] + :return: StacQueryable. The StacQueryable is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacQueryable + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StacQueryable] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_replace_queryable_request( + collection_id=collection_id, + queryable_name=queryable_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacQueryable, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_queryable( # pylint: disable=inconsistent-return-statements + self, collection_id: str, queryable_name: str, **kwargs: Any + ) -> None: + """Delete Queryables. + + Delete queryables by name for specified collection. + + :param collection_id: Unique identifier for the STAC collection. Required. + :type collection_id: str + :param queryable_name: Name of the queryable property to operate on. Required. + :type queryable_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_stac_delete_queryable_request( + collection_id=collection_id, + queryable_name=queryable_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_queryables(self, **kwargs: Any) -> _models.QueryableDefinitionsResponse: + """Queryables. + + List all queryables in the GeoCatalog instance. + + :return: QueryableDefinitionsResponse. The QueryableDefinitionsResponse is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.QueryableDefinitionsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.QueryableDefinitionsResponse] = kwargs.pop("cls", None) + + _request = build_stac_list_queryables_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> _models.QueryableDefinitionsResponse: + """Collection Queryables. + + List all queryables in a given collection. + + :param collection_id: Collection ID. Required. + :type collection_id: str + :return: QueryableDefinitionsResponse. The QueryableDefinitionsResponse is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.QueryableDefinitionsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.QueryableDefinitionsResponse] = kwargs.pop("cls", None) + + _request = build_stac_get_collection_queryables_request( + collection_id=collection_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def search( + self, + body: _models.StacSearchParameters, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacItemCollection: + """Search. + + STAC search operation. + + :param body: Request body. Required. + :type body: ~azure.planetarycomputer.models.StacSearchParameters + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def search( + self, + body: JSON, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacItemCollection: + """Search. + + STAC search operation. + + :param body: Request body. Required. + :type body: JSON + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def search( + self, + body: IO[bytes], + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacItemCollection: + """Search. + + STAC search operation. + + :param body: Request body. Required. + :type body: IO[bytes] + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def search( + self, + body: Union[_models.StacSearchParameters, JSON, IO[bytes]], + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> _models.StacItemCollection: + """Search. + + STAC search operation. + + :param body: Request body. Is one of the following types: StacSearchParameters, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.StacSearchParameters or JSON or IO[bytes] + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int + :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StacItemCollection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_stac_search_request( + sign=sign, + duration_in_minutes=duration_in_minutes, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.StacItemCollection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DataOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.planetarycomputer.PlanetaryComputerProClient`'s + :attr:`data` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PlanetaryComputerProClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_tile_matrix_definitions(self, tile_matrix_set_id: str, **kwargs: Any) -> _models.TileMatrixSet: + """Matrix Definition. + + Return Matrix Definition. + + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :return: TileMatrixSet. The TileMatrixSet is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileMatrixSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileMatrixSet] = kwargs.pop("cls", None) + + _request = build_data_get_tile_matrix_definitions_request( + tile_matrix_set_id=tile_matrix_set_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileMatrixSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_tile_matrices(self, **kwargs: Any) -> List[str]: + """Matrix List. + + Return Matrix List. + + :return: list of str + :rtype: list[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[str]] = kwargs.pop("cls", None) + + _request = build_data_list_tile_matrices_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[str], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_class_map_legend( + self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any + ) -> _models.ClassMapLegendResponse: + """Get ClassMap Legend. + + Generate values and color swatches mapping for a given classmap. + + :param classmap_name: classmap name. Required. + :type classmap_name: str + :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. + :paramtype trim_start: int + :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. + :paramtype trim_end: int + :return: ClassMapLegendResponse. The ClassMapLegendResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.ClassMapLegendResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ClassMapLegendResponse] = kwargs.pop("cls", None) + + _request = build_data_get_class_map_legend_request( + classmap_name=classmap_name, + trim_start=trim_start, + trim_end=trim_end, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ClassMapLegendResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_interval_legend( + self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any + ) -> List[List[List[int]]]: + """Get Interval Legend. + + Generate values and color swatches mapping for a given interval classmap. + + Returns a color map for intervals, where each interval is defined by + a numeric range [min, max] representing the interval boundaries and + an RGBA color [red, green, blue, alpha] associated with the interval. + + The response is a 2D array of interval definitions, where each element is a pair: + the first element is an array of two numbers [min, max] defining the interval, + and the second element is an array of four numbers [red, green, blue, alpha] defining the RGBA + color. + + Example: [[ [-2, 0], [0, 0, 0, 0] ], [ [1, 32], [255, 255, 178, 255] ]]. + This defines two intervals: [-2, 0] mapped to transparent black and [1, 32] mapped to opaque + yellow. + + :param classmap_name: classmap name. Required. + :type classmap_name: str + :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. + :paramtype trim_start: int + :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. + :paramtype trim_end: int + :return: list of list of list of int + :rtype: list[list[list[int]]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[List[List[int]]]] = kwargs.pop("cls", None) + + _request = build_data_get_interval_legend_request( + classmap_name=classmap_name, + trim_start=trim_start, + trim_end=trim_end, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[List[List[int]]], response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_legend( + self, + color_map_name: str, + *, + height: Optional[float] = None, + width: Optional[float] = None, + trim_start: Optional[int] = None, + trim_end: Optional[int] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Get Legend. + + Generate a legend image for a given colormap. + + If the colormap has non-contiguous values at the beginning or end, + which aren't desired in the output image, they can be trimmed by specifying + the number of values to trim. + + :param color_map_name: The name of the registered colormap to generate a legend for. Required. + :type color_map_name: str + :keyword height: The output height of the legend image. Default value is None. + :paramtype height: float + :keyword width: The output width of the legend image. Default value is None. + :paramtype width: float + :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. + :paramtype trim_start: int + :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. + :paramtype trim_end: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_legend_request( + color_map_name=color_map_name, + height=height, + width=width, + trim_start=trim_start, + trim_end=trim_end, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def register_mosaics_search( + self, + *, + content_type: str = "application/json", + collections: Optional[List[str]] = None, + ids: Optional[List[str]] = None, + bounding_box: Optional[List[float]] = None, + intersects: Optional[_models.Geometry] = None, + query: Optional[dict[str, Any]] = None, + filter: Optional[dict[str, Any]] = None, + datetime: Optional[str] = None, + sort_by: Optional[List[_models.StacSortExtension]] = None, + filter_language: Optional[Union[str, _models.FilterLanguage]] = None, + metadata: Optional[_models.MosaicMetadata] = None, + **kwargs: Any + ) -> _models.TilerMosaicSearchRegistrationResponse: + """Register Search. + + Register a Search query. + + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword collections: List of STAC collection IDs to include in the mosaic. Default value is + None. + :paramtype collections: list[str] + :keyword ids: List of specific STAC item IDs to include in the mosaic. Default value is None. + :paramtype ids: list[str] + :keyword bounding_box: Geographic bounding box to filter items [west, south, east, north]. + Default value is None. + :paramtype bounding_box: list[float] + :keyword intersects: GeoJSON geometry to spatially filter items by intersection. Default value + is None. + :paramtype intersects: ~azure.planetarycomputer.models.Geometry + :keyword query: Query. Default value is None. + :paramtype query: dict[str, any] + :keyword filter: Filter. Default value is None. + :paramtype filter: dict[str, any] + :keyword datetime: Temporal filter in RFC 3339 format or interval. Default value is None. + :paramtype datetime: str + :keyword sort_by: Criteria for ordering items in the mosaic. Default value is None. + :paramtype sort_by: list[~azure.planetarycomputer.models.StacSortExtension] + :keyword filter_language: Query language format used in the filter parameter. Known values are: + "cql-json", "cql2-json", and "cql2-text". Default value is None. + :paramtype filter_language: str or ~azure.planetarycomputer.models.FilterLanguage + :keyword metadata: Additional metadata to associate with the mosaic. Default value is None. + :paramtype metadata: ~azure.planetarycomputer.models.MosaicMetadata + :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is + compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def register_mosaics_search( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TilerMosaicSearchRegistrationResponse: + """Register Search. + + Register a Search query. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is + compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def register_mosaics_search( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.TilerMosaicSearchRegistrationResponse: + """Register Search. + + Register a Search query. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is + compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def register_mosaics_search( # pylint: disable=too-many-locals + self, + body: Union[JSON, IO[bytes]] = _Unset, + *, + collections: Optional[List[str]] = None, + ids: Optional[List[str]] = None, + bounding_box: Optional[List[float]] = None, + intersects: Optional[_models.Geometry] = None, + query: Optional[dict[str, Any]] = None, + filter: Optional[dict[str, Any]] = None, + datetime: Optional[str] = None, + sort_by: Optional[List[_models.StacSortExtension]] = None, + filter_language: Optional[Union[str, _models.FilterLanguage]] = None, + metadata: Optional[_models.MosaicMetadata] = None, + **kwargs: Any + ) -> _models.TilerMosaicSearchRegistrationResponse: + """Register Search. + + Register a Search query. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword collections: List of STAC collection IDs to include in the mosaic. Default value is + None. + :paramtype collections: list[str] + :keyword ids: List of specific STAC item IDs to include in the mosaic. Default value is None. + :paramtype ids: list[str] + :keyword bounding_box: Geographic bounding box to filter items [west, south, east, north]. + Default value is None. + :paramtype bounding_box: list[float] + :keyword intersects: GeoJSON geometry to spatially filter items by intersection. Default value + is None. + :paramtype intersects: ~azure.planetarycomputer.models.Geometry + :keyword query: Query. Default value is None. + :paramtype query: dict[str, any] + :keyword filter: Filter. Default value is None. + :paramtype filter: dict[str, any] + :keyword datetime: Temporal filter in RFC 3339 format or interval. Default value is None. + :paramtype datetime: str + :keyword sort_by: Criteria for ordering items in the mosaic. Default value is None. + :paramtype sort_by: list[~azure.planetarycomputer.models.StacSortExtension] + :keyword filter_language: Query language format used in the filter parameter. Known values are: + "cql-json", "cql2-json", and "cql2-text". Default value is None. + :paramtype filter_language: str or ~azure.planetarycomputer.models.FilterLanguage + :keyword metadata: Additional metadata to associate with the mosaic. Default value is None. + :paramtype metadata: ~azure.planetarycomputer.models.MosaicMetadata + :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is + compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TilerMosaicSearchRegistrationResponse] = kwargs.pop("cls", None) + + if body is _Unset: + body = { + "bbox": bounding_box, + "collections": collections, + "datetime_property": datetime, + "filter": filter, + "filter_lang": filter_language, + "ids": ids, + "intersects": intersects, + "metadata": metadata, + "query": query, + "sortby": sort_by, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_register_mosaics_search_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerMosaicSearchRegistrationResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_tilesets( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileSetList: + """Tileset List. + + Return a list of available tilesets for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetList. The TileSetList is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSetList] = kwargs.pop("cls", None) + + _request = build_data_list_tilesets_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetList, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tileset_metadata( + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileSetMetadata: + """Tileset Metadata. + + Return metadata for a specific tileset of a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetMetadata. The TileSetMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSetMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_tileset_metadata_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tile( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Tile Tilematrixsetid Plain. + + Create map tile from a dataset (without scale or format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tile_by_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Tile Tilematrixsetid Format. + + Create map tile from a dataset (with format in path, without scale). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_by_format_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + scale=scale, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tile_by_scale( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Tile Tilematrixsetid Scale. + + Create map tile from a dataset (with scale in path, without format). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_by_scale_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tile_by_scale_and_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Tile Tilematrixsetid. + + Create map tile from a dataset (with TileMatrixSetId, scale, and format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_by_scale_and_format_request( + collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tile_no_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Tile Plain. + + Create map tile from a dataset (without TileMatrixSetId, scale or format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_no_tms_request( + collection_id=collection_id, + item_id=item_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tile_no_tms_by_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Tile Format. + + Create map tile from a dataset (with format in path, without TileMatrixSetId or scale). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_no_tms_by_format_request( + collection_id=collection_id, + item_id=item_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + scale=scale, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tile_no_tms_by_scale( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Tile Scale. + + Create map tile from a dataset (with scale in path, without TileMatrixSetId or format). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_no_tms_by_scale_request( + collection_id=collection_id, + item_id=item_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_tile_no_tms_by_scale_and_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Tile. + + Create map tile from a dataset (with scale and format in path, without TileMatrixSetId). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_tile_no_tms_by_scale_and_format_request( + collection_id=collection_id, + item_id=item_id, + z=z, + x=x, + y=y, + scale=scale, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def crop_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def crop_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def crop_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def crop_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Geojson Feature. + + Create image from a geojson feature (without format in path). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param collection_id: Catalog collection id. Required. + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_feature_geo_json_request( + collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + format=format, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def crop_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + format: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param ingestion_id: Ingestion id. Required. - :type ingestion_id: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def crop_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + format: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Geojson Feature Crop With Format. + + Create image from a geojson feature with format. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - collection_id=collection_id, - ingestion_id=ingestion_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + @overload + def crop_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + format: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Geojson Feature Crop With Format. - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + Create image from a geojson feature with format. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace + def crop_feature_geo_json_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Geojson Feature Crop With Format. - @distributed_trace - def get(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> _models.IngestionDefinition: - """Get the definition of an ingestion. + Create image from a geojson feature with format. - :param collection_id: Catalog collection id. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param ingestion_id: Ingestion id. Required. - :type ingestion_id: str - :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4160,15 +20470,54 @@ def get(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> _models.I } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.IngestionDefinition] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_ingestion_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_feature_geo_json_format_request( collection_id=collection_id, - ingestion_id=ingestion_id, + item_id=item_id, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -4177,222 +20526,689 @@ def get(self, collection_id: str, ingestion_id: str, **kwargs: Any) -> _models.I } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.IngestionDefinition, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, collection_id: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> ItemPaged["_models.IngestionDefinition"]: - """Get ingestions of a catalog. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :keyword top: The number of items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of IngestionDefinition - :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.IngestionDefinition] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.IngestionDefinition]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_ingestion_list_request( - collection_id=collection_id, - top=top, - skip=skip, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.IngestionDefinition], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - def update( + def crop_feature_geo_json_width_by_height( # pylint: disable=too-many-locals self, collection_id: str, - ingestion_id: str, - body: _models.IngestionDefinition, + item_id: str, + width: int, + height: int, + format: str, + body: _models.Feature, *, - content_type: str = "application/merge-patch+json", + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionDefinition: - """Update an existing ingestion. + ) -> Iterator[bytes]: + """Geojson Feature Crop With Dimensions. - :param collection_id: Catalog collection id. Required. + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param ingestion_id: Ingestion id. Required. - :type ingestion_id: str - :param body: Ingestion properties to update. Required. - :type body: ~azure.planetarycomputer.models.IngestionDefinition + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def crop_feature_geo_json_width_by_height( # pylint: disable=too-many-locals self, collection_id: str, - ingestion_id: str, + item_id: str, + width: int, + height: int, + format: str, body: JSON, *, - content_type: str = "application/merge-patch+json", + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionDefinition: - """Update an existing ingestion. + ) -> Iterator[bytes]: + """Geojson Feature Crop With Dimensions. - :param collection_id: Catalog collection id. Required. + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param ingestion_id: Ingestion id. Required. - :type ingestion_id: str - :param body: Ingestion properties to update. Required. + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def crop_feature_geo_json_width_by_height( # pylint: disable=too-many-locals self, collection_id: str, - ingestion_id: str, + item_id: str, + width: int, + height: int, + format: str, body: IO[bytes], *, - content_type: str = "application/merge-patch+json", + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionDefinition: - """Update an existing ingestion. + ) -> Iterator[bytes]: + """Geojson Feature Crop With Dimensions. - :param collection_id: Catalog collection id. Required. + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param ingestion_id: Ingestion id. Required. - :type ingestion_id: str - :param body: Ingestion properties to update. Required. + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def crop_feature_geo_json_width_by_height( # pylint: disable=too-many-locals self, collection_id: str, - ingestion_id: str, - body: Union[_models.IngestionDefinition, JSON, IO[bytes]], + item_id: str, + width: int, + height: int, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any - ) -> _models.IngestionDefinition: - """Update an existing ingestion. + ) -> Iterator[bytes]: + """Geojson Feature Crop With Dimensions. - :param collection_id: Catalog collection id. Required. + Create image from a geojson feature with dimensions. + + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param ingestion_id: Ingestion id. Required. - :type ingestion_id: str - :param body: Ingestion properties to update. Is one of the following types: - IngestionDefinition, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.IngestionDefinition or JSON or IO[bytes] - :return: IngestionDefinition. The IngestionDefinition is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionDefinition + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4406,19 +21222,48 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - cls: ClsType[_models.IngestionDefinition] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): _content = body else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_ingestion_update_request( + _request = build_data_crop_feature_geo_json_width_by_height_request( collection_id=collection_id, - ingestion_id=ingestion_id, + item_id=item_id, + width=width, + height=height, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + max_size=max_size, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -4430,7 +21275,8 @@ def update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4446,75 +21292,65 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.IngestionDefinition, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def create_source( - self, body: _models.IngestionSource, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionSource: - """Create a new ingestion source in a geo-catalog. - - :param body: Definition of the ingestion source. Required. - :type body: ~azure.planetarycomputer.models.IngestionSource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: IngestionSource. The IngestionSource is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionSource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_source( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionSource: - """Create a new ingestion source in a geo-catalog. - - :param body: Definition of the ingestion source. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: IngestionSource. The IngestionSource is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionSource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_source( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionSource: - """Create a new ingestion source in a geo-catalog. - - :param body: Definition of the ingestion source. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: IngestionSource. The IngestionSource is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionSource - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def create_source( - self, body: Union[_models.IngestionSource, JSON, IO[bytes]], **kwargs: Any - ) -> _models.IngestionSource: - """Create a new ingestion source in a geo-catalog. + def get_item_bounds( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.StacItemBounds: + """Item Bounds. - :param body: Definition of the ingestion source. Is one of the following types: - IngestionSource, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.IngestionSource or JSON or IO[bytes] - :return: IngestionSource. The IngestionSource is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionSource + Return the bounds for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: StacItemBounds. The StacItemBounds is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemBounds :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4525,23 +21361,22 @@ def create_source( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.IngestionSource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.StacItemBounds] = kwargs.pop("cls", None) - _request = build_ingestion_create_source_request( - content_type=content_type, + _request = build_data_get_item_bounds_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -4550,6 +21385,7 @@ def create_source( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4557,7 +21393,7 @@ def create_source( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -4566,86 +21402,62 @@ def create_source( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.IngestionSource, response.json()) + deserialized = _deserialize(_models.StacItemBounds, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def replace_source( - self, id: str, body: _models.IngestionSource, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionSource: - """Update an existing ingestion source in a geo-catalog. - - :param id: Ingestion source id. Required. - :type id: str - :param body: Definition of the ingestion source. Required. - :type body: ~azure.planetarycomputer.models.IngestionSource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: IngestionSource. The IngestionSource is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionSource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_source( - self, id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionSource: - """Update an existing ingestion source in a geo-catalog. - - :param id: Ingestion source id. Required. - :type id: str - :param body: Definition of the ingestion source. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: IngestionSource. The IngestionSource is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionSource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_source( - self, id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.IngestionSource: - """Update an existing ingestion source in a geo-catalog. - - :param id: Ingestion source id. Required. - :type id: str - :param body: Definition of the ingestion source. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: IngestionSource. The IngestionSource is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionSource - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def replace_source( - self, id: str, body: Union[_models.IngestionSource, JSON, IO[bytes]], **kwargs: Any - ) -> _models.IngestionSource: - """Update an existing ingestion source in a geo-catalog. + def get_item_info( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + assets: Optional[List[str]] = None, + **kwargs: Any + ) -> _models.TilerInfoMapResponse: + """Item Info. - :param id: Ingestion source id. Required. - :type id: str - :param body: Definition of the ingestion source. Is one of the following types: - IngestionSource, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.IngestionSource or JSON or IO[bytes] - :return: IngestionSource. The IngestionSource is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionSource + Return dataset's basic info for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :return: TilerInfoMapResponse. The TilerInfoMapResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerInfoMapResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4656,24 +21468,23 @@ def replace_source( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.IngestionSource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.TilerInfoMapResponse] = kwargs.pop("cls", None) - _request = build_ingestion_replace_source_request( - id=id, - content_type=content_type, + _request = build_data_get_item_info_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + assets=assets, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -4682,6 +21493,7 @@ def replace_source( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4698,27 +21510,62 @@ def replace_source( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.IngestionSource, response.json()) + deserialized = _deserialize(_models.TilerInfoMapResponse, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def delete_source(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete an ingestion source from a geo-catalog. + def get_item_info_geo_json( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + assets: Optional[List[str]] = None, + **kwargs: Any + ) -> _models.TilerInfoGeoJsonFeature: + """Item Info Geojson. - :param id: Ingestion source id. Required. - :type id: str - :return: None - :rtype: None + Return info as GeoJSON for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :return: TilerInfoGeoJsonFeature. The TilerInfoGeoJsonFeature is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerInfoGeoJsonFeature :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4732,10 +21579,19 @@ def delete_source(self, id: str, **kwargs: Any) -> None: # pylint: disable=inco _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.TilerInfoGeoJsonFeature] = kwargs.pop("cls", None) - _request = build_ingestion_delete_source_request( - id=id, + _request = build_data_get_item_info_geo_json_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + assets=assets, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4745,28 +21601,76 @@ def delete_source(self, id: str, **kwargs: Any) -> None: # pylint: disable=inco } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerInfoGeoJsonFeature, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get_source(self, id: str, **kwargs: Any) -> _models.IngestionSource: - """Get an ingestion source in a geo-catalog. + def list_item_available_assets( + self, + collection_id: str, + item_id: str, + *, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> List[str]: + """Item Available Assets. - :param id: Ingestion source id. Required. - :type id: str - :return: IngestionSource. The IngestionSource is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.IngestionSource + Return a list of supported assets for a STAC item. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: list of str + :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4780,10 +21684,18 @@ def get_source(self, id: str, **kwargs: Any) -> _models.IngestionSource: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.IngestionSource] = kwargs.pop("cls", None) + cls: ClsType[List[str]] = kwargs.pop("cls", None) - _request = build_ingestion_get_source_request( - id=id, + _request = build_data_list_item_available_assets_request( + collection_id=collection_id, + item_id=item_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4793,6 +21705,7 @@ def get_source(self, id: str, **kwargs: Any) -> _models.IngestionSource: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4810,9 +21723,9 @@ def get_source(self, id: str, **kwargs: Any) -> _models.IngestionSource: raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.IngestionSource, response.json()) + deserialized = _deserialize(List[str], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4820,108 +21733,125 @@ def get_source(self, id: str, **kwargs: Any) -> _models.IngestionSource: return deserialized # type: ignore @distributed_trace - def list_sources( - self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> ItemPaged["_models.IngestionSourceSummary"]: - """Get ingestion sources in a geo-catalog. - - :keyword top: The number of items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of IngestionSourceSummary - :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.IngestionSourceSummary] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.IngestionSourceSummary]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_ingestion_list_sources_request( - top=top, - skip=skip, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.IngestionSourceSummary], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + def get_item_asset_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + asset_band_indices: Optional[List[str]] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + asset_expression: Optional[List[str]] = None, + height: Optional[int] = None, + width: Optional[int] = None, + **kwargs: Any + ) -> _models.AssetStatisticsResponse: + """Item Asset Statistics. - def get_next(next_link=None): - _request = prepare_request(next_link) + Per asset statistics for a STAC item. - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. - return pipeline_response + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. - return ItemPaged(get_next, extract_data) + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). - @distributed_trace - def list_managed_identities(self, **kwargs: Any) -> ItemPaged["_models.ManagedIdentityMetadata"]: - """Get all managed identities with access to storage accounts configured for a geo-catalog. + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. - :return: An iterator like instance of ManagedIdentityMetadata - :rtype: ~azure.core.paging.ItemPaged[~azure.planetarycomputer.models.ManagedIdentityMetadata] + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword asset_expression: Per asset band expression. Default value is None. + :paramtype asset_expression: list[str] + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :return: AssetStatisticsResponse. The AssetStatisticsResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.AssetStatisticsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ManagedIdentityMetadata]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4930,133 +21860,200 @@ def list_managed_identities(self, **kwargs: Any) -> ItemPaged["_models.ManagedId } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_ingestion_list_managed_identities_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ManagedIdentityMetadata], deserialized.get("value", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + cls: ClsType[_models.AssetStatisticsResponse] = kwargs.pop("cls", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + _request = build_data_get_item_asset_statistics_request( + collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + asset_band_indices=asset_band_indices, + no_data=no_data, + unscale=unscale, + reproject=reproject, + resampling=resampling, + max_size=max_size, + categorical=categorical, + categories_pixels=categories_pixels, + percentiles=percentiles, + histogram_bins=histogram_bins, + histogram_range=histogram_range, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + asset_expression=asset_expression, + height=height, + width=width, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return pipeline_response + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - return ItemPaged(get_next, extract_data) + response = pipeline_response.http_response + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) -class StacOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AssetStatisticsResponse, response.json()) - Instead, you should access the following operations through - :class:`~azure.planetarycomputer.PlanetaryComputerProClient`'s - :attr:`stac` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PlanetaryComputerProClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore - @overload - def create_collection_asset( - self, collection_id: str, body: _models.StacAssetData, **kwargs: Any - ) -> _models.StacCollection: - """Create Collection Asset. + @distributed_trace + def list_item_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + **kwargs: Any + ) -> _models.TilerStacItemStatistics: + """Item Statistics. - Create a new asset in the Collection metadata and write the associated file to managed storage. + Merged assets statistics for a STAC item. - :param collection_id: STAC Collection ID. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Multi-part form data. Required. - :type body: ~azure.planetarycomputer.models.StacAssetData - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_collection_asset(self, collection_id: str, body: JSON, **kwargs: Any) -> _models.StacCollection: - """Create Collection Asset. + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). - Create a new asset in the Collection metadata and write the associated file to managed storage. + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param body: Multi-part form data. Required. - :type body: JSON - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. - @distributed_trace - def create_collection_asset( - self, collection_id: str, body: Union[_models.StacAssetData, JSON], **kwargs: Any - ) -> _models.StacCollection: - """Create Collection Asset. + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). - Create a new asset in the Collection metadata and write the associated file to managed storage. + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param body: Multi-part form data. Is either a StacAssetData type or a JSON type. Required. - :type body: ~azure.planetarycomputer.models.StacAssetData or JSON - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :return: TilerStacItemStatistics. The TilerStacItemStatistics is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerStacItemStatistics :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5070,17 +22067,38 @@ def create_collection_asset( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) - - _body = body.as_dict() if isinstance(body, _Model) else body - _file_fields: list[str] = ["file"] - _data_fields: list[str] = ["data"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + cls: ClsType[_models.TilerStacItemStatistics] = kwargs.pop("cls", None) - _request = build_stac_create_collection_asset_request( + _request = build_data_list_item_statistics_request( collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + resampling=resampling, + max_size=max_size, + categorical=categorical, + categories_pixels=categories_pixels, + percentiles=percentiles, + histogram_bins=histogram_bins, + histogram_range=histogram_range, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + algorithm=algorithm, + algorithm_params=algorithm_params, + height=height, + width=width, api_version=self._config.api_version, - files=_files, headers=_headers, params=_params, ) @@ -5089,6 +22107,7 @@ def create_collection_asset( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5096,7 +22115,7 @@ def create_collection_asset( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -5106,9 +22125,9 @@ def create_collection_asset( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.StacCollection, response.json()) + deserialized = _deserialize(_models.TilerStacItemStatistics, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5116,193 +22135,579 @@ def create_collection_asset( return deserialized # type: ignore @overload - def replace_collection_asset( - self, collection_id: str, asset_id: str, body: _models.StacAssetData, **kwargs: Any - ) -> _models.StacCollection: - """Update Collection Asset. + def get_item_geo_json_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacItemStatisticsGeoJson: + """Item Geojson Statistics. - Update an existing asset in a given collection. + Get statistics from a GeoJSON feature for a STAC item. - :param collection_id: STAC Collection ID. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param asset_id: STAC Asset ID. Required. - :type asset_id: str - :param body: Multi-part form data. Required. - :type body: ~azure.planetarycomputer.models.StacAssetData - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). - @overload - def replace_collection_asset( - self, collection_id: str, asset_id: str, body: JSON, **kwargs: Any - ) -> _models.StacCollection: - """Update Collection Asset. + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. - Update an existing asset in a given collection. + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param asset_id: STAC Asset ID. Required. - :type asset_id: str - :param body: Multi-part form data. Required. - :type body: JSON - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). + + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. + + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace - def replace_collection_asset( - self, collection_id: str, asset_id: str, body: Union[_models.StacAssetData, JSON], **kwargs: Any - ) -> _models.StacCollection: - """Update Collection Asset. + @overload + def get_item_geo_json_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacItemStatisticsGeoJson: + """Item Geojson Statistics. - Update an existing asset in a given collection. + Get statistics from a GeoJSON feature for a STAC item. - :param collection_id: STAC Collection ID. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param asset_id: STAC Asset ID. Required. - :type asset_id: str - :param body: Multi-part form data. Is either a StacAssetData type or a JSON type. Required. - :type body: ~azure.planetarycomputer.models.StacAssetData or JSON - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. - cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. - _body = body.as_dict() if isinstance(body, _Model) else body - _file_fields: list[str] = ["file"] - _data_fields: list[str] = ["data"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). - _request = build_stac_replace_collection_asset_request( - collection_id=collection_id, - asset_id=asset_id, - api_version=self._config.api_version, - files=_files, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson + :raises ~azure.core.exceptions.HttpResponseError: + """ - response = pipeline_response.http_response + @overload + def get_item_geo_json_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StacItemStatisticsGeoJson: + """Item Geojson Statistics. - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + Get statistics from a GeoJSON feature for a STAC item. - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacCollection, response.json()) + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. - return deserialized # type: ignore + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. - @distributed_trace - def delete_collection_asset(self, collection_id: str, asset_id: str, **kwargs: Any) -> _models.StacCollection: - """Delete Collection Asset. + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). - Delete an asset from a given collection. + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param asset_id: STAC Asset ID. Required. - :type asset_id: str - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) - - _request = build_stac_delete_collection_asset_request( - collection_id=collection_id, - asset_id=asset_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + @distributed_trace + def get_item_geo_json_statistics( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + categorical: Optional[bool] = None, + categories_pixels: Optional[List[int]] = None, + percentiles: Optional[List[int]] = None, + histogram_bins: Optional[str] = None, + histogram_range: Optional[str] = None, + destination_crs: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + algorithm: Optional[str] = None, + algorithm_params: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + **kwargs: Any + ) -> _models.StacItemStatisticsGeoJson: + """Item Geojson Statistics. - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + Get statistics from a GeoJSON feature for a STAC item. - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacCollection, response.json()) + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Maximum dimension in pixels for the source data used to calculate + statistics. Default value is None. + :paramtype max_size: int + :keyword categorical: Return statistics for categorical dataset. Default value is None. + :paramtype categorical: bool + :keyword categories_pixels: List of pixel categorical values for which to report counts. + Default value is None. + :paramtype categories_pixels: list[int] + :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. + :paramtype percentiles: list[int] + :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by + default). - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + If bins is a sequence (comma ``,`` delimited values), it defines a monotonically + increasing array of bin edges, including the rightmost edge, allowing for + non-uniform bin widths. - return deserialized # type: ignore + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_bins: str + :keyword histogram_range: Comma ``,`` delimited range of the bins. - @distributed_trace - def get_collection_configuration(self, collection_id: str, **kwargs: Any) -> _models.UserCollectionSettings: - """Get Config. + The lower and upper range of the bins. If not provided, range is simply + (a.min(), a.max()). - Get the complete user configuration for a given collection. + Values outside the range are ignored. The first element of the range must be + less than or equal to the second. + range affects the automatic bin computation as well. - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :return: UserCollectionSettings. The UserCollectionSettings is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.UserCollectionSettings + link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html + `_. Default value is + None. + :paramtype histogram_range: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword algorithm: Algorithm name. Default value is None. + :paramtype algorithm: str + :keyword algorithm_params: Algorithm parameter. Default value is None. + :paramtype algorithm_params: str + :keyword height: Force output image height. Default value is None. + :paramtype height: int + :keyword width: Force output image width. Default value is None. + :paramtype width: int + :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5313,14 +22718,53 @@ def get_collection_configuration(self, collection_id: str, **kwargs: Any) -> _mo } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.UserCollectionSettings] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StacItemStatisticsGeoJson] = kwargs.pop("cls", None) - _request = build_stac_get_collection_configuration_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_get_item_geo_json_statistics_request( collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, + max_size=max_size, + categorical=categorical, + categories_pixels=categories_pixels, + percentiles=percentiles, + histogram_bins=histogram_bins, + histogram_range=histogram_range, + destination_crs=destination_crs, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + algorithm=algorithm, + algorithm_params=algorithm_params, + height=height, + width=width, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -5329,6 +22773,7 @@ def get_collection_configuration(self, collection_id: str, **kwargs: Any) -> _mo } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5346,90 +22791,183 @@ def get_collection_configuration(self, collection_id: str, **kwargs: Any) -> _mo raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.UserCollectionSettings, response.json()) + deserialized = _deserialize(_models.StacItemStatisticsGeoJson, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def add_mosaic( - self, collection_id: str, body: _models.StacMosaic, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacMosaic: - """Add Collection Mosaic. - - Add a mosaic definition to a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Mosaic definition to be created or updated. Required. - :type body: ~azure.planetarycomputer.models.StacMosaic - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacMosaic. The StacMosaic is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacMosaic - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def add_mosaic( - self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacMosaic: - """Add Collection Mosaic. - - Add a mosaic definition to a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Mosaic definition to be created or updated. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacMosaic. The StacMosaic is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacMosaic - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def add_mosaic( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacMosaic: - """Add Collection Mosaic. - - Add a mosaic definition to a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Mosaic definition to be created or updated. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: StacMosaic. The StacMosaic is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacMosaic - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def add_mosaic( - self, collection_id: str, body: Union[_models.StacMosaic, JSON, IO[bytes]], **kwargs: Any - ) -> _models.StacMosaic: - """Add Collection Mosaic. + def get_item_tile_json( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileJsonMetadata: + """Item TileJson. - Add a mosaic definition to a given collection. + Return TileJSON document for a STAC item. - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Mosaic definition to be created or updated. Is one of the following types: - StacMosaic, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.StacMosaic or JSON or IO[bytes] - :return: StacMosaic. The StacMosaic is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacMosaic + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5440,24 +22978,45 @@ def add_mosaic( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StacMosaic] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) - _request = build_stac_add_mosaic_request( + _request = build_data_get_item_tile_json_request( collection_id=collection_id, - content_type=content_type, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -5466,6 +23025,7 @@ def add_mosaic( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5473,7 +23033,7 @@ def add_mosaic( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -5483,110 +23043,178 @@ def add_mosaic( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.StacMosaic, response.json()) + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def replace_mosaic( - self, - collection_id: str, - mosaic_id: str, - body: _models.StacMosaic, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.StacMosaic: - """Update Collection Mosaic. - - Update a mosaic definition from a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param mosaic_id: Unique identifier for the mosaic configuration. Required. - :type mosaic_id: str - :param body: Mosaic definition to be created or updated. Required. - :type body: ~azure.planetarycomputer.models.StacMosaic - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacMosaic. The StacMosaic is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacMosaic - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_mosaic( - self, collection_id: str, mosaic_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacMosaic: - """Update Collection Mosaic. - - Update a mosaic definition from a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param mosaic_id: Unique identifier for the mosaic configuration. Required. - :type mosaic_id: str - :param body: Mosaic definition to be created or updated. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacMosaic. The StacMosaic is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacMosaic - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_mosaic( + @distributed_trace + def get_item_tile_json_tms( # pylint: disable=too-many-locals self, collection_id: str, - mosaic_id: str, - body: IO[bytes], + item_id: str, + tile_matrix_set_id: str, *, - content_type: str = "application/json", + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any - ) -> _models.StacMosaic: - """Update Collection Mosaic. - - Update a mosaic definition from a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param mosaic_id: Unique identifier for the mosaic configuration. Required. - :type mosaic_id: str - :param body: Mosaic definition to be created or updated. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: StacMosaic. The StacMosaic is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacMosaic - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def replace_mosaic( - self, collection_id: str, mosaic_id: str, body: Union[_models.StacMosaic, JSON, IO[bytes]], **kwargs: Any - ) -> _models.StacMosaic: - """Update Collection Mosaic. + ) -> _models.TileJsonMetadata: + """Item TileJson Tilematrixsetid As Path. - Update a mosaic definition from a given collection. + Return TileJSON document for a STAC item with TileMatrixSetId as path. - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param mosaic_id: Unique identifier for the mosaic configuration. Required. - :type mosaic_id: str - :param body: Mosaic definition to be created or updated. Is one of the following types: - StacMosaic, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.StacMosaic or JSON or IO[bytes] - :return: StacMosaic. The StacMosaic is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacMosaic + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5597,25 +23225,45 @@ def replace_mosaic( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StacMosaic] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) - _request = build_stac_replace_mosaic_request( + _request = build_data_get_item_tile_json_tms_request( collection_id=collection_id, - mosaic_id=mosaic_id, - content_type=content_type, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -5624,6 +23272,7 @@ def replace_mosaic( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5641,9 +23290,9 @@ def replace_mosaic( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.StacMosaic, response.json()) + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5651,72 +23300,171 @@ def replace_mosaic( return deserialized # type: ignore @distributed_trace - def delete_mosaic( # pylint: disable=inconsistent-return-statements - self, collection_id: str, mosaic_id: str, **kwargs: Any - ) -> None: - """Delete Collection Mosaic. - - Delete a mosaic definition from a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param mosaic_id: Unique identifier for the mosaic configuration. Required. - :type mosaic_id: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_stac_delete_mosaic_request( - collection_id=collection_id, - mosaic_id=mosaic_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_mosaic(self, collection_id: str, mosaic_id: str, **kwargs: Any) -> _models.StacMosaic: - """Get Collection Mosaic. + def get_item_wmts_capabilities( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Item Wmts. - Get a mosaic definition from a given collection. + OGC WMTS endpoint for a STAC item. - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param mosaic_id: Unique identifier for the mosaic configuration. Required. - :type mosaic_id: str - :return: StacMosaic. The StacMosaic is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacMosaic + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5730,11 +23478,41 @@ def get_mosaic(self, collection_id: str, mosaic_id: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacMosaic] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_get_mosaic_request( + _request = build_data_get_item_wmts_capabilities_request( collection_id=collection_id, - mosaic_id=mosaic_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5744,7 +23522,8 @@ def get_mosaic(self, collection_id: str, mosaic_id: str, **kwargs: Any) -> _mode } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5760,26 +23539,177 @@ def get_mosaic(self, collection_id: str, mosaic_id: str, **kwargs: Any) -> _mode map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacMosaic, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_mosaics(self, collection_id: str, **kwargs: Any) -> List[_models.StacMosaic]: - """Get Collection Mosaics. + def get_item_wmts_capabilities_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + tile_matrix_set_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Item Wmts Tilematrixsetid As Path. - Get the mosaic definitions for a given collection. + OGC WMTS endpoint for a STAC item with TileMatrixSetId as path. - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :return: list of StacMosaic - :rtype: list[~azure.planetarycomputer.models.StacMosaic] + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5793,10 +23723,41 @@ def list_mosaics(self, collection_id: str, **kwargs: Any) -> List[_models.StacMo _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.StacMosaic]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_list_mosaics_request( + _request = build_data_get_item_wmts_capabilities_tms_request( collection_id=collection_id, + item_id=item_id, + tile_matrix_set_id=tile_matrix_set_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + resampling=resampling, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5806,7 +23767,8 @@ def list_mosaics(self, collection_id: str, **kwargs: Any) -> List[_models.StacMo } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5822,19 +23784,104 @@ def list_mosaics(self, collection_id: str, **kwargs: Any) -> List[_models.StacMo map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.StacMosaic], response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _create_collection_initial( - self, body: Union[_models.StacCollection, JSON, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: + @distributed_trace + def get_item_point( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + longitude: float, + latitude: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + **kwargs: Any + ) -> _models.TilerCoreModelsResponsesPoint: + """Item Point. + + Get point value for a STAC item dataset. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :return: TilerCoreModelsResponsesPoint. The TilerCoreModelsResponsesPoint is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerCoreModelsResponsesPoint + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5843,23 +23890,34 @@ def _create_collection_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.TilerCoreModelsResponsesPoint] = kwargs.pop("cls", None) - _request = build_stac_create_collection_request( - content_type=content_type, + _request = build_data_get_item_point_request( + collection_id=collection_id, + item_id=item_id, + longitude=longitude, + latitude=latitude, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, + resampling=resampling, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -5868,216 +23926,422 @@ def _create_collection_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerCoreModelsResponsesPoint, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_create_collection( - self, body: _models.StacCollection, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create Collection. - - Create a new collection in the GeoCatalog instance. - - :param body: Request collection body. Required. - :type body: ~azure.planetarycomputer.models.StacCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_collection( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create Collection. - - Create a new collection in the GeoCatalog instance. - - :param body: Request collection body. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_collection( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create Collection. - - Create a new collection in the GeoCatalog instance. - - :param body: Request collection body. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_create_collection( - self, body: Union[_models.StacCollection, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Create Collection. + def get_item_preview( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + color_formula: Optional[str] = None, + dst_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Item Preview. - Create a new collection in the GeoCatalog instance. + Create preview of a STAC item dataset. - :param body: Request collection body. Is one of the following types: StacCollection, JSON, - IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.StacCollection or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword dst_crs: Output Coordinate Reference System. Default value is None. + :paramtype dst_crs: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_collection_initial( - body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_item_preview_request( + collection_id=collection_id, + item_id=item_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + color_formula=color_formula, + dst_crs=dst_crs, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def create_or_replace_collection( - self, collection_id: str, body: _models.StacCollection, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacCollection: - """Create or update Collection. - - Create or replace a collection in the GeoCatalog instance. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: Request collection body. Required. - :type body: ~azure.planetarycomputer.models.StacCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - @overload - def create_or_replace_collection( - self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacCollection: - """Create or update Collection. + response = pipeline_response.http_response - Create or replace a collection in the GeoCatalog instance. + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: Request collection body. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - @overload - def create_or_replace_collection( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacCollection: - """Create or update Collection. + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - Create or replace a collection in the GeoCatalog instance. + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: Request collection body. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore @distributed_trace - def create_or_replace_collection( - self, collection_id: str, body: Union[_models.StacCollection, JSON, IO[bytes]], **kwargs: Any - ) -> _models.StacCollection: - """Create or update Collection. + def get_item_preview_with_format( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + dst_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Item Preview With Format. - Create or replace a collection in the GeoCatalog instance. + Create preview of a STAC item dataset with format. - :param collection_id: Catalog collection id. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Request collection body. Is one of the following types: StacCollection, JSON, - IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.StacCollection or JSON or IO[bytes] - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword dst_crs: Output Coordinate Reference System. Default value is None. + :paramtype dst_crs: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6086,26 +24350,45 @@ def create_or_replace_collection( 409: ResourceExistsError, 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_stac_create_or_replace_collection_request( + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_item_preview_with_format_request( collection_id=collection_id, - content_type=content_type, + item_id=item_id, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + dst_crs=dst_crs, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6114,7 +24397,8 @@ def create_or_replace_collection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6130,17 +24414,190 @@ def create_or_replace_collection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacCollection, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _delete_collection_initial(self, collection_id: str, **kwargs: Any) -> Iterator[bytes]: + @distributed_trace + def get_item_bbox_crop( # pylint: disable=too-many-locals + self, + collection_id: str, + item_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Item Bbox. + + Create an image from part of a STAC item dataset (bounding box crop). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6154,8 +24611,42 @@ def _delete_collection_initial(self, collection_id: str, **kwargs: Any) -> Itera cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_delete_collection_request( + _request = build_data_get_item_bbox_crop_request( collection_id=collection_id, + item_id=item_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + resampling=resampling, + max_size=max_size, + height=height, + width=width, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6165,105 +24656,205 @@ def _delete_collection_initial(self, collection_id: str, **kwargs: Any) -> Itera } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_collection(self, collection_id: str, **kwargs: Any) -> LROPoller[None]: - """Delete Collection. - - Delete a collection in the GeoCatalog instance. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_collection_initial( - collection_id=collection_id, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get_collection( + def get_item_bbox_crop_with_dimensions( # pylint: disable=too-many-locals self, collection_id: str, + item_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + width: int, + height: int, + format: str, *, - sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, - duration_in_minutes: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + color_formula: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + max_size: Optional[int] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any - ) -> _models.StacCollection: - """Get Collection. + ) -> Iterator[bytes]: + """Item Bbox With Dimensions. - Get a collection in the GeoCatalog instance. + Create an image from part of a STAC item dataset (bounding box crop with dimensions). - :param collection_id: Catalog collection id. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and - "false". Default value is None. - :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode - :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. - :paramtype duration_in_minutes: int - :return: StacCollection. The StacCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCollection + :param item_id: STAC Item Identifier. Required. + :type item_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param width: Force output image width. Required. + :type width: int + :param height: Force output image height. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6277,12 +24868,44 @@ def get_collection( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_get_collection_request( + _request = build_data_get_item_bbox_crop_with_dimensions_request( collection_id=collection_id, - sign=sign, - duration_in_minutes=duration_in_minutes, + item_id=item_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + width=width, + height=height, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + algorithm=algorithm, + algorithm_params=algorithm_params, + color_formula=color_formula, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + resampling=resampling, + max_size=max_size, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6292,7 +24915,8 @@ def get_collection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6308,35 +24932,75 @@ def get_collection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacCollection, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_collections( + def list_collection_tilesets( # pylint: disable=too-many-locals self, + collection_id: str, *, - sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, - duration_in_minutes: Optional[int] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any - ) -> _models.StacCatalogCollections: - """Get Collections. + ) -> _models.TileSetList: + """Collection Tileset List. - List all collections in the GeoCatalog instance. + Return a list of available tilesets for a STAC collection. - :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and - "false". Default value is None. - :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode - :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. - :paramtype duration_in_minutes: int - :return: StacCatalogCollections. The StacCatalogCollections is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacCatalogCollections + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetList. The TileSetList is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetList :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6350,11 +25014,21 @@ def get_collections( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacCatalogCollections] = kwargs.pop("cls", None) + cls: ClsType[_models.TileSetList] = kwargs.pop("cls", None) - _request = build_stac_get_collections_request( - sign=sign, - duration_in_minutes=duration_in_minutes, + _request = build_data_list_collection_tilesets_request( + collection_id=collection_id, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6364,6 +25038,7 @@ def get_collections( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6381,9 +25056,9 @@ def get_collections( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.StacCatalogCollections, response.json()) + deserialized = _deserialize(_models.TileSetList, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6391,15 +25066,61 @@ def get_collections( return deserialized # type: ignore @distributed_trace - def get_partition_type(self, collection_id: str, **kwargs: Any) -> _models.PartitionType: - """Get Partitiontype. + def get_collection_tileset_metadata( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + **kwargs: Any + ) -> _models.TileSetMetadata: + """Collection Tileset Metadata. - Get the partitiontype for a GeoCatalog Collection. + Return metadata for a specific tileset of a STAC collection. - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :return: PartitionType. The PartitionType is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.PartitionType + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetMetadata. The TileSetMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetMetadata :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6413,10 +25134,22 @@ def get_partition_type(self, collection_id: str, **kwargs: Any) -> _models.Parti _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.PartitionType] = kwargs.pop("cls", None) + cls: ClsType[_models.TileSetMetadata] = kwargs.pop("cls", None) - _request = build_stac_get_partition_type_request( + _request = build_data_get_collection_tileset_metadata_request( collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6426,6 +25159,7 @@ def get_partition_type(self, collection_id: str, **kwargs: Any) -> _models.Parti } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6443,117 +25177,216 @@ def get_partition_type(self, collection_id: str, **kwargs: Any) -> _models.Parti raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PartitionType, response.json()) + deserialized = _deserialize(_models.TileSetMetadata, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def replace_partition_type( - self, collection_id: str, body: _models.PartitionType, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Create Partitiontype. - - Updates partition type for a GeoCatalog Collection. This will - determine the partitioning scheme for items within the database, - and can only be set before any items are loaded. - - Ideal partitioning schemes result in partitions of roughly 100k items each. - - The default partitioning scheme is "none" which does not partition items. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Partition type configuration determining how items are partitioned in storage. - Required. - :type body: ~azure.planetarycomputer.models.PartitionType - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_partition_type( - self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Create Partitiontype. - - Updates partition type for a GeoCatalog Collection. This will - determine the partitioning scheme for items within the database, - and can only be set before any items are loaded. - - Ideal partitioning schemes result in partitions of roughly 100k items each. - - The default partitioning scheme is "none" which does not partition items. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Partition type configuration determining how items are partitioned in storage. - Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_partition_type( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Create Partitiontype. - - Updates partition type for a GeoCatalog Collection. This will - determine the partitioning scheme for items within the database, - and can only be set before any items are loaded. - - Ideal partitioning schemes result in partitions of roughly 100k items each. - - The default partitioning scheme is "none" which does not partition items. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Partition type configuration determining how items are partitioned in storage. - Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def replace_partition_type( # pylint: disable=inconsistent-return-statements - self, collection_id: str, body: Union[_models.PartitionType, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """Create Partitiontype. - - Updates partition type for a GeoCatalog Collection. This will - determine the partitioning scheme for items within the database, - and can only be set before any items are loaded. - - Ideal partitioning schemes result in partitions of roughly 100k items each. + def get_collection_tile_by_scale_and_format( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Tile Tilematrixsetid. - The default partitioning scheme is "none" which does not partition items. + Create map tile for a STAC collection (with TileMatrixSetId, scale, and format in path). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Partition type configuration determining how items are partitioned in storage. Is - one of the following types: PartitionType, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.PartitionType or JSON or IO[bytes] - :return: None - :rtype: None + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6564,24 +25397,55 @@ def replace_partition_type( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_replace_partition_type_request( + _request = build_data_get_collection_tile_by_scale_and_format_request( collection_id=collection_id, - content_type=content_type, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6590,7 +25454,8 @@ def replace_partition_type( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6598,87 +25463,233 @@ def replace_partition_type( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_render_option( - self, collection_id: str, body: _models.RenderOption, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RenderOption: - """Add Collection Render Option. - - Add a render option for a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Render option configuration to be created or updated. Required. - :type body: ~azure.planetarycomputer.models.RenderOption - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RenderOption. The RenderOption is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.RenderOption - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_render_option( - self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RenderOption: - """Add Collection Render Option. - - Add a render option for a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Render option configuration to be created or updated. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RenderOption. The RenderOption is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.RenderOption - :raises ~azure.core.exceptions.HttpResponseError: - """ + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - @overload - def create_render_option( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RenderOption: - """Add Collection Render Option. + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - Add a render option for a given collection. + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Render option configuration to be created or updated. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RenderOption. The RenderOption is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.RenderOption - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore @distributed_trace - def create_render_option( - self, collection_id: str, body: Union[_models.RenderOption, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RenderOption: - """Add Collection Render Option. + def get_collection_tile( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Tile Tilematrixsetid Plain. - Add a render option for a given collection. + Create map tile for a STAC collection (with TileMatrixSetId, without scale or format). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Render option configuration to be created or updated. Is one of the following - types: RenderOption, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.RenderOption or JSON or IO[bytes] - :return: RenderOption. The RenderOption is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.RenderOption + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6689,24 +25700,55 @@ def create_render_option( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RenderOption] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_create_render_option_request( + _request = build_data_get_collection_tile_request( collection_id=collection_id, - content_type=content_type, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6715,14 +25757,15 @@ def create_render_option( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -6731,121 +25774,224 @@ def create_render_option( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RenderOption, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def replace_render_option( - self, - collection_id: str, - render_option_id: str, - body: _models.RenderOption, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RenderOption: - """Update Collection Render Option. - - Update a render option for a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param render_option_id: Unique identifier for the render option. Required. - :type render_option_id: str - :param body: Render option configuration to be created or updated. Required. - :type body: ~azure.planetarycomputer.models.RenderOption - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RenderOption. The RenderOption is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.RenderOption - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_render_option( - self, - collection_id: str, - render_option_id: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RenderOption: - """Update Collection Render Option. - - Update a render option for a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param render_option_id: Unique identifier for the render option. Required. - :type render_option_id: str - :param body: Render option configuration to be created or updated. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RenderOption. The RenderOption is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.RenderOption - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_render_option( - self, - collection_id: str, - render_option_id: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RenderOption: - """Update Collection Render Option. - - Update a render option for a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param render_option_id: Unique identifier for the render option. Required. - :type render_option_id: str - :param body: Render option configuration to be created or updated. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RenderOption. The RenderOption is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.RenderOption - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def replace_render_option( + def get_collection_tile_by_format( # pylint: disable=too-many-locals self, collection_id: str, - render_option_id: str, - body: Union[_models.RenderOption, JSON, IO[bytes]], + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> _models.RenderOption: - """Update Collection Render Option. + ) -> Iterator[bytes]: + """Collection Tile Tilematrixsetid Format. - Update a render option for a given collection. + Create map tile for a STAC collection (with TileMatrixSetId and format, without scale). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param render_option_id: Unique identifier for the render option. Required. - :type render_option_id: str - :param body: Render option configuration to be created or updated. Is one of the following - types: RenderOption, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.RenderOption or JSON or IO[bytes] - :return: RenderOption. The RenderOption is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.RenderOption + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6856,25 +26002,55 @@ def replace_render_option( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RenderOption] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_replace_render_option_request( + _request = build_data_get_collection_tile_by_format_request( collection_id=collection_id, - render_option_id=render_option_id, - content_type=content_type, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6883,7 +26059,8 @@ def replace_render_option( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6899,30 +26076,224 @@ def replace_render_option( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RenderOption, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete_render_option( # pylint: disable=inconsistent-return-statements - self, collection_id: str, render_option_id: str, **kwargs: Any - ) -> None: - """Delete Collection Render Option. + def get_collection_tile_by_scale( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Tile Tilematrixsetid Scale. - Delete a render option for a given collection. + Create map tile for a STAC collection (with TileMatrixSetId and scale, without format). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param render_option_id: Unique identifier for the render option. Required. - :type render_option_id: str - :return: None - :rtype: None + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6936,11 +26307,51 @@ def delete_render_option( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_delete_render_option_request( + _request = build_data_get_collection_tile_by_scale_request( collection_id=collection_id, - render_option_id=render_option_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6950,7 +26361,8 @@ def delete_render_option( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -6958,24 +26370,238 @@ def delete_render_option( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get_render_option(self, collection_id: str, render_option_id: str, **kwargs: Any) -> _models.RenderOption: - """Get Collection Render Option. + def get_collection_tile_no_tms_by_scale_and_format( # pylint: disable=name-too-long,too-many-locals + self, + collection_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Tile. - Get a render option for a given collection. + Create map tile for a STAC collection (without TileMatrixSetId, with scale and format). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param render_option_id: Unique identifier for the render option. Required. - :type render_option_id: str - :return: RenderOption. The RenderOption is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.RenderOption + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles (default: + "1"). Required. + :type scale: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp) (default: "png"). + Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6989,11 +26615,51 @@ def get_render_option(self, collection_id: str, render_option_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RenderOption] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_get_render_option_request( + _request = build_data_get_collection_tile_no_tms_by_scale_and_format_request( collection_id=collection_id, - render_option_id=render_option_id, + z=z, + x=x, + y=y, + scale=scale, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7003,7 +26669,8 @@ def get_render_option(self, collection_id: str, render_option_id: str, **kwargs: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7019,26 +26686,230 @@ def get_render_option(self, collection_id: str, render_option_id: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.RenderOption, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_render_options(self, collection_id: str, **kwargs: Any) -> List[_models.RenderOption]: - """Get Collection Render Options. + def get_collection_tile_no_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + z: float, + x: float, + y: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Tile Plain. - Get all render options for a given collection. + Create map tile for a STAC collection (without TileMatrixSetId, scale, or format). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :return: list of RenderOption - :rtype: list[~azure.planetarycomputer.models.RenderOption] + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7052,10 +26923,51 @@ def list_render_options(self, collection_id: str, **kwargs: Any) -> List[_models _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RenderOption]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_list_render_options_request( + _request = build_data_get_collection_tile_no_tms_request( collection_id=collection_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7065,7 +26977,8 @@ def list_render_options(self, collection_id: str, **kwargs: Any) -> List[_models } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7081,24 +26994,227 @@ def list_render_options(self, collection_id: str, **kwargs: Any) -> List[_models map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.RenderOption], response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_collection_thumbnail(self, collection_id: str, **kwargs: Any) -> Iterator[bytes]: - """Get Collection Thumbnail. + def get_collection_tile_no_tms_by_format( # pylint: disable=too-many-locals + self, + collection_id: str, + z: float, + x: float, + y: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Tile Format. - Get thumbnail for given collection. + Create map tile for a STAC collection (with format, without TileMatrixSetId or scale). - :param collection_id: STAC Collection ID. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -7116,8 +27232,49 @@ def get_collection_thumbnail(self, collection_id: str, **kwargs: Any) -> Iterato cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_get_collection_thumbnail_request( + _request = build_data_get_collection_tile_no_tms_by_format_request( collection_id=collection_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7127,6 +27284,7 @@ def get_collection_thumbnail(self, collection_id: str, **kwargs: Any) -> Iterato } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7152,7 +27310,7 @@ def get_collection_thumbnail(self, collection_id: str, **kwargs: Any) -> Iterato response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -7160,142 +27318,212 @@ def get_collection_thumbnail(self, collection_id: str, **kwargs: Any) -> Iterato return deserialized # type: ignore @distributed_trace - def get_tile_settings(self, collection_id: str, **kwargs: Any) -> _models.TileSettings: - """Get Collection Tile Settings. - - Get the tile settings for a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :return: TileSettings. The TileSettings is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileSettings - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TileSettings] = kwargs.pop("cls", None) - - _request = build_stac_get_tile_settings_request( - collection_id=collection_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TileSettings, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def replace_tile_settings( - self, collection_id: str, body: _models.TileSettings, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TileSettings: - """Update Collection Tile Settings. - - Update the tile settings for a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Tile settings configuration to be updated. Required. - :type body: ~azure.planetarycomputer.models.TileSettings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TileSettings. The TileSettings is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileSettings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_tile_settings( - self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TileSettings: - """Update Collection Tile Settings. - - Update the tile settings for a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Tile settings configuration to be updated. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TileSettings. The TileSettings is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileSettings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def replace_tile_settings( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TileSettings: - """Update Collection Tile Settings. - - Update the tile settings for a given collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param body: Tile settings configuration to be updated. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TileSettings. The TileSettings is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileSettings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def replace_tile_settings( - self, collection_id: str, body: Union[_models.TileSettings, JSON, IO[bytes]], **kwargs: Any - ) -> _models.TileSettings: - """Update Collection Tile Settings. + def get_collection_tile_no_tms_by_scale( # pylint: disable=too-many-locals + self, + collection_id: str, + z: float, + x: float, + y: float, + scale: float, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Tile Scale. - Update the tile settings for a given collection. + Create map tile for a STAC collection (with scale, without TileMatrixSetId or format). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Tile settings configuration to be updated. Is one of the following types: - TileSettings, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.TileSettings or JSON or IO[bytes] - :return: TileSettings. The TileSettings is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileSettings + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7306,24 +27534,55 @@ def replace_tile_settings( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TileSettings] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_replace_tile_settings_request( + _request = build_data_get_collection_tile_no_tms_by_scale_request( collection_id=collection_id, - content_type=content_type, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -7332,7 +27591,8 @@ def replace_tile_settings( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7348,24 +27608,226 @@ def replace_tile_settings( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TileSettings, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_conformance_class(self, **kwargs: Any) -> _models.StacConformanceClasses: - """Conformance Classes. + def get_collection_tile_json( # pylint: disable=too-many-locals + self, + collection_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> _models.TileJsonMetadata: + """Collection TileJson. - Returns the STAC conformance classes. + Return TileJSON document for a STAC collection. - :return: StacConformanceClasses. The StacConformanceClasses is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacConformanceClasses + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7379,9 +27841,50 @@ def get_conformance_class(self, **kwargs: Any) -> _models.StacConformanceClasses _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacConformanceClasses] = kwargs.pop("cls", None) + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) - _request = build_stac_get_conformance_class_request( + _request = build_data_get_collection_tile_json_request( + collection_id=collection_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7391,6 +27894,7 @@ def get_conformance_class(self, **kwargs: Any) -> _models.StacConformanceClasses } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7408,9 +27912,9 @@ def get_conformance_class(self, **kwargs: Any) -> _models.StacConformanceClasses raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.StacConformanceClasses, response.json()) + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7418,13 +27922,204 @@ def get_conformance_class(self, **kwargs: Any) -> _models.StacConformanceClasses return deserialized # type: ignore @distributed_trace - def get_landing_page(self, **kwargs: Any) -> _models.StacLandingPage: - """Landing Page. + def get_collection_tile_json_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, + **kwargs: Any + ) -> _models.TileJsonMetadata: + """Collection TileJson Tilematrixsetid As Path. - Return the STAC landing page. + Return TileJSON document for a STAC collection with TileMatrixSetId as path. - :return: StacLandingPage. The StacLandingPage is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacLandingPage + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7438,9 +28133,50 @@ def get_landing_page(self, **kwargs: Any) -> _models.StacLandingPage: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacLandingPage] = kwargs.pop("cls", None) + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) - _request = build_stac_get_landing_page_request( + _request = build_data_get_collection_tile_json_tms_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7450,6 +28186,7 @@ def get_landing_page(self, **kwargs: Any) -> _models.StacLandingPage: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7467,18 +28204,98 @@ def get_landing_page(self, **kwargs: Any) -> _models.StacLandingPage: raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.StacLandingPage, response.json()) + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_item_initial( - self, collection_id: str, body: Union[_models.StacItemOrStacItemCollection, JSON, IO[bytes]], **kwargs: Any + @distributed_trace + def get_collection_wmts_capabilities( # pylint: disable=too-many-locals + self, + collection_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any ) -> Iterator[bytes]: + """Collection Wmts. + + OGC WMTS endpoint for a STAC collection. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7487,24 +28304,32 @@ def _create_item_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_stac_create_item_request( + _request = build_data_get_collection_wmts_capabilities_request( collection_id=collection_id, - content_type=content_type, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -7513,202 +28338,111 @@ def _create_item_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_item( - self, - collection_id: str, - body: _models.StacItemOrStacItemCollection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create a new STAC item or a set of items in a collection. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: STAC Item or StacItemCollection - - Represents a STAC Item or StacItemCollection as defined by the STAC 1.0.0 standard. - - **Item**: A GeoJSON Feature that represents a single spatiotemporal asset. - It includes metadata such as geometry, datetime, and links to related assets. - Example: A satellite image with its metadata. - - **StacItemCollection**: A GeoJSON FeatureCollection that contains multiple Items. - It is used to group multiple related Items together, such as a collection of satellite images. - - This union allows the request body to accept either a single Item or a collection of Items. - Required. - :type body: ~azure.planetarycomputer.models.StacItemOrStacItemCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_item( - self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create a new STAC item or a set of items in a collection. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: STAC Item or StacItemCollection - - Represents a STAC Item or StacItemCollection as defined by the STAC 1.0.0 standard. - - **Item**: A GeoJSON Feature that represents a single spatiotemporal asset. - It includes metadata such as geometry, datetime, and links to related assets. - Example: A satellite image with its metadata. - - **StacItemCollection**: A GeoJSON FeatureCollection that contains multiple Items. - It is used to group multiple related Items together, such as a collection of satellite images. - - This union allows the request body to accept either a single Item or a collection of Items. - Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_item( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create a new STAC item or a set of items in a collection. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: STAC Item or StacItemCollection - - Represents a STAC Item or StacItemCollection as defined by the STAC 1.0.0 standard. - - **Item**: A GeoJSON Feature that represents a single spatiotemporal asset. - It includes metadata such as geometry, datetime, and links to related assets. - Example: A satellite image with its metadata. - - **StacItemCollection**: A GeoJSON FeatureCollection that contains multiple Items. - It is used to group multiple related Items together, such as a collection of satellite images. - - This union allows the request body to accept either a single Item or a collection of Items. - Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_item( - self, collection_id: str, body: Union[_models.StacItemOrStacItemCollection, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Create a new STAC item or a set of items in a collection. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param body: STAC Item or StacItemCollection - - Represents a STAC Item or StacItemCollection as defined by the STAC 1.0.0 standard. - - **Item**: A GeoJSON Feature that represents a single spatiotemporal asset. - It includes metadata such as geometry, datetime, and links to related assets. - Example: A satellite image with its metadata. - - **StacItemCollection**: A GeoJSON FeatureCollection that contains multiple Items. - It is used to group multiple related Items together, such as a collection of satellite images. - - This union allows the request body to accept either a single Item or a collection of Items. Is - one of the following types: StacItemOrStacItemCollection, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.StacItemOrStacItemCollection or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_item_initial( - collection_id=collection_id, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - def _create_or_replace_item_initial( - self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_collection_wmts_capabilities_tms( # pylint: disable=too-many-locals + self, + collection_id: str, + tile_matrix_set_id: str, + *, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any ) -> Iterator[bytes]: + """Collection Wmts Tilematrixsetid As Path. + + OGC WMTS endpoint for a STAC collection with TileMatrixSetId as path. + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7717,25 +28451,32 @@ def _create_or_replace_item_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_stac_create_or_replace_item_request( + _request = build_data_get_collection_wmts_capabilities_tms_request( collection_id=collection_id, - item_id=item_id, - content_type=content_type, + tile_matrix_set_id=tile_matrix_set_id, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -7744,168 +28485,293 @@ def _create_or_replace_item_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def begin_create_or_replace_item( + @distributed_trace + def get_collection_assets_for_tile( # pylint: disable=too-many-locals self, collection_id: str, - item_id: str, - body: _models.StacItem, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, *, - content_type: str = "application/json", + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Create or replace a STAC item in a collection. + ) -> List[_models.TilerAssetGeoJson]: + """Collection Assets For Tile Tilematrixsetid As Path. - :param collection_id: Catalog collection id. Required. + Return a list of assets which overlap a given tile for a STAC collection (with + TileMatrixSetId). + + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :param body: STAC Item. Required. - :type body: ~azure.planetarycomputer.models.StacItem - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: list of TilerAssetGeoJson + :rtype: list[~azure.planetarycomputer.models.TilerAssetGeoJson] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def begin_create_or_replace_item( - self, collection_id: str, item_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Create or replace a STAC item in a collection. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :param body: STAC Item. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + cls: ClsType[List[_models.TilerAssetGeoJson]] = kwargs.pop("cls", None) + + _request = build_data_get_collection_assets_for_tile_request( + collection_id=collection_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - @overload - def begin_create_or_replace_item( + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.TilerAssetGeoJson], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_collection_assets_for_tile_no_tms( # pylint: disable=too-many-locals self, collection_id: str, - item_id: str, - body: IO[bytes], + z: float, + x: float, + y: float, *, - content_type: str = "application/json", + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, **kwargs: Any - ) -> LROPoller[None]: - """Create or replace a STAC item in a collection. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :param body: STAC Item. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> List[Any]: + """Collection Assets For Tile. - @distributed_trace - def begin_create_or_replace_item( - self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Create or replace a STAC item in a collection. + Return a list of assets which overlap a given tile for a STAC collection (without + TileMatrixSetId). - :param collection_id: Catalog collection id. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :param body: STAC Item. Is one of the following types: StacItem, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.StacItem or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :return: list of any + :rtype: list[any] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_replace_item_initial( - collection_id=collection_id, - item_id=item_id, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _delete_item_initial(self, collection_id: str, item_id: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7917,11 +28783,30 @@ def _delete_item_initial(self, collection_id: str, item_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[Any]] = kwargs.pop("cls", None) - _request = build_stac_delete_item_request( + _request = build_data_get_collection_assets_for_tile_no_tms_request( collection_id=collection_id, - item_id=item_id, + z=z, + x=x, + y=y, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + tile_matrix_set_id=tile_matrix_set_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7931,98 +28816,208 @@ def _delete_item_initial(self, collection_id: str, item_id: str, **kwargs: Any) } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[Any], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete_item(self, collection_id: str, item_id: str, **kwargs: Any) -> LROPoller[None]: - """Delete a STAC item from a collection. + def get_collection_assets_for_bbox( # pylint: disable=too-many-locals + self, + collection_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any + ) -> List[Any]: + """Collection Assets For Bbox. - :param collection_id: Catalog collection id. Required. + Return a list of assets which overlap a given bounding box for a STAC collection. + + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :return: list of any + :rtype: list[any] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_item_initial( - collection_id=collection_id, - item_id=item_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + cls: ClsType[List[Any]] = kwargs.pop("cls", None) + _request = build_data_get_collection_assets_for_bbox_request( + collection_id=collection_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + deserialized = _deserialize(List[Any], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get_item(self, collection_id: str, item_id: str, **kwargs: Any) -> _models.StacItem: - """Fetch a single STAC Item. + def get_collection_info(self, collection_id: str, **kwargs: Any) -> _models.TilerStacSearchRegistration: + """Collection Info. - :param collection_id: Catalog collection id. Required. + Return search query info from a STAC collection identifier. + + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :return: StacItem. The StacItem is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItem + :return: TilerStacSearchRegistration. The TilerStacSearchRegistration is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerStacSearchRegistration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8036,11 +29031,10 @@ def get_item(self, collection_id: str, item_id: str, **kwargs: Any) -> _models.S _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacItem] = kwargs.pop("cls", None) + cls: ClsType[_models.TilerStacSearchRegistration] = kwargs.pop("cls", None) - _request = build_stac_get_item_request( + _request = build_data_get_collection_info_request( collection_id=collection_id, - item_id=item_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8050,6 +29044,7 @@ def get_item(self, collection_id: str, item_id: str, **kwargs: Any) -> _models.S } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8067,9 +29062,9 @@ def get_item(self, collection_id: str, item_id: str, **kwargs: Any) -> _models.S raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.StacItem, response.json()) + deserialized = _deserialize(_models.TilerStacSearchRegistration, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8077,85 +29072,207 @@ def get_item(self, collection_id: str, item_id: str, **kwargs: Any) -> _models.S return deserialized # type: ignore @distributed_trace - def get_item_collection( + def get_collection_bbox_crop( # pylint: disable=too-many-locals self, collection_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + format: str, *, - limit: Optional[int] = None, - bounding_box: Optional[List[str]] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, **kwargs: Any - ) -> _models.StacItemCollection: - """Fetch features of the feature collection with id ``collectionId``. + ) -> Iterator[bytes]: + """Collection Bbox. - Every feature in a dataset belongs to a collection. A dataset may - consist of multiple feature collections. A feature collection is often a - collection of features of a similar type, based on a common schema. + Create an image from part of a STAC collection dataset (bounding box crop). - :param collection_id: Catalog collection id. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :keyword limit: The optional limit parameter recommends the number of items that should be - present in the response document. - - If the limit parameter value is greater than advertised limit maximum, the server must return - the - maximum possible number of items, rather than responding with an error. - - Only items are counted that are on the first level of the collection in the response document. - Nested objects contained within the explicitly requested items must not be counted. - - Minimum = 1. Maximum = 10000. Default = 10. Default value is None. - :paramtype limit: int - :keyword bounding_box: Only features that have a geometry that intersects the bounding box are - selected. - The bounding box is provided as four or six numbers, depending on whether the - coordinate reference system includes a vertical axis (height or depth): - - - - * Lower left corner, coordinate axis 1 - * Lower left corner, coordinate axis 2 - * Minimum value, coordinate axis 3 (optional) - * Upper right corner, coordinate axis 1 - * Upper right corner, coordinate axis 2 - * Maximum value, coordinate axis 3 (optional) - - The coordinate reference system of the values is WGS 84 longitude/latitude - (`http://www.opengis.net/def/crs/OGC/1.3/CRS84 - `_). - - For WGS 84 longitude/latitude the values are in most cases the sequence of - minimum longitude, minimum latitude, maximum longitude and maximum latitude. - However, in cases where the box spans the antimeridian the first value - (west-most box edge) is larger than the third value (east-most box edge). - - If the vertical axis is included, the third and the sixth number are - the bottom and the top of the 3-dimensional bounding box. - - If a feature has multiple spatial geometry properties, it is the decision of the - server whether only a single spatial geometry property is used to determine - the extent or all relevant geometries. Default value is None. - :paramtype bounding_box: list[str] - :keyword datetime: Either a date-time or an interval, open or closed. Date and time expressions - adhere to RFC 3339. Open intervals are expressed using double-dots. - - Examples: - - - - * A date-time: "2018-02-12T23:20:50Z" - * A closed interval: "2018-02-12T00:00:00Z/2018-03-18T12:31:12Z" - * Open intervals: "2018-02-12T00:00:00Z/.." or "../2018-03-18T12:31:12Z" - - Only features that have a temporal property that intersects the value of - ``datetime`` are selected. - - If a feature has multiple temporal properties, it is the decision of the - server whether only a single temporal property is used to determine - the extent or all relevant temporal properties. Default value is None. + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. :paramtype datetime: str - :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemCollection + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8169,13 +29286,53 @@ def get_item_collection( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacItemCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_stac_get_item_collection_request( + _request = build_data_get_collection_bbox_crop_request( collection_id=collection_id, - limit=limit, - bounding_box=bounding_box, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + max_size=max_size, + height=height, + width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8185,7 +29342,8 @@ def get_item_collection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8201,19 +29359,226 @@ def get_item_collection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacItemCollection, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _update_item_initial( - self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any + @distributed_trace + def get_collection_bbox_crop_with_dimensions( # pylint: disable=too-many-locals + self, + collection_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + width: int, + height: int, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any ) -> Iterator[bytes]: + """Collection Bbox With Dimensions. + + Create an image from part of a STAC collection dataset (bounding box crop with dimensions). + + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param width: Force output image width. Required. + :type width: int + :param height: Force output image height. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8222,25 +29587,57 @@ def _update_item_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_stac_update_item_request( + _request = build_data_get_collection_bbox_crop_with_dimensions_request( collection_id=collection_id, - item_id=item_id, - content_type=content_type, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + width=width, + height=height, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + max_size=max_size, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -8249,26 +29646,33 @@ def _update_item_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = True + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["operation-location"] = self._deserialize("str", response.headers.get("operation-location")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8276,226 +29680,803 @@ def _update_item_initial( return deserialized # type: ignore @overload - def begin_update_item( - self, - collection_id: str, - item_id: str, - body: _models.StacItem, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a STAC item in a collection. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :param body: STAC Item. Required. - :type body: ~azure.planetarycomputer.models.StacItem - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_item( - self, - collection_id: str, - item_id: str, - body: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a STAC item in a collection. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :param body: STAC Item. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_item( - self, - collection_id: str, - item_id: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> LROPoller[None]: - """Update a STAC item in a collection. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :param body: STAC Item. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_item( - self, collection_id: str, item_id: str, body: Union[_models.StacItem, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Update a STAC item in a collection. - - :param collection_id: Catalog collection id. Required. - :type collection_id: str - :param item_id: STAC Item id. Required. - :type item_id: str - :param body: STAC Item. Is one of the following types: StacItem, JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.StacItem or JSON or IO[bytes] - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_item_initial( - collection_id=collection_id, - item_id=item_id, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def create_queryables( + def crop_collection_feature_geo_json( # pylint: disable=too-many-locals self, collection_id: str, - body: List[_models.StacQueryable], + body: _models.Feature, *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, content_type: str = "application/json", **kwargs: Any - ) -> List[_models.StacQueryable]: - """Set Collection Queryables. + ) -> Iterator[bytes]: + """Collection Geojson Feature. - Set queryables for a collection given a list of queryable definitions. + Create image from a geojson feature (without format in path). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Request queryable definition body. Required. - :type body: list[~azure.planetarycomputer.models.StacQueryable] + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: list of StacQueryable - :rtype: list[~azure.planetarycomputer.models.StacQueryable] + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_queryables( - self, collection_id: str, body: List[JSON], *, content_type: str = "application/json", **kwargs: Any - ) -> List[_models.StacQueryable]: - """Set Collection Queryables. + def crop_collection_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Geojson Feature. - Set queryables for a collection given a list of queryable definitions. + Create image from a geojson feature (without format in path). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Request queryable definition body. Required. - :type body: list[JSON] + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: list of StacQueryable - :rtype: list[~azure.planetarycomputer.models.StacQueryable] + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_queryables( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> List[_models.StacQueryable]: - """Set Collection Queryables. + def crop_collection_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Geojson Feature. - Set queryables for a collection given a list of queryable definitions. + Create image from a geojson feature (without format in path). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Request queryable definition body. Required. + :param body: Request GeoJson body. Required. :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: list of StacQueryable - :rtype: list[~azure.planetarycomputer.models.StacQueryable] + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_queryables( - self, collection_id: str, body: Union[List[_models.StacQueryable], List[JSON], IO[bytes]], **kwargs: Any - ) -> List[_models.StacQueryable]: - """Set Collection Queryables. + def crop_collection_feature_geo_json( # pylint: disable=too-many-locals + self, + collection_id: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Collection Geojson Feature. - Set queryables for a collection given a list of queryable definitions. + Create image from a geojson feature (without format in path). - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param body: Request queryable definition body. Is one of the following types: [StacQueryable], - [JSON], IO[bytes] Required. - :type body: list[~azure.planetarycomputer.models.StacQueryable] or list[JSON] or IO[bytes] - :return: list of StacQueryable - :rtype: list[~azure.planetarycomputer.models.StacQueryable] + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8510,7 +30491,7 @@ def create_queryables( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[List[_models.StacQueryable]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -8519,8 +30500,47 @@ def create_queryables( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_stac_create_queryables_request( + _request = build_data_crop_collection_feature_geo_json_request( collection_id=collection_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, + height=height, + width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + format=format, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -8532,14 +30552,15 @@ def create_queryables( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -8548,121 +30569,816 @@ def create_queryables( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.StacQueryable], response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def replace_queryable( + def crop_collection_feature_geo_json_format( # pylint: disable=too-many-locals self, collection_id: str, - queryable_name: str, - body: _models.StacQueryable, + format: str, + body: _models.Feature, *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacQueryable: - """Update Collection Queryables. + ) -> Iterator[bytes]: + """Collection Geojson Feature Crop With Format. - Updates a queryable given a queryable definition and corresponding collection id. + Create image from a geojson feature with format. - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param queryable_name: Name of the queryable property to operate on. Required. - :type queryable_name: str - :param body: Request queryable definition body. Required. - :type body: ~azure.planetarycomputer.models.StacQueryable + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: StacQueryable. The StacQueryable is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacQueryable + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def replace_queryable( + def crop_collection_feature_geo_json_format( # pylint: disable=too-many-locals self, collection_id: str, - queryable_name: str, + format: str, body: JSON, *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacQueryable: - """Update Collection Queryables. + ) -> Iterator[bytes]: + """Collection Geojson Feature Crop With Format. - Updates a queryable given a queryable definition and corresponding collection id. + Create image from a geojson feature with format. - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param queryable_name: Name of the queryable property to operate on. Required. - :type queryable_name: str - :param body: Request queryable definition body. Required. + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: StacQueryable. The StacQueryable is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacQueryable + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def replace_queryable( + def crop_collection_feature_geo_json_format( # pylint: disable=too-many-locals self, collection_id: str, - queryable_name: str, + format: str, body: IO[bytes], *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacQueryable: - """Update Collection Queryables. + ) -> Iterator[bytes]: + """Collection Geojson Feature Crop With Format. - Updates a queryable given a queryable definition and corresponding collection id. + Create image from a geojson feature with format. - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param queryable_name: Name of the queryable property to operate on. Required. - :type queryable_name: str - :param body: Request queryable definition body. Required. + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: StacQueryable. The StacQueryable is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacQueryable + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def replace_queryable( + def crop_collection_feature_geo_json_format( # pylint: disable=too-many-locals self, collection_id: str, - queryable_name: str, - body: Union[_models.StacQueryable, JSON, IO[bytes]], + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, **kwargs: Any - ) -> _models.StacQueryable: - """Update Collection Queryables. + ) -> Iterator[bytes]: + """Collection Geojson Feature Crop With Format. - Updates a queryable given a queryable definition and corresponding collection id. + Create image from a geojson feature with format. - :param collection_id: Unique identifier for the STAC collection. Required. + :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param queryable_name: Name of the queryable property to operate on. Required. - :type queryable_name: str - :param body: Request queryable definition body. Is one of the following types: StacQueryable, - JSON, IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.StacQueryable or JSON or IO[bytes] - :return: StacQueryable. The StacQueryable is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacQueryable + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8677,7 +31393,7 @@ def replace_queryable( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StacQueryable] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -8686,190 +31402,50 @@ def replace_queryable( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_stac_replace_queryable_request( - collection_id=collection_id, - queryable_name=queryable_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacQueryable, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete_queryable( # pylint: disable=inconsistent-return-statements - self, collection_id: str, queryable_name: str, **kwargs: Any - ) -> None: - """Delete Queryables. - - Delete queryables by name for specified collection. - - :param collection_id: Unique identifier for the STAC collection. Required. - :type collection_id: str - :param queryable_name: Name of the queryable property to operate on. Required. - :type queryable_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_stac_delete_queryable_request( - collection_id=collection_id, - queryable_name=queryable_name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_queryables(self, **kwargs: Any) -> _models.QueryableDefinitionsResponse: - """Queryables. - - List all queryables in the GeoCatalog instance. - - :return: QueryableDefinitionsResponse. The QueryableDefinitionsResponse is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.QueryableDefinitionsResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.QueryableDefinitionsResponse] = kwargs.pop("cls", None) - - _request = build_stac_list_queryables_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> _models.QueryableDefinitionsResponse: - """Collection Queryables. - - List all queryables in a given collection. - - :param collection_id: Collection ID. Required. - :type collection_id: str - :return: QueryableDefinitionsResponse. The QueryableDefinitionsResponse is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.QueryableDefinitionsResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.QueryableDefinitionsResponse] = kwargs.pop("cls", None) - - _request = build_stac_get_collection_queryables_request( + _request = build_data_crop_collection_feature_geo_json_format_request( collection_id=collection_id, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, + height=height, + width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8878,7 +31454,8 @@ def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> _model } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -8894,126 +31471,816 @@ def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> _model map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def search( + def crop_collection_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals self, - body: _models.StacSearchParameters, + collection_id: str, + width: int, + height: int, + format: str, + body: _models.Feature, *, - sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, - duration_in_minutes: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacItemCollection: - """Search. + ) -> Iterator[bytes]: + """Collection Geojson Feature Crop With Dimensions. - STAC search operation. + Create image from a geojson feature with dimensions. - :param body: Request body. Required. - :type body: ~azure.planetarycomputer.models.StacSearchParameters - :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and - "false". Default value is None. - :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode - :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. - :paramtype duration_in_minutes: int + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemCollection + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def search( + def crop_collection_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals self, + collection_id: str, + width: int, + height: int, + format: str, body: JSON, *, - sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, - duration_in_minutes: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacItemCollection: - """Search. + ) -> Iterator[bytes]: + """Collection Geojson Feature Crop With Dimensions. - STAC search operation. + Create image from a geojson feature with dimensions. - :param body: Request body. Required. + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. :type body: JSON - :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and - "false". Default value is None. - :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode - :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. - :paramtype duration_in_minutes: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemCollection + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def search( + def crop_collection_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals self, + collection_id: str, + width: int, + height: int, + format: str, body: IO[bytes], *, - sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, - duration_in_minutes: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.StacItemCollection: - """Search. + ) -> Iterator[bytes]: + """Collection Geojson Feature Crop With Dimensions. - STAC search operation. + Create image from a geojson feature with dimensions. - :param body: Request body. Required. + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. :type body: IO[bytes] - :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and - "false". Default value is None. - :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode - :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. - :paramtype duration_in_minutes: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemCollection + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def search( + def crop_collection_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals self, - body: Union[_models.StacSearchParameters, JSON, IO[bytes]], + collection_id: str, + width: int, + height: int, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], *, - sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, - duration_in_minutes: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, **kwargs: Any - ) -> _models.StacItemCollection: - """Search. + ) -> Iterator[bytes]: + """Collection Geojson Feature Crop With Dimensions. - STAC search operation. + Create image from a geojson feature with dimensions. - :param body: Request body. Is one of the following types: StacSearchParameters, JSON, IO[bytes] - Required. - :type body: ~azure.planetarycomputer.models.StacSearchParameters or JSON or IO[bytes] - :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and - "false". Default value is None. - :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode - :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. - :paramtype duration_in_minutes: int - :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemCollection + :param collection_id: STAC Collection Identifier. Required. + :type collection_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9028,7 +32295,7 @@ def search( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StacItemCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -9037,153 +32304,50 @@ def search( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_stac_search_request( - sign=sign, - duration_in_minutes=duration_in_minutes, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacItemCollection, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class DataOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.planetarycomputer.PlanetaryComputerProClient`'s - :attr:`data` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PlanetaryComputerProClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get_tile_matrix_definitions(self, tile_matrix_set_id: str, **kwargs: Any) -> _models.TileMatrixSet: - """Matrix Definition. - - Return Matrix Definition. - - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str - :return: TileMatrixSet. The TileMatrixSet is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileMatrixSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TileMatrixSet] = kwargs.pop("cls", None) - - _request = build_data_get_tile_matrix_definitions_request( - tile_matrix_set_id=tile_matrix_set_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TileMatrixSet, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_tile_matrices(self, **kwargs: Any) -> List[str]: - """Matrix List. - - Return Matrix List. - - :return: list of str - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[str]] = kwargs.pop("cls", None) - - _request = build_data_list_tile_matrices_request( + _request = build_data_crop_collection_feature_geo_json_width_by_height_request( + collection_id=collection_id, + width=width, + height=height, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + destination_crs=destination_crs, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -9192,7 +32356,8 @@ def list_tile_matrices(self, **kwargs: Any) -> List[str]: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -9208,97 +32373,139 @@ def list_tile_matrices(self, **kwargs: Any) -> List[str]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[str], response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_asset_statistics( # pylint: disable=too-many-locals + def get_collection_point( # pylint: disable=too-many-locals self, collection_id: str, - item_id: str, + longitude: float, + latitude: float, *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, **kwargs: Any - ) -> _models.AssetStatisticsResponse: - """Asset Statistics. + ) -> _models.TilerCoreModelsResponsesPoint: + """Collection Point. - Per Asset statistics. + Get Point value for a collection dataset. :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. - Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). - - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_range: str - :return: AssetStatisticsResponse. The AssetStatisticsResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.AssetStatisticsResponse + :return: TilerCoreModelsResponsesPoint. The TilerCoreModelsResponsesPoint is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerCoreModelsResponsesPoint :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9312,89 +32519,38 @@ def get_asset_statistics( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AssetStatisticsResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.TilerCoreModelsResponsesPoint] = kwargs.pop("cls", None) - _request = build_data_get_asset_statistics_request( + _request = build_data_get_collection_point_request( collection_id=collection_id, - item_id=item_id, + longitude=longitude, + latitude=latitude, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, + coordinate_reference_system=coordinate_reference_system, resampling=resampling, - max_size=max_size, - categorical=categorical, - categories_pixels=categories_pixels, - percentiles=percentiles, - histogram_bins=histogram_bins, - histogram_range=histogram_range, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.AssetStatisticsResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_available_assets(self, collection_id: str, item_id: str, **kwargs: Any) -> List[str]: - """Available Assets. - - Return a list of supported assets. - - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :return: list of str - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[str]] = kwargs.pop("cls", None) - - _request = build_data_list_available_assets_request( - collection_id=collection_id, - item_id=item_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -9404,6 +32560,7 @@ def list_available_assets(self, collection_id: str, item_id: str, **kwargs: Any) } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9421,9 +32578,9 @@ def list_available_assets(self, collection_id: str, item_id: str, **kwargs: Any) raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(List[str], response.json()) + deserialized = _deserialize(_models.TilerCoreModelsResponsesPoint, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9431,17 +32588,89 @@ def list_available_assets(self, collection_id: str, item_id: str, **kwargs: Any) return deserialized # type: ignore @distributed_trace - def get_bounds(self, collection_id: str, item_id: str, **kwargs: Any) -> _models.StacItemBounds: - """Bounds. + def get_collection_point_assets( # pylint: disable=too-many-locals + self, + collection_id: str, + longitude: float, + latitude: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + ids: Optional[str] = None, + bbox: Optional[str] = None, + query: Optional[str] = None, + sortby: Optional[str] = None, + datetime: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any + ) -> List[_models.StacItemPointAsset]: + """Collection Point Assets. - Return all Bounds. + Return a list of assets for a given point in a collection. :param collection_id: STAC Collection Identifier. Required. :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :return: StacItemBounds. The StacItemBounds is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemBounds + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword ids: Array of Item ids. Default value is None. + :paramtype ids: str + :keyword bbox: Bounding box (west, south, east, north). Default value is None. + :paramtype bbox: str + :keyword query: JSON query expression for filtering items. Default value is None. + :paramtype query: str + :keyword sortby: Sorting expression (e.g. +/-property). Default value is None. + :paramtype sortby: str + :keyword datetime: Datetime filter expression (single datetime or range using ``/`` separator). + Default value is None. + :paramtype datetime: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :return: list of StacItemPointAsset + :rtype: list[~azure.planetarycomputer.models.StacItemPointAsset] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9455,11 +32684,29 @@ def get_bounds(self, collection_id: str, item_id: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.StacItemBounds] = kwargs.pop("cls", None) + cls: ClsType[List[_models.StacItemPointAsset]] = kwargs.pop("cls", None) - _request = build_data_get_bounds_request( + _request = build_data_get_collection_point_assets_request( collection_id=collection_id, - item_id=item_id, + longitude=longitude, + latitude=latitude, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + ids=ids, + bbox=bbox, + query=query, + sortby=sortby, + datetime=datetime, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, api_version=self._config.api_version, headers=_headers, params=_params, @@ -9469,6 +32716,7 @@ def get_bounds(self, collection_id: str, item_id: str, **kwargs: Any) -> _models } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9486,456 +32734,359 @@ def get_bounds(self, collection_id: str, item_id: str, **kwargs: Any) -> _models raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.StacItemBounds, response.json()) + deserialized = _deserialize(List[_models.StacItemPointAsset], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def crop_geo_json( + @distributed_trace + def list_searches_tilesets( self, - collection_id: str, - item_id: str, - format: str, - body: _models.Feature, + search_id: str, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, - content_type: str = "application/json", + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - """Geojson Crop. + ) -> _models.TileSetList: + """Searches Tileset List. - Create image from a geojson feature. + Return a list of available tilesets for a mosaic search. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. - :type body: ~azure.planetarycomputer.models.Feature - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetList. The TileSetList is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetList :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def crop_geo_json( - self, - collection_id: str, - item_id: str, - format: str, - body: JSON, - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> Iterator[bytes]: - """Geojson Crop. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Create image from a geojson feature. + cls: ClsType[_models.TileSetList] = kwargs.pop("cls", None) - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. - :type body: JSON - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _request = build_data_list_searches_tilesets_request( + search_id=search_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - @overload - def crop_geo_json( + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetList, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_searches_tileset_metadata( self, - collection_id: str, - item_id: str, - format: str, - body: IO[bytes], + search_id: str, + tile_matrix_set_id: str, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, - content_type: str = "application/json", + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - """Geojson Crop. + ) -> _models.TileSetMetadata: + """Searches Tileset Metadata. - Create image from a geojson feature. + Return metadata for a specific tileset of a mosaic search. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. - :type body: IO[bytes] - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :return: TileSetMetadata. The TileSetMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileSetMetadata :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.TileSetMetadata] = kwargs.pop("cls", None) + + _request = build_data_get_searches_tileset_metadata_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileSetMetadata, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def crop_geo_json( # pylint: disable=too-many-locals + def get_searches_tile_by_scale_and_format( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, format: str, - body: Union[_models.Feature, JSON, IO[bytes]], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any ) -> Iterator[bytes]: - """Geojson Crop. + """Searches Tile Tilematrixsetid. - Create image from a geojson feature. + Create map tile (with TileMatrixSetId, scale, and format in path). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. :type format: str - :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] - Required. - :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -9968,13 +33119,20 @@ def crop_geo_json( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -9987,44 +33145,51 @@ def crop_geo_json( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_data_crop_geo_json_request( - collection_id=collection_id, - item_id=item_id, + _request = build_data_get_searches_tile_by_scale_and_format_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, + buffer=buffer, color_formula=color_formula, - coordinate_reference_system=coordinate_reference_system, + collection=collection, resampling=resampling, - max_size=max_size, - height=height, - width=width, + pixel_selection=pixel_selection, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, - content_type=content_type, + padding=padding, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -10033,6 +33198,7 @@ def crop_geo_json( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10058,210 +33224,155 @@ def crop_geo_json( # pylint: disable=too-many-locals response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def crop_geo_json_with_dimensions( + @distributed_trace + def get_searches_tile( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - width: int, - height: int, - format: str, - body: _models.Feature, + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, - content_type: str = "application/json", + padding: Optional[int] = None, **kwargs: Any ) -> Iterator[bytes]: - """Geojson Crop. + """Searches Tile Tilematrixsetid Plain. - Create image from a geojson feature. + Create map tile (with TileMatrixSetId, without scale or format). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. - :type body: ~azure.planetarycomputer.models.Feature + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def crop_geo_json_with_dimensions( - self, - collection_id: str, - item_id: str, - width: int, - height: int, - format: str, - body: JSON, - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> Iterator[bytes]: - """Geojson Crop. - - Create image from a geojson feature. - - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Required. - :type body: JSON - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -10294,96 +33405,259 @@ def crop_geo_json_with_dimensions( "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def crop_geo_json_with_dimensions( + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_tile_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_searches_tile_by_format( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - width: int, - height: int, + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, format: str, - body: IO[bytes], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, - content_type: str = "application/json", + padding: Optional[int] = None, **kwargs: Any ) -> Iterator[bytes]: - """Geojson Crop. + """Searches Tile Tilematrixsetid Format. - Create image from a geojson feature. + Create map tile (with TileMatrixSetId and format, without scale). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. :type format: str - :param body: Request GeoJson body. Required. - :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -10416,96 +33690,259 @@ def crop_geo_json_with_dimensions( "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_tile_by_format_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals + def get_searches_tile_by_scale( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - width: int, - height: int, - format: str, - body: Union[_models.Feature, JSON, IO[bytes]], + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, - coordinate_reference_system: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any ) -> Iterator[bytes]: - """Geojson Crop. + """Searches Tile Tilematrixsetid Scale. - Create image from a geojson feature. + Create map tile (with TileMatrixSetId and scale, without format). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] - Required. - :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Image output size limit if width and height limits are not set. Default - value is None. - :paramtype max_size: int + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -10538,13 +33975,20 @@ def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -10557,44 +34001,51 @@ def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_data_crop_geo_json_with_dimensions_request( - collection_id=collection_id, - item_id=item_id, - width=width, - height=height, - format=format, + _request = build_data_get_searches_tile_by_scale_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, + format=format, + buffer=buffer, color_formula=color_formula, - coordinate_reference_system=coordinate_reference_system, + collection=collection, resampling=resampling, - max_size=max_size, + pixel_selection=pixel_selection, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, - content_type=content_type, + padding=padding, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -10603,6 +34054,7 @@ def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10628,391 +34080,493 @@ def crop_geo_json_with_dimensions( # pylint: disable=too-many-locals response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_searches_assets_for_tile( # pylint: disable=too-many-locals + self, + search_id: str, + tile_matrix_set_id: str, + z: float, + x: float, + y: float, + *, + collection_id: str, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + **kwargs: Any + ) -> List[_models.TilerAssetGeoJson]: + """Searches Assets For Tile Tilematrixsetid As Path. + + Return a list of assets which overlap a given tile. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword collection_id: STAC Collection Identifier. Required. + :paramtype collection_id: str + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :return: list of TilerAssetGeoJson + :rtype: list[~azure.planetarycomputer.models.TilerAssetGeoJson] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TilerAssetGeoJson]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_assets_for_tile_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + collection_id=collection_id, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.TilerAssetGeoJson], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def get_geo_json_statistics( + @distributed_trace + def get_searches_tile_json_tms( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - body: _models.Feature, + search_id: str, + tile_matrix_set_id: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, - content_type: str = "application/json", + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> _models.StacItemStatisticsGeoJson: - """Geojson Statistics. + ) -> _models.TileJsonMetadata: + """Searches TileJson Tilematrixsetid As Path. - Get Statistics from a geojson feature. + Return TileJSON document for a search with TileMatrixSetId as path. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param body: Request GeoJson body. Required. - :type body: ~azure.planetarycomputer.models.Feature + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). - - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is None. - :paramtype histogram_range: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def get_geo_json_statistics( - self, - collection_id: str, - item_id: str, - body: JSON, - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.StacItemStatisticsGeoJson: - """Geojson Statistics. - - Get Statistics from a geojson feature. - - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param body: Request GeoJson body. Required. - :type body: JSON - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. - Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). - - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_range: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def get_geo_json_statistics( - self, - collection_id: str, - item_id: str, - body: IO[bytes], - *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.StacItemStatisticsGeoJson: - """Geojson Statistics. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Get Statistics from a geojson feature. + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param body: Request GeoJson body. Required. - :type body: IO[bytes] - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. - Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). + _request = build_data_get_searches_tile_json_tms_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + min_zoom=min_zoom, + max_zoom=max_zoom, + tile_format=tile_format, + tile_scale=tile_scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. + response = pipeline_response.http_response - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_range: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson - :raises ~azure.core.exceptions.HttpResponseError: - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get_geo_json_statistics( # pylint: disable=too-many-locals + def get_searches_wmts_capabilities_tms( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - body: Union[_models.Feature, JSON, IO[bytes]], + search_id: str, + tile_matrix_set_id: str, *, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, **kwargs: Any - ) -> _models.StacItemStatisticsGeoJson: - """Geojson Statistics. + ) -> Iterator[bytes]: + """Searches Wmts Tilematrixsetid As Path. - Get Statistics from a geojson feature. + OGC WMTS endpoint with TileMatrixSetId as path. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] - Required. - :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. + :type tile_matrix_set_id: str + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. - Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). - - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is - None. - :paramtype histogram_range: str - :return: StacItemStatisticsGeoJson. The StacItemStatisticsGeoJson is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.StacItemStatisticsGeoJson + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11023,39 +34577,27 @@ def get_geo_json_statistics( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StacItemStatisticsGeoJson] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_data_get_geo_json_statistics_request( - collection_id=collection_id, - item_id=item_id, + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_wmts_capabilities_tms_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, - coordinate_reference_system=coordinate_reference_system, - resampling=resampling, - max_size=max_size, - categorical=categorical, - categories_pixels=categories_pixels, - percentiles=percentiles, - histogram_bins=histogram_bins, - histogram_range=histogram_range, - content_type=content_type, + reproject=reproject, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -11064,7 +34606,8 @@ def get_geo_json_statistics( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11080,32 +34623,27 @@ def get_geo_json_statistics( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.StacItemStatisticsGeoJson, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_info_geo_json( - self, collection_id: str, item_id: str, *, assets: Optional[List[str]] = None, **kwargs: Any - ) -> _models.TilerInfoGeoJsonFeature: - """Info Geojson. + def get_searches_info(self, search_id: str, **kwargs: Any) -> _models.TilerStacSearchRegistration: + """Searches Info. - Return Info Geojson. + Get Search query metadata. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :return: TilerInfoGeoJsonFeature. The TilerInfoGeoJsonFeature is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerInfoGeoJsonFeature + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :return: TilerStacSearchRegistration. The TilerStacSearchRegistration is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerStacSearchRegistration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11119,12 +34657,10 @@ def get_info_geo_json( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TilerInfoGeoJsonFeature] = kwargs.pop("cls", None) + cls: ClsType[_models.TilerStacSearchRegistration] = kwargs.pop("cls", None) - _request = build_data_get_info_geo_json_request( - collection_id=collection_id, - item_id=item_id, - assets=assets, + _request = build_data_get_searches_info_request( + search_id=search_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -11134,6 +34670,7 @@ def get_info_geo_json( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11151,9 +34688,9 @@ def get_info_geo_json( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TilerInfoGeoJsonFeature, response.json()) + deserialized = _deserialize(_models.TilerStacSearchRegistration, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11161,21 +34698,194 @@ def get_info_geo_json( return deserialized # type: ignore @distributed_trace - def get_item_asset_details( - self, collection_id: str, item_id: str, *, assets: Optional[List[str]] = None, **kwargs: Any - ) -> _models.TilerInfoMapResponse: - """Info. + def get_searches_bbox_crop( # pylint: disable=too-many-locals + self, + search_id: str, + minx: float, + miny: float, + maxx: float, + maxy: float, + format: str, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + destination_crs: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Searches Bbox. - Return dataset's basic info. + Create an image from part of a dataset (bounding box crop). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] - :return: TilerInfoMapResponse. The TilerInfoMapResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerInfoMapResponse + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11189,12 +34899,49 @@ def get_item_asset_details( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TilerInfoMapResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_item_asset_details_request( - collection_id=collection_id, - item_id=item_id, + _request = build_data_get_searches_bbox_crop_request( + search_id=search_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + format=format, + bidx=bidx, assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + coordinate_reference_system=coordinate_reference_system, + destination_crs=destination_crs, + max_size=max_size, + height=height, + width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, api_version=self._config.api_version, headers=_headers, params=_params, @@ -11204,7 +34951,8 @@ def get_item_asset_details( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11220,56 +34968,74 @@ def get_item_asset_details( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerInfoMapResponse, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_part( # pylint: disable=too-many-locals + def get_searches_bbox_crop_with_dimensions( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, + search_id: str, minx: float, miny: float, maxx: float, maxy: float, + width: int, + height: int, format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, + destination_crs: Optional[str] = None, max_size: Optional[int] = None, - height: Optional[int] = None, - width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, **kwargs: Any ) -> Iterator[bytes]: - """Part. + """Searches Bbox With Dimensions. - Create image from part of a dataset. + Create an image from part of a dataset (bounding box crop with dimensions). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str :param minx: Bounding box min X. Required. :type minx: float :param miny: Bounding box min Y. Required. @@ -11278,44 +35044,90 @@ def get_part( # pylint: disable=too-many-locals :type maxx: float :param maxy: Bounding box max Y. Required. :type maxy: float + :param width: Force output image width. Required. + :type width: int + :param height: Force output image height. Required. + :type height: int :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword dst_crs: Output Coordinate Reference System. Default value is None. - :paramtype dst_crs: str :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default to ``epsg:4326``. Default value is None. :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str :keyword max_size: Image output size limit if width and height limits are not set. Default value is None. :paramtype max_size: int - :keyword height: Height in pixels for the output image. Default value is None. - :paramtype height: int - :keyword width: Width in pixels for the output image. Default value is None. - :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -11348,8 +35160,12 @@ def get_part( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str @@ -11372,29 +35188,43 @@ def get_part( # pylint: disable=too-many-locals cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_part_request( - collection_id=collection_id, - item_id=item_id, + _request = build_data_get_searches_bbox_crop_with_dimensions_request( + search_id=search_id, minx=minx, miny=miny, maxx=maxx, maxy=maxy, + width=width, + height=height, format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, - color_formula=color_formula, - dst_crs=dst_crs, coordinate_reference_system=coordinate_reference_system, - resampling=resampling, + destination_crs=destination_crs, max_size=max_size, - height=height, - width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, rescale=rescale, color_map_name=color_map_name, color_map=color_map, @@ -11408,6 +35238,7 @@ def get_part( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11433,7 +35264,7 @@ def get_part( # pylint: disable=too-many-locals response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -11441,91 +35272,284 @@ def get_part( # pylint: disable=too-many-locals return deserialized # type: ignore @distributed_trace - def get_part_with_dimensions( # pylint: disable=too-many-locals + def get_searches_bbox_assets( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, + search_id: str, minx: float, miny: float, maxx: float, maxy: float, - width: int, - height: int, - format: str, *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + **kwargs: Any + ) -> List[Any]: + """Searches Assets For Bbox. + + Return a list of assets which overlap a given bounding box for a search. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param minx: Bounding box min X. Required. + :type minx: float + :param miny: Bounding box min Y. Required. + :type miny: float + :param maxx: Bounding box max X. Required. + :type maxx: float + :param maxy: Bounding box max Y. Required. + :type maxy: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :return: list of any + :rtype: list[any] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[Any]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_bbox_assets_request( + search_id=search_id, + minx=minx, + miny=miny, + maxx=maxx, + maxy=maxy, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[Any], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def crop_searches_feature_geo_json( # pylint: disable=too-many-locals + self, + search_id: str, + body: _models.Feature, + *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, coordinate_reference_system: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", **kwargs: Any ) -> Iterator[bytes]: - """Part. + """Searches Geojson Feature. - Create image from part of a dataset. + Create image from a geojson feature (without format in path). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param minx: Bounding box min X. Required. - :type minx: float - :param miny: Bounding box min Y. Required. - :type miny: float - :param maxx: Bounding box max X. Required. - :type maxx: float - :param maxy: Bounding box max Y. Required. - :type maxy: float - :param width: Width in pixels for the output image. Required. - :type width: int - :param height: Height in pixels for the output image. Required. - :type height: int - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword dst_crs: Output Coordinate Reference System. Default value is None. - :paramtype dst_crs: str :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default to ``epsg:4326``. Default value is None. :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling :keyword max_size: Image output size limit if width and height limits are not set. Default value is None. :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -11558,277 +35582,331 @@ def get_part_with_dimensions( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_data_get_part_with_dimensions_request( - collection_id=collection_id, - item_id=item_id, - minx=minx, - miny=miny, - maxx=maxx, - maxy=maxy, - width=width, - height=height, - format=format, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - algorithm=algorithm, - algorithm_params=algorithm_params, - color_formula=color_formula, - dst_crs=dst_crs, - coordinate_reference_system=coordinate_reference_system, - resampling=resampling, - max_size=max_size, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - @distributed_trace - def get_point( # pylint: disable=too-many-locals + @overload + def crop_searches_feature_geo_json( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - longitude: float, - latitude: float, + search_id: str, + body: JSON, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.TilerCoreModelsResponsesPoint: - """Point. + ) -> Iterator[bytes]: + """Searches Geojson Feature. - Get Point value for a dataset. + Create image from a geojson feature (without format in path). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param longitude: Longitude. Required. - :type longitude: float - :param latitude: Latitude. Required. - :type latitude: float + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default to ``epsg:4326``. Default value is None. :paramtype coordinate_reference_system: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :return: TilerCoreModelsResponsesPoint. The TilerCoreModelsResponsesPoint is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerCoreModelsResponsesPoint - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TilerCoreModelsResponsesPoint] = kwargs.pop("cls", None) - - _request = build_data_get_point_request( - collection_id=collection_id, - item_id=item_id, - longitude=longitude, - latitude=latitude, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - coordinate_reference_system=coordinate_reference_system, - resampling=resampling, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerCoreModelsResponsesPoint, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ - @distributed_trace - def get_preview( # pylint: disable=too-many-locals + @overload + def crop_searches_feature_geo_json( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, + search_id: str, + body: IO[bytes], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - format: Optional[Union[str, _models.TilerImageFormat]] = None, - color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, + coordinate_reference_system: Optional[str] = None, max_size: Optional[int] = None, height: Optional[int] = None, width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + content_type: str = "application/json", **kwargs: Any ) -> Iterator[bytes]: - """Preview. + """Searches Geojson Feature. - Create preview of a dataset. + Create image from a geojson feature (without format in path). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str - :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: - "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. - :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword dst_crs: Output Coordinate Reference System. Default value is None. - :paramtype dst_crs: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str :keyword max_size: Image output size limit if width and height limits are not set. Default value is None. :paramtype max_size: int @@ -11836,6 +35914,18 @@ def get_preview( # pylint: disable=too-many-locals :paramtype height: int :keyword width: Width in pixels for the output image. Default value is None. :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -11868,156 +35958,143 @@ def get_preview( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_data_get_preview_request( - collection_id=collection_id, - item_id=item_id, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - algorithm=algorithm, - algorithm_params=algorithm_params, - format=format, - color_formula=color_formula, - dst_crs=dst_crs, - resampling=resampling, - max_size=max_size, - height=height, - width=width, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore @distributed_trace - def get_preview_with_format( # pylint: disable=too-many-locals + def crop_searches_feature_geo_json( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - format: str, + search_id: str, + body: Union[_models.Feature, JSON, IO[bytes]], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - color_formula: Optional[str] = None, - dst_crs: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, + coordinate_reference_system: Optional[str] = None, max_size: Optional[int] = None, height: Optional[int] = None, width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, **kwargs: Any ) -> Iterator[bytes]: - """Preview. + """Searches Geojson Feature. - Create preview of a dataset. + Create image from a geojson feature (without format in path). - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword dst_crs: Output Coordinate Reference System. Default value is None. - :paramtype dst_crs: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str :keyword max_size: Image output size limit if width and height limits are not set. Default value is None. :paramtype max_size: int @@ -12025,6 +36102,18 @@ def get_preview_with_format( # pylint: disable=too-many-locals :paramtype height: int :keyword width: Width in pixels for the output image. Default value is None. :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -12057,13 +36146,22 @@ def get_preview_with_format( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword format: Output image format. Known values are: "png", "npy", "tif", "jpeg", "jpg", + "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -12076,34 +36174,59 @@ def get_preview_with_format( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_preview_with_format_request( - collection_id=collection_id, - item_id=item_id, - format=format, + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_searches_feature_geo_json_request( + search_id=search_id, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, - color_formula=color_formula, - dst_crs=dst_crs, - resampling=resampling, + coordinate_reference_system=coordinate_reference_system, max_size=max_size, height=height, width=width, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, + destination_crs=destination_crs, + format=format, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -12112,6 +36235,7 @@ def get_preview_with_format( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12137,7 +36261,7 @@ def get_preview_with_format( # pylint: disable=too-many-locals response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -12145,438 +36269,700 @@ def get_preview_with_format( # pylint: disable=too-many-locals return deserialized # type: ignore @overload - def create_static_image( + def crop_searches_feature_geo_json_format( # pylint: disable=too-many-locals self, - collection_id: str, - body: _models.ImageParameters, + search_id: str, + format: str, + body: _models.Feature, *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.ImageResponse: - """Create Static Image. - - Create a new image export. - - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param body: Image request body. Required. - :type body: ~azure.planetarycomputer.models.ImageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ImageResponse. The ImageResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ImageResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_static_image( - self, collection_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ImageResponse: - """Create Static Image. - - Create a new image export. - - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param body: Image request body. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ImageResponse. The ImageResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ImageResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_static_image( - self, collection_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ImageResponse: - """Create Static Image. - - Create a new image export. - - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param body: Image request body. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ImageResponse. The ImageResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ImageResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_static_image( - self, collection_id: str, body: Union[_models.ImageParameters, JSON, IO[bytes]], **kwargs: Any - ) -> _models.ImageResponse: - """Create Static Image. - - Create a new image export. - - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param body: Image request body. Is one of the following types: ImageParameters, JSON, - IO[bytes] Required. - :type body: ~azure.planetarycomputer.models.ImageParameters or JSON or IO[bytes] - :return: ImageResponse. The ImageResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ImageResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ImageResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_data_create_static_image_request( - collection_id=collection_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ImageResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_static_image(self, collection_id: str, id: str, **kwargs: Any) -> Iterator[bytes]: - """Get Static Image. + ) -> Iterator[bytes]: + """Searches Geojson Feature Crop With Format. - Fetch an existing image export by ID. + Create image from a geojson feature with format. - :param collection_id: STAC Collection ID. Required. - :type collection_id: str - :param id: Image export ID. Required. - :type id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_data_get_static_image_request( - collection_id=collection_id, - id=id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() + @overload + def crop_searches_feature_geo_json_format( # pylint: disable=too-many-locals + self, + search_id: str, + format: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Searches Geojson Feature Crop With Format. - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + Create image from a geojson feature with format. - return deserialized # type: ignore + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ - @distributed_trace - def list_statistics( # pylint: disable=too-many-locals + @overload + def crop_searches_feature_geo_json_format( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, + search_id: str, + format: str, + body: IO[bytes], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, max_size: Optional[int] = None, - categorical: Optional[bool] = None, - categories_pixels: Optional[List[str]] = None, - percentiles: Optional[List[int]] = None, - histogram_bins: Optional[str] = None, - histogram_range: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.TilerStacItemStatistics: - """Statistics. + ) -> Iterator[bytes]: + """Searches Geojson Feature Crop With Format. - Merged assets statistics. + Create image from a geojson feature with format. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword max_size: Maximum dimension in pixels for the source data used to calculate - statistics. Default value is None. - :paramtype max_size: int - :keyword categorical: Return statistics for categorical dataset. Default value is None. - :paramtype categorical: bool - :keyword categories_pixels: List of pixel categorical values for which to report counts. + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). Default value is None. - :paramtype categories_pixels: list[str] - :keyword percentiles: List of percentile values (default to [2, 98]). Default value is None. - :paramtype percentiles: list[int] - :keyword histogram_bins: Defines the number of equal-width bins in the given range (10, by - default). - - If bins is a sequence (comma ``,`` delimited values), it defines a monotonically - increasing array of bin edges, including the rightmost edge, allowing for - non-uniform bin widths. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is None. - :paramtype histogram_bins: str - :keyword histogram_range: Comma ``,`` delimited range of the bins. - - The lower and upper range of the bins. If not provided, range is simply - (a.min(), a.max()). - - Values outside the range are ignored. The first element of the range must be - less than or equal to the second. - range affects the automatic bin computation as well. - - link: `https://numpy.org/doc/stable/reference/generated/numpy.histogram.html - `_. Default value is + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is None. - :paramtype histogram_range: str - :return: TilerStacItemStatistics. The TilerStacItemStatistics is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerStacItemStatistics + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TilerStacItemStatistics] = kwargs.pop("cls", None) - - _request = build_data_list_statistics_request( - collection_id=collection_id, - item_id=item_id, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - resampling=resampling, - max_size=max_size, - categorical=categorical, - categories_pixels=categories_pixels, - percentiles=percentiles, - histogram_bins=histogram_bins, - histogram_range=histogram_range, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerStacItemStatistics, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore @distributed_trace - def get_tile_json( # pylint: disable=too-many-locals + def crop_searches_feature_geo_json_format( # pylint: disable=too-many-locals self, - collection_id: str, - item_id: str, - tile_matrix_set_id: str, + search_id: str, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - buffer: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + height: Optional[int] = None, + width: Optional[int] = None, color_formula: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, **kwargs: Any - ) -> _models.TileJsonMetadata: - """TileJson Tilematrixsetid As Path. + ) -> Iterator[bytes]: + """Searches Geojson Feature Crop With Format. - Return the TileJson Tilematrixsetid As a path. + Create image from a geojson feature with format. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword tile_format: Default will be automatically defined if the output image needs a mask - (png) or - not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). Default value is None. - :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat - :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles - (e.g., 1=256x256, 2=512x512). Default value is None. - :paramtype tile_scale: int - :keyword min_zoom: Overwrite default minzoom. Default value is None. - :paramtype min_zoom: int - :keyword max_zoom: Overwrite default maxzoom. Default value is None. - :paramtype max_zoom: int - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword height: Height in pixels for the output image. Default value is None. + :paramtype height: int + :keyword width: Width in pixels for the output image. Default value is None. + :paramtype width: int :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -12609,15 +36995,21 @@ def get_tile_json( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileJsonMetadata + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12628,35 +37020,59 @@ def get_tile_json( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_tile_json_request( - collection_id=collection_id, - item_id=item_id, - tile_matrix_set_id=tile_matrix_set_id, + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_searches_feature_geo_json_format_request( + search_id=search_id, + format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, - tile_format=tile_format, - tile_scale=tile_scale, - min_zoom=min_zoom, - max_zoom=max_zoom, - buffer=buffer, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, + height=height, + width=width, color_formula=color_formula, + collection=collection, resampling=resampling, + pixel_selection=pixel_selection, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, + destination_crs=destination_crs, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -12665,7 +37081,8 @@ def get_tile_json( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12681,99 +37098,343 @@ def get_tile_json( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TileJsonMetadata, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def get_tile( # pylint: disable=too-many-locals + @overload + def crop_searches_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals self, - collection_id: str, - item_id: str, - tile_matrix_set_id: str, - z: float, - x: float, - y: float, - scale: float, + search_id: str, + width: int, + height: int, format: str, + body: _models.Feature, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - buffer: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, color_formula: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, - subdataset_name: Optional[str] = None, - subdataset_bands: Optional[List[str]] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any ) -> Iterator[bytes]: - """Tile Tilematrixsetid As Path. + """Searches Geojson Feature Crop With Dimensions. - Create map tile from a dataset. + Create image from a geojson feature with dimensions. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str - :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and - representing the scaleDenominator the tile. Required. - :type z: float - :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the - MatrixHeight-1 for the selected TileMatrix. Required. - :type x: float - :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the - MatrixWidth-1 for the selected TileMatrix. Required. - :type y: float - :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. - :type scale: float + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: ~azure.planetarycomputer.models.Feature + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def crop_searches_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals + self, + search_id: str, + width: int, + height: int, + format: str, + body: JSON, + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Searches Geojson Feature Crop With Dimensions. + + Create image from a geojson feature with dimensions. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. :type format: str + :param body: Request GeoJson body. Required. + :type body: JSON + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -12806,179 +37467,348 @@ def get_tile( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. - :paramtype subdataset_name: str - :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is - None. - :paramtype subdataset_bands: list[str] + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_data_get_tile_request( - collection_id=collection_id, - item_id=item_id, - tile_matrix_set_id=tile_matrix_set_id, - z=z, - x=x, - y=y, - scale=scale, - format=format, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - algorithm=algorithm, - algorithm_params=algorithm_params, - buffer=buffer, - color_formula=color_formula, - resampling=resampling, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, - subdataset_name=subdataset_name, - subdataset_bands=subdataset_bands, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + @overload + def crop_searches_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals + self, + search_id: str, + width: int, + height: int, + format: str, + body: IO[bytes], + *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Searches Geojson Feature Crop With Dimensions. - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + Create image from a geojson feature with dimensions. - return deserialized # type: ignore + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Required. + :type body: IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get_wmts_capabilities( # pylint: disable=too-many-locals + def crop_searches_feature_geo_json_width_by_height( # pylint: disable=name-too-long,too-many-locals self, - collection_id: str, - item_id: str, - tile_matrix_set_id: str, + search_id: str, + width: int, + height: int, + format: str, + body: Union[_models.Feature, JSON, IO[bytes]], *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - buffer: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, + max_size: Optional[int] = None, color_formula: Optional[str] = None, + collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, rescale: Optional[List[str]] = None, color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + destination_crs: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - """Wmts Tilematrixsetid As Path. + """Searches Geojson Feature Crop With Dimensions. - OGC WMTS endpoint. + Create image from a geojson feature with dimensions. - :param collection_id: STAC Collection Identifier. Required. - :type collection_id: str - :param item_id: STAC Item Identifier. Required. - :type item_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param width: Width in pixels for the output image. Required. + :type width: int + :param height: Height in pixels for the output image. Required. + :type height: int + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :param body: Request GeoJson body. Is one of the following types: Feature, JSON, IO[bytes] + Required. + :type body: ~azure.planetarycomputer.models.Feature or JSON or IO[bytes] + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm :keyword algorithm_params: Terrain algorithm parameters. Default value is None. :paramtype algorithm_params: str - :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", - "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. - :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat - :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles - (e.g., 1=256x256, 2=512x512). Default value is None. - :paramtype tile_scale: int - :keyword min_zoom: Overwrite default minzoom. Default value is None. - :paramtype min_zoom: int - :keyword max_zoom: Overwrite default maxzoom. Default value is None. - :paramtype max_zoom: int - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword max_size: Image output size limit if width and height limits are not set. Default + value is None. + :paramtype max_size: int :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. :paramtype rescale: list[str] @@ -13011,13 +37841,19 @@ def get_wmts_capabilities( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool + :keyword destination_crs: Output Coordinate Reference System. Default value is None. + :paramtype destination_crs: str :return: Iterator[bytes] :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: @@ -13030,35 +37866,59 @@ def get_wmts_capabilities( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_wmts_capabilities_request( - collection_id=collection_id, - item_id=item_id, - tile_matrix_set_id=tile_matrix_set_id, + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_crop_searches_feature_geo_json_width_by_height_request( + search_id=search_id, + width=width, + height=height, + format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, - tile_format=tile_format, - tile_scale=tile_scale, - min_zoom=min_zoom, - max_zoom=max_zoom, - buffer=buffer, + coordinate_reference_system=coordinate_reference_system, + max_size=max_size, color_formula=color_formula, + collection=collection, resampling=resampling, + pixel_selection=pixel_selection, rescale=rescale, color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, + destination_crs=destination_crs, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -13067,6 +37927,7 @@ def get_wmts_capabilities( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13085,8 +37946,14 @@ def get_wmts_capabilities( # pylint: disable=too-many-locals response_headers = {} response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -13094,120 +37961,70 @@ def get_wmts_capabilities( # pylint: disable=too-many-locals return deserialized # type: ignore @distributed_trace - def get_class_map_legend( - self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any - ) -> _models.ClassMapLegendResponse: - """Get ClassMap Legend. - - Generate values and color swatches mapping for a given classmap. - - :param classmap_name: classmap name. Required. - :type classmap_name: str - :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. - :paramtype trim_start: int - :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. - :paramtype trim_end: int - :return: ClassMapLegendResponse. The ClassMapLegendResponse is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.ClassMapLegendResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.ClassMapLegendResponse] = kwargs.pop("cls", None) - - _request = build_data_get_class_map_legend_request( - classmap_name=classmap_name, - trim_start=trim_start, - trim_end=trim_end, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ClassMapLegendResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_interval_legend( - self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any - ) -> List[List[List[int]]]: - """Get Interval Legend. - - Generate values and color swatches mapping for a given interval classmap. - - Returns a color map for intervals, where each interval is defined by: - - * A numeric range `[min, max]` representing the interval boundaries. - * An RGBA color `[red, green, blue, alpha]` associated with the interval. - - The response is a 2D array of interval definitions, where each element is a pair: - - * The first element is an array of two numbers `[min, max]` defining the interval. - * The second element is an array of four numbers `[red, green, blue, alpha]` defining the RGBA - color. - - Example: - - .. code-block:: json - - [ - [ - [-2, 0], [0, 0, 0, 0] - ], - [ - [1, 32], [255, 255, 178, 255] - ] - ] - - This example defines two intervals: - - * The interval `[-2, 0]` is mapped to the color `[0, 0, 0, 0]` (transparent black). - * The interval `[1, 32]` is mapped to the color `[255, 255, 178, 255]` (opaque yellow). - - :param classmap_name: classmap name. Required. - :type classmap_name: str - :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. - :paramtype trim_start: int - :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. - :paramtype trim_end: int - :return: list of list of list of int - :rtype: list[list[list[int]]] + def get_searches_wmts_capabilities( # pylint: disable=too-many-locals + self, + search_id: str, + *, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Searches Wmts. + + OGC WMTS endpoint. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: + 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", + "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13221,12 +38038,23 @@ def get_interval_legend( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[List[List[int]]]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_interval_legend_request( - classmap_name=classmap_name, - trim_start=trim_start, - trim_end=trim_end, + _request = build_data_get_searches_wmts_capabilities_request( + search_id=search_id, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, api_version=self._config.api_version, headers=_headers, params=_params, @@ -13236,7 +38064,8 @@ def get_interval_legend( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13255,10 +38084,7 @@ def get_interval_legend( response_headers = {} response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[List[List[int]]], response.json()) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -13266,36 +38092,195 @@ def get_interval_legend( return deserialized # type: ignore @distributed_trace - def get_legend( + def get_searches_tile_json( # pylint: disable=too-many-locals self, - color_map_name: str, + search_id: str, *, - height: Optional[float] = None, - width: Optional[float] = None, - trim_start: Optional[int] = None, - trim_end: Optional[int] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, + tile_scale: Optional[int] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + padding: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection_id: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + rescale: Optional[List[str]] = None, + colormap_name: Optional[Union[str, _models.ColorMapNames]] = None, + colormap: Optional[str] = None, + return_mask: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: - """Get Legend. - - Generate a legend image for a given colormap. + ) -> _models.TileJsonMetadata: + """Searches TileJson. - If the colormap has non-contiguous values at the beginning or end, - which aren't desired in the output image, they can be trimmed by specifying - the number of values to trim. + Return TileJSON document for a search. - :param color_map_name: The name of the registered colormap to generate a legend for. Required. - :type color_map_name: str - :keyword height: The output height of the legend image. Default value is None. - :paramtype height: float - :keyword width: The output width of the legend image. Default value is None. - :paramtype width: float - :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. - :paramtype trim_start: int - :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. - :paramtype trim_end: int - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword tile_format: Default will be automatically defined if the output image needs a mask + (png) or + not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + Default value is None. + :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles + (e.g., 1=256x256, 2=512x512). Default value is None. + :paramtype tile_scale: int + :keyword min_zoom: Overwrite default minzoom. Default value is None. + :paramtype min_zoom: int + :keyword max_zoom: Overwrite default maxzoom. Default value is None. + :paramtype max_zoom: int + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection_id: STAC Collection ID. Default value is None. + :paramtype collection_id: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword colormap_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype colormap_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword colormap: JSON encoded custom Colormap. Default value is None. + :paramtype colormap: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TileJsonMetadata :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13309,14 +38294,46 @@ def get_legend( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) - _request = build_data_get_legend_request( - color_map_name=color_map_name, - height=height, - width=width, - trim_start=trim_start, - trim_end=trim_end, + _request = build_data_get_searches_tile_json_request( + search_id=search_id, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + tile_matrix_set_id=tile_matrix_set_id, + tile_format=tile_format, + tile_scale=tile_scale, + min_zoom=min_zoom, + max_zoom=max_zoom, + padding=padding, + buffer=buffer, + color_formula=color_formula, + collection_id=collection_id, + resampling=resampling, + pixel_selection=pixel_selection, + algorithm=algorithm, + algorithm_params=algorithm_params, + rescale=rescale, + colormap_name=colormap_name, + colormap=colormap, + return_mask=return_mask, api_version=self._config.api_version, headers=_headers, params=_params, @@ -13326,7 +38343,8 @@ def get_legend( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", True) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13342,62 +38360,210 @@ def get_legend( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TileJsonMetadata, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def get_mosaics_assets_for_point( + def get_searches_tile_no_tms( # pylint: disable=too-many-locals self, search_id: str, - longitude: float, - latitude: float, + z: float, + x: float, + y: float, *, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, scan_limit: Optional[int] = None, items_limit: Optional[int] = None, time_limit: Optional[int] = None, exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, - coordinate_reference_system: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> List[_models.StacItemPointAsset]: - """Assets For Point. + ) -> Iterator[bytes]: + """Searches Tile Plain. - Return a list of assets for a given point. + The most basic operation. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param longitude: Longitude. Required. - :type longitude: float - :param latitude: Latitude. Required. - :type latitude: float - :keyword scan_limit: Return as soon as we scan N items (defaults to 10000 in PgSTAC). Default - value is None. + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. :paramtype scan_limit: int - :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100 in - PgSTAC). Default value is None. + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. :paramtype items_limit: int - :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5 in PgSTAC). - Default value is None. + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. :paramtype time_limit: int - :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True in - PgSTAC). Default value is None. + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. :paramtype exit_when_full: bool :keyword skip_covered: Skip any items that would show up completely under the previous items (defaults - to True in PgSTAC). Default value is None. + to True). Default value is None. :paramtype skip_covered: bool - :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default - to ``epsg:4326``. Default value is None. - :paramtype coordinate_reference_system: str - :return: list of StacItemPointAsset - :rtype: list[~azure.planetarycomputer.models.StacItemPointAsset] + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13411,18 +38577,47 @@ def get_mosaics_assets_for_point( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.StacItemPointAsset]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_assets_for_point_request( + _request = build_data_get_searches_tile_no_tms_request( search_id=search_id, - longitude=longitude, - latitude=latitude, + z=z, + x=x, + y=y, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, scan_limit=scan_limit, items_limit=items_limit, time_limit=time_limit, exit_when_full=exit_when_full, skip_covered=skip_covered, - coordinate_reference_system=coordinate_reference_system, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -13432,7 +38627,8 @@ def get_mosaics_assets_for_point( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13448,41 +38644,72 @@ def get_mosaics_assets_for_point( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.StacItemPointAsset], response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_mosaics_assets_for_tile( + def get_searches_tile_no_tms_by_format( # pylint: disable=too-many-locals self, search_id: str, - tile_matrix_set_id: str, z: float, x: float, y: float, + format: str, *, - collection_id: str, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, scan_limit: Optional[int] = None, items_limit: Optional[int] = None, time_limit: Optional[int] = None, exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + scale: Optional[int] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> List[_models.TilerAssetGeoJson]: - """Assets For Tile Tilematrixsetid As Path. + ) -> Iterator[bytes]: + """Searches Tile Format. - Return a list of assets which overlap a given tile. + The most basic operation. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and representing the scaleDenominator the tile. Required. :type z: float @@ -13492,26 +38719,140 @@ def get_mosaics_assets_for_tile( :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the MatrixWidth-1 for the selected TileMatrix. Required. :type y: float - :keyword collection_id: STAC Collection Identifier. Required. - :paramtype collection_id: str - :keyword scan_limit: Return as soon as we scan N items (defaults to 10000 in PgSTAC). Default - value is None. + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. :paramtype scan_limit: int - :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100 in - PgSTAC). Default value is None. + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. :paramtype items_limit: int - :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5 in PgSTAC). - Default value is None. + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. :paramtype time_limit: int - :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True in - PgSTAC). Default value is None. + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. :paramtype exit_when_full: bool :keyword skip_covered: Skip any items that would show up completely under the previous items (defaults - to True in PgSTAC). Default value is None. + to True). Default value is None. :paramtype skip_covered: bool - :return: list of TilerAssetGeoJson - :rtype: list[~azure.planetarycomputer.models.TilerAssetGeoJson] + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword scale: Numeric scale factor for the tile. Higher values produce larger tiles. Default + value is None. + :paramtype scale: int + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13525,20 +38866,47 @@ def get_mosaics_assets_for_tile( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.TilerAssetGeoJson]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_assets_for_tile_request( + _request = build_data_get_searches_tile_no_tms_by_format_request( search_id=search_id, - tile_matrix_set_id=tile_matrix_set_id, z=z, x=x, y=y, - collection_id=collection_id, + format=format, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, scan_limit=scan_limit, items_limit=items_limit, time_limit=time_limit, exit_when_full=exit_when_full, skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + scale=scale, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -13548,7 +38916,8 @@ def get_mosaics_assets_for_tile( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13564,221 +38933,215 @@ def get_mosaics_assets_for_tile( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(List[_models.TilerAssetGeoJson], response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_mosaics_search_info(self, search_id: str, **kwargs: Any) -> _models.TilerStacSearchRegistration: - """Info Search. - - Get Search query metadata. - - :param search_id: Search Id (pgSTAC Search Hash). Required. - :type search_id: str - :return: TilerStacSearchRegistration. The TilerStacSearchRegistration is compatible with - MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerStacSearchRegistration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TilerStacSearchRegistration] = kwargs.pop("cls", None) - - _request = build_data_get_mosaics_search_info_request( - search_id=search_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerStacSearchRegistration, response.json()) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def register_mosaics_search( - self, - *, - content_type: str = "application/json", - collections: Optional[List[str]] = None, - ids: Optional[List[str]] = None, - bounding_box: Optional[float] = None, - intersects: Optional[_models.Geometry] = None, - query: Optional[dict[str, Any]] = None, - filter: Optional[dict[str, Any]] = None, - datetime: Optional[str] = None, - sort_by: Optional[List[_models.StacSortExtension]] = None, - filter_language: Optional[Union[str, _models.FilterLanguage]] = None, - metadata: Optional[_models.MosaicMetadata] = None, - **kwargs: Any - ) -> _models.TilerMosaicSearchRegistrationResponse: - """Register Search. - - Register a Search query. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword collections: List of STAC collection IDs to include in the mosaic. Default value is - None. - :paramtype collections: list[str] - :keyword ids: List of specific STAC item IDs to include in the mosaic. Default value is None. - :paramtype ids: list[str] - :keyword bounding_box: Geographic bounding box to filter items [west, south, east, north]. - Default value is None. - :paramtype bounding_box: float - :keyword intersects: GeoJSON geometry to spatially filter items by intersection. Default value - is None. - :paramtype intersects: ~azure.planetarycomputer.models.Geometry - :keyword query: Query. Default value is None. - :paramtype query: dict[str, any] - :keyword filter: Filter. Default value is None. - :paramtype filter: dict[str, any] - :keyword datetime: Temporal filter in RFC 3339 format or interval. Default value is None. - :paramtype datetime: str - :keyword sort_by: Criteria for ordering items in the mosaic. Default value is None. - :paramtype sort_by: list[~azure.planetarycomputer.models.StacSortExtension] - :keyword filter_language: Query language format used in the filter parameter. Known values are: - "cql-json", "cql2-json", and "cql2-text". Default value is None. - :paramtype filter_language: str or ~azure.planetarycomputer.models.FilterLanguage - :keyword metadata: Additional metadata to associate with the mosaic. Default value is None. - :paramtype metadata: ~azure.planetarycomputer.models.MosaicMetadata - :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is - compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def register_mosaics_search( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TilerMosaicSearchRegistrationResponse: - """Register Search. - - Register a Search query. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is - compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def register_mosaics_search( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.TilerMosaicSearchRegistrationResponse: - """Register Search. - - Register a Search query. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is - compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def register_mosaics_search( # pylint: disable=too-many-locals + def get_searches_tile_no_tms_by_scale( # pylint: disable=too-many-locals self, - body: Union[JSON, IO[bytes]] = _Unset, + search_id: str, + z: float, + x: float, + y: float, + scale: float, *, - collections: Optional[List[str]] = None, - ids: Optional[List[str]] = None, - bounding_box: Optional[float] = None, - intersects: Optional[_models.Geometry] = None, - query: Optional[dict[str, Any]] = None, - filter: Optional[dict[str, Any]] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, datetime: Optional[str] = None, - sort_by: Optional[List[_models.StacSortExtension]] = None, - filter_language: Optional[Union[str, _models.FilterLanguage]] = None, - metadata: Optional[_models.MosaicMetadata] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, + algorithm_params: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + format: Optional[Union[str, _models.TilerImageFormat]] = None, + buffer: Optional[float] = None, + color_formula: Optional[str] = None, + collection: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, + rescale: Optional[List[str]] = None, + color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, + color_map: Optional[str] = None, + return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> _models.TilerMosaicSearchRegistrationResponse: - """Register Search. + ) -> Iterator[bytes]: + """Searches Tile Scale. - Register a Search query. + The most basic operation. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword collections: List of STAC collection IDs to include in the mosaic. Default value is + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is None. - :paramtype collections: list[str] - :keyword ids: List of specific STAC item IDs to include in the mosaic. Default value is None. - :paramtype ids: list[str] - :keyword bounding_box: Geographic bounding box to filter items [west, south, east, north]. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). Default value is None. - :paramtype bounding_box: float - :keyword intersects: GeoJSON geometry to spatially filter items by intersection. Default value - is None. - :paramtype intersects: ~azure.planetarycomputer.models.Geometry - :keyword query: Query. Default value is None. - :paramtype query: dict[str, any] - :keyword filter: Filter. Default value is None. - :paramtype filter: dict[str, any] - :keyword datetime: Temporal filter in RFC 3339 format or interval. Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. :paramtype datetime: str - :keyword sort_by: Criteria for ordering items in the mosaic. Default value is None. - :paramtype sort_by: list[~azure.planetarycomputer.models.StacSortExtension] - :keyword filter_language: Query language format used in the filter parameter. Known values are: - "cql-json", "cql2-json", and "cql2-text". Default value is None. - :paramtype filter_language: str or ~azure.planetarycomputer.models.FilterLanguage - :keyword metadata: Additional metadata to associate with the mosaic. Default value is None. - :paramtype metadata: ~azure.planetarycomputer.models.MosaicMetadata - :return: TilerMosaicSearchRegistrationResponse. The TilerMosaicSearchRegistrationResponse is - compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :keyword format: Output format for the tile or image (e.g., png, jpeg, webp). Known values are: + "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. + :paramtype format: str or ~azure.planetarycomputer.models.TilerImageFormat + :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. + Output + **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, + 1.0 = 258x258). Default value is None. + :paramtype buffer: float + :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color + `_). Default value is None. + :paramtype color_formula: str + :keyword collection: STAC Collection ID. Default value is None. + :paramtype collection: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. + :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection + :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple + bands. Default value is None. + :paramtype rescale: list[str] + :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", + "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", + "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", + "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", + "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", + "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", + "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", + "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", + "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", + "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", + "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", + "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", + "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", + "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", + "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", + "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", + "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", + "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", + "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", + "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", + "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", + "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", + "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", + "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", + "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", + "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", + "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", + "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", + "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. + :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames + :keyword color_map: JSON encoded custom Colormap. Default value is None. + :paramtype color_map: str + :keyword return_mask: Add mask to the output data. Default value is None. + :paramtype return_mask: bool + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13789,37 +39152,51 @@ def register_mosaics_search( # pylint: disable=too-many-locals } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TilerMosaicSearchRegistrationResponse] = kwargs.pop("cls", None) - - if body is _Unset: - body = { - "bbox": bounding_box, - "collections": collections, - "datetime_property": datetime, - "filter": filter, - "filter_lang": filter_language, - "ids": ids, - "intersects": intersects, - "metadata": metadata, - "query": query, - "sortby": sort_by, - } - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_register_mosaics_search_request( - content_type=content_type, + _request = build_data_get_searches_tile_no_tms_by_scale_request( + search_id=search_id, + z=z, + x=x, + y=y, + scale=scale, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + algorithm=algorithm, + algorithm_params=algorithm_params, + tile_matrix_set_id=tile_matrix_set_id, + format=format, + buffer=buffer, + color_formula=color_formula, + collection=collection, + resampling=resampling, + pixel_selection=pixel_selection, + rescale=rescale, + color_map_name=color_map_name, + color_map=color_map, + return_mask=return_mask, + padding=padding, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -13828,7 +39205,8 @@ def register_mosaics_search( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13844,40 +39222,55 @@ def register_mosaics_search( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TilerMosaicSearchRegistrationResponse, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_mosaics_tile_json( # pylint: disable=too-many-locals + def get_searches_tile_no_tms_by_scale_and_format( # pylint: disable=name-too-long,too-many-locals self, search_id: str, - tile_matrix_set_id: str, + z: float, + x: float, + y: float, + scale: float, + format: str, *, + bidx: Optional[List[int]] = None, assets: Optional[List[str]] = None, expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, + no_data: Optional[str] = None, unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, scan_limit: Optional[int] = None, items_limit: Optional[int] = None, time_limit: Optional[int] = None, exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, algorithm_params: Optional[str] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - buffer: Optional[str] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, + buffer: Optional[float] = None, color_formula: Optional[str] = None, collection: Optional[str] = None, resampling: Optional[Union[str, _models.Resampling]] = None, @@ -13886,67 +39279,97 @@ def get_mosaics_tile_json( # pylint: disable=too-many-locals color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, color_map: Optional[str] = None, return_mask: Optional[bool] = None, + padding: Optional[int] = None, **kwargs: Any - ) -> _models.TileJsonMetadata: - """TileJson Tilematrixsetid As Path. + ) -> Iterator[bytes]: + """Searches Tile. - Return TileJSON document for a searchId. + The most basic operation. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str + :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and + representing the scaleDenominator the tile. Required. + :type z: float + :param x: Column (X) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixHeight-1 for the selected TileMatrix. Required. + :type x: float + :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the + MatrixWidth-1 for the selected TileMatrix. Required. + :type y: float + :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. + :type scale: float + :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. + :type format: str + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] :keyword expression: Band math expression between assets. Default value is None. :paramtype expression: str :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str + :paramtype asset_band_indices: list[str] :keyword asset_as_band: Asset as Band. Default value is None. :paramtype asset_as_band: bool :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float + :paramtype no_data: str :keyword unscale: Apply internal Scale or Offset. Default value is None. :paramtype unscale: bool - :keyword scan_limit: Return as soon as we scan N items (defaults to 10000 in PgSTAC). Default - value is None. + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value + is None. + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. :paramtype scan_limit: int - :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100 in - PgSTAC). Default value is None. + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. :paramtype items_limit: int - :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5 in PgSTAC). - Default value is None. + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. :paramtype time_limit: int - :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True in - PgSTAC). Default value is None. + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. :paramtype exit_when_full: bool :keyword skip_covered: Skip any items that would show up completely under the previous items (defaults - to True in PgSTAC). Default value is None. + to True). Default value is None. :paramtype skip_covered: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword min_zoom: Overwrite default minzoom. Default value is None. - :paramtype min_zoom: int - :keyword max_zoom: Overwrite default maxzoom. Default value is None. - :paramtype max_zoom: int - :keyword tile_format: Default will be automatically defined if the output image needs a mask - (png) or - not (jpeg). Known values are: "png", "npy", "tif", "jpeg", "jpg", "jp2", "webp", and "pngraw". + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". Default value is None. - :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat - :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles - (e.g., 1=256x256, 2=512x512). Default value is None. - :paramtype tile_scale: int + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", + "normalizedIndex", "terrarium", "terrainrgb", "slope", "cast", "ceil", "floor", "min", "max", + "median", "mean", "std", and "var". Default value is None. + :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm + :keyword algorithm_params: Terrain algorithm parameters. Default value is None. + :paramtype algorithm_params: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. Output **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, 1.0 = 258x258). Default value is None. - :paramtype buffer: str + :paramtype buffer: float :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color `_). Default value is None. :paramtype color_formula: str @@ -13956,7 +39379,8 @@ def get_mosaics_tile_json( # pylint: disable=too-many-locals "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", - "lowest", "mean", "median", "stdev", "lastbandlow", and "lastbandhigh". Default value is None. + "lowest", "mean", "median", "stdev", "lastbandlow", "lastbandhigh", and "count". Default value + is None. :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple bands. Default value is None. @@ -13990,15 +39414,22 @@ def get_mosaics_tile_json( # pylint: disable=too-many-locals "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. + "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", "ylorrd_r", "algae", "algae_r", + "amp", "amp_r", "balance", "balance_r", "curl", "curl_r", "deep", "deep_r", "delta", "delta_r", + "dense", "dense_r", "diff", "diff_r", "haline", "haline_r", "ice", "ice_r", "matter", + "matter_r", "oxy", "oxy_r", "phase", "phase_r", "rain", "rain_r", "solar", "solar_r", "speed", + "speed_r", "tarn", "tarn_r", "tempo", "tempo_r", "thermal", "thermal_r", "topo", "topo_r", + "turbid", "turbid_r", "turbo", and "turbo_r". Default value is None. :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames :keyword color_map: JSON encoded custom Colormap. Default value is None. :paramtype color_map: str :keyword return_mask: Add mask to the output data. Default value is None. :paramtype return_mask: bool - :return: TileJsonMetadata. The TileJsonMetadata is compatible with MutableMapping - :rtype: ~azure.planetarycomputer.models.TileJsonMetadata + :keyword padding: Padding to apply to each tile edge. Helps reduce resampling artefacts along + edges. Defaults to ``0``. Default value is None. + :paramtype padding: int + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14012,28 +39443,37 @@ def get_mosaics_tile_json( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TileJsonMetadata] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_tile_json_request( + _request = build_data_get_searches_tile_no_tms_by_scale_and_format_request( search_id=search_id, - tile_matrix_set_id=tile_matrix_set_id, + z=z, + x=x, + y=y, + scale=scale, + format=format, + bidx=bidx, assets=assets, expression=expression, asset_band_indices=asset_band_indices, asset_as_band=asset_as_band, no_data=no_data, unscale=unscale, + reproject=reproject, scan_limit=scan_limit, items_limit=items_limit, time_limit=time_limit, exit_when_full=exit_when_full, skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, algorithm=algorithm, algorithm_params=algorithm_params, - min_zoom=min_zoom, - max_zoom=max_zoom, - tile_format=tile_format, - tile_scale=tile_scale, + tile_matrix_set_id=tile_matrix_set_id, buffer=buffer, color_formula=color_formula, collection=collection, @@ -14043,6 +39483,7 @@ def get_mosaics_tile_json( # pylint: disable=too-many-locals color_map_name=color_map_name, color_map=color_map, return_mask=return_mask, + padding=padding, api_version=self._config.api_version, headers=_headers, params=_params, @@ -14052,7 +39493,8 @@ def get_mosaics_tile_json( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14068,59 +39510,51 @@ def get_mosaics_tile_json( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.TileJsonMetadata, response.json()) + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def get_mosaics_tile( # pylint: disable=too-many-locals + def get_searches_assets_for_tile_no_tms( # pylint: disable=too-many-locals self, search_id: str, - tile_matrix_set_id: str, z: float, x: float, y: float, - scale: float, - format: str, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, scan_limit: Optional[int] = None, items_limit: Optional[int] = None, time_limit: Optional[int] = None, exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - buffer: Optional[str] = None, - color_formula: Optional[str] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, collection: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - pixel_selection: Optional[Union[str, _models.PixelSelection]] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, + tile_matrix_set_id: Optional[Union[str, _models.TileMatrixSetId]] = None, **kwargs: Any - ) -> Iterator[bytes]: - """Tile Tilematrixsetid As Path. + ) -> List[Any]: + """Searches Assets For Tile. - Create map tile. + The most basic operation. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str :param z: Identifier (Z) selecting one of the scales defined in the TileMatrixSet and representing the scaleDenominator the tile. Required. :type z: float @@ -14130,101 +39564,221 @@ def get_mosaics_tile( # pylint: disable=too-many-locals :param y: Row (Y) index of the tile on the selected TileMatrix. It cannot exceed the MatrixWidth-1 for the selected TileMatrix. Required. :type y: float - :param scale: Numeric scale factor for the tile. Higher values produce larger tiles. Required. - :type scale: float - :param format: Output format for the tile or image (e.g., png, jpeg, webp). Required. - :type format: str - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword scan_limit: Return as soon as we scan N items (defaults to 10000 in PgSTAC). Default - value is None. + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. :paramtype scan_limit: int - :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100 in - PgSTAC). Default value is None. + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. :paramtype items_limit: int - :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5 in PgSTAC). + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported + (default: 'WebMercatorQuad'). Known values are: "CanadianNAD83_LCC", "EuropeanETRS89_LAEAQuad", + "LINZAntarticaMapTilegrid", "NZTM2000Quad", "UPSAntarcticWGS84Quad", "UPSArcticWGS84Quad", + "UTM31WGS84Quad", "WGS1984Quad", "WebMercatorQuad", "WorldCRS84Quad", and + "WorldMercatorWGS84Quad". Default value is None. + :paramtype tile_matrix_set_id: str or ~azure.planetarycomputer.models.TileMatrixSetId + :return: list of any + :rtype: list[any] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[Any]] = kwargs.pop("cls", None) + + _request = build_data_get_searches_assets_for_tile_no_tms_request( + search_id=search_id, + z=z, + x=x, + y=y, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + tile_matrix_set_id=tile_matrix_set_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[Any], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_searches_point( # pylint: disable=too-many-locals + self, + search_id: str, + longitude: float, + latitude: float, + *, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + bidx: Optional[List[int]] = None, + assets: Optional[List[str]] = None, + expression: Optional[str] = None, + asset_band_indices: Optional[List[str]] = None, + asset_as_band: Optional[bool] = None, + no_data: Optional[str] = None, + unscale: Optional[bool] = None, + reproject: Optional[Union[str, _models.WarpKernelResampling]] = None, + coordinate_reference_system: Optional[str] = None, + resampling: Optional[Union[str, _models.Resampling]] = None, + **kwargs: Any + ) -> _models.TilerCoreModelsResponsesPoint: + """Searches Point. + + Get Point value for a search dataset. + + :param search_id: Search Id (pgSTAC Search Hash). Required. + :type search_id: str + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. :paramtype time_limit: int - :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True in - PgSTAC). Default value is None. + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. :paramtype exit_when_full: bool :keyword skip_covered: Skip any items that would show up completely under the previous items (defaults - to True in PgSTAC). Default value is None. + to True). Default value is None. :paramtype skip_covered: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword collection: STAC Collection ID. Default value is None. + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. :paramtype collection: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword pixel_selection: Pixel selection method. Known values are: "first", "highest", - "lowest", "mean", "median", "stdev", "lastbandlow", and "lastbandhigh". Default value is None. - :paramtype pixel_selection: str or ~azure.planetarycomputer.models.PixelSelection - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value + :keyword bidx: Dataset band indexes. Default value is None. + :paramtype bidx: list[int] + :keyword assets: Asset's names. Default value is None. + :paramtype assets: list[str] + :keyword expression: Band math expression between assets. Default value is None. + :paramtype expression: str + :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" + means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. + :paramtype asset_band_indices: list[str] + :keyword asset_as_band: Asset as Band. Default value is None. + :paramtype asset_as_band: bool + :keyword no_data: Overwrite internal Nodata value. Default value is None. + :paramtype no_data: str + :keyword unscale: Apply internal Scale or Offset. Default value is None. + :paramtype unscale: bool + :keyword reproject: WarpKernel resampling algorithm (only used when doing re-projection). + Defaults to ``nearest``. Known values are: "nearest", "bilinear", "cubic", "cubic_spline", + "lanczos", "average", "mode", "max", "min", "med", "q1", "q3", "sum", and "rms". Default value is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :paramtype reproject: str or ~azure.planetarycomputer.models.WarpKernelResampling + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", + "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. + :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling + :return: TilerCoreModelsResponsesPoint. The TilerCoreModelsResponsesPoint is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerCoreModelsResponsesPoint :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14238,38 +39792,34 @@ def get_mosaics_tile( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.TilerCoreModelsResponsesPoint] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_tile_request( + _request = build_data_get_searches_point_request( search_id=search_id, - tile_matrix_set_id=tile_matrix_set_id, - z=z, - x=x, - y=y, - scale=scale, - format=format, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, + longitude=longitude, + latitude=latitude, scan_limit=scan_limit, items_limit=items_limit, time_limit=time_limit, exit_when_full=exit_when_full, skip_covered=skip_covered, - algorithm=algorithm, - algorithm_params=algorithm_params, - buffer=buffer, - color_formula=color_formula, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, collection=collection, + bidx=bidx, + assets=assets, + expression=expression, + asset_band_indices=asset_band_indices, + asset_as_band=asset_as_band, + no_data=no_data, + unscale=unscale, + reproject=reproject, + coordinate_reference_system=coordinate_reference_system, resampling=resampling, - pixel_selection=pixel_selection, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, api_version=self._config.api_version, headers=_headers, params=_params, @@ -14279,7 +39829,8 @@ def get_mosaics_tile( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", True) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14295,137 +39846,87 @@ def get_mosaics_tile( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TilerCoreModelsResponsesPoint, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def get_mosaics_wmts_capabilities( # pylint: disable=too-many-locals + def get_searches_point_with_assets( # pylint: disable=too-many-locals self, search_id: str, - tile_matrix_set_id: str, + longitude: float, + latitude: float, *, - assets: Optional[List[str]] = None, - expression: Optional[str] = None, - asset_band_indices: Optional[str] = None, - asset_as_band: Optional[bool] = None, - no_data: Optional[float] = None, - unscale: Optional[bool] = None, - algorithm: Optional[Union[str, _models.TerrainAlgorithm]] = None, - algorithm_params: Optional[str] = None, - tile_format: Optional[Union[str, _models.TilerImageFormat]] = None, - tile_scale: Optional[int] = None, - min_zoom: Optional[int] = None, - max_zoom: Optional[int] = None, - buffer: Optional[str] = None, - color_formula: Optional[str] = None, - resampling: Optional[Union[str, _models.Resampling]] = None, - rescale: Optional[List[str]] = None, - color_map_name: Optional[Union[str, _models.ColorMapNames]] = None, - color_map: Optional[str] = None, - return_mask: Optional[bool] = None, + scan_limit: Optional[int] = None, + items_limit: Optional[int] = None, + time_limit: Optional[int] = None, + exit_when_full: Optional[bool] = None, + skip_covered: Optional[bool] = None, + subdataset_name: Optional[str] = None, + subdataset_bands: Optional[List[int]] = None, + crs: Optional[str] = None, + datetime: Optional[str] = None, + sel: Optional[List[str]] = None, + sel_method: Optional[Union[str, _models.SelMethod]] = None, + collection: Optional[str] = None, + coordinate_reference_system: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - """Wmts Tilematrixsetid As Path. + ) -> List[_models.StacItemPointAsset]: + """Searches Point Assets. - OGC WMTS endpoint. + Return a list of assets for a given point in a search. :param search_id: Search Id (pgSTAC Search Hash). Required. :type search_id: str - :param tile_matrix_set_id: Identifier selecting one of the TileMatrixSetId supported. Required. - :type tile_matrix_set_id: str - :keyword assets: Asset's names. Default value is None. - :paramtype assets: list[str] - :keyword expression: Band math expression between assets. Default value is None. - :paramtype expression: str - :keyword asset_band_indices: Per asset band indexes (coma separated indexes, e.g. "image|1,2,3" - means use the bands 1, 2, and 3 from the asset named "image"). Default value is None. - :paramtype asset_band_indices: str - :keyword asset_as_band: Asset as Band. Default value is None. - :paramtype asset_as_band: bool - :keyword no_data: Overwrite internal Nodata value. Default value is None. - :paramtype no_data: float - :keyword unscale: Apply internal Scale or Offset. Default value is None. - :paramtype unscale: bool - :keyword algorithm: Terrain algorithm name. Known values are: "hillshade", "contours", - "normalizedIndex", "terrarium", and "terrainrgb". Default value is None. - :paramtype algorithm: str or ~azure.planetarycomputer.models.TerrainAlgorithm - :keyword algorithm_params: Terrain algorithm parameters. Default value is None. - :paramtype algorithm_params: str - :keyword tile_format: Output image type. Default is png. Known values are: "png", "npy", "tif", - "jpeg", "jpg", "jp2", "webp", and "pngraw". Default value is None. - :paramtype tile_format: str or ~azure.planetarycomputer.models.TilerImageFormat - :keyword tile_scale: Tile scale factor affecting output size. Values > 1 produce larger tiles - (e.g., 1=256x256, 2=512x512). Default value is None. - :paramtype tile_scale: int - :keyword min_zoom: Overwrite default minzoom. Default value is None. - :paramtype min_zoom: int - :keyword max_zoom: Overwrite default maxzoom. Default value is None. - :paramtype max_zoom: int - :keyword buffer: Buffer on each side of the given tile. It must be a multiple of ``0.5``. - Output - **tilesize** will be expanded to ``tilesize + 2 * buffer`` (e.g 0.5 = 257x257, - 1.0 = 258x258). Default value is None. - :paramtype buffer: str - :keyword color_formula: rio-color formula (info: `https://github.com/mapbox/rio-color - `_). Default value is None. - :paramtype color_formula: str - :keyword resampling: Resampling method. Known values are: "nearest", "bilinear", "cubic", - "cubic_spline", "lanczos", "average", "mode", "gauss", and "rms". Default value is None. - :paramtype resampling: str or ~azure.planetarycomputer.models.Resampling - :keyword rescale: comma (',') delimited Min,Max range. Can set multiple time for multiple - bands. Default value is None. - :paramtype rescale: list[str] - :keyword color_map_name: Colormap name. Known values are: "accent", "accent_r", "afmhot", - "afmhot_r", "ai4g-lulc", "alos-fnf", "alos-palsar-mask", "autumn", "autumn_r", "binary", - "binary_r", "blues", "blues_r", "bone", "bone_r", "brbg", "brbg_r", "brg", "brg_r", "bugn", - "bugn_r", "bupu", "bupu_r", "bwr", "bwr_r", "c-cap", "cfastie", "chesapeake-lc-13", - "chesapeake-lc-7", "chesapeake-lu", "chloris-biomass", "cividis", "cividis_r", "cmrmap", - "cmrmap_r", "cool", "cool_r", "coolwarm", "coolwarm_r", "copper", "copper_r", "cubehelix", - "cubehelix_r", "dark2", "dark2_r", "drcog-lulc", "esa-cci-lc", "esa-worldcover", "flag", - "flag_r", "gap-lulc", "gist_earth", "gist_earth_r", "gist_gray", "gist_gray_r", "gist_heat", - "gist_heat_r", "gist_ncar", "gist_ncar_r", "gist_rainbow", "gist_rainbow_r", "gist_stern", - "gist_stern_r", "gist_yarg", "gist_yarg_r", "gnbu", "gnbu_r", "gnuplot", "gnuplot2", - "gnuplot2_r", "gnuplot_r", "gray", "gray_r", "greens", "greens_r", "greys", "greys_r", "hot", - "hot_r", "hsv", "hsv_r", "inferno", "inferno_r", "io-bii", "io-lulc", "io-lulc-9-class", "jet", - "jet_r", "jrc-change", "jrc-extent", "jrc-occurrence", "jrc-recurrence", "jrc-seasonality", - "jrc-transitions", "lidar-classification", "lidar-hag", "lidar-hag-alternative", - "lidar-intensity", "lidar-returns", "magma", "magma_r", "modis-10A1", "modis-10A2", - "modis-13A1|Q1", "modis-14A1|A2", "modis-15A2H|A3H", "modis-16A3GF-ET", "modis-16A3GF-PET", - "modis-17A2H|A2HGF", "modis-17A3HGF", "modis-64A1", "mtbs-severity", "nipy_spectral", - "nipy_spectral_r", "nrcan-lulc", "ocean", "ocean_r", "oranges", "oranges_r", "orrd", "orrd_r", - "paired", "paired_r", "pastel1", "pastel1_r", "pastel2", "pastel2_r", "pink", "pink_r", "piyg", - "piyg_r", "plasma", "plasma_r", "prgn", "prgn_r", "prism", "prism_r", "pubu", "pubu_r", - "pubugn", "pubugn_r", "puor", "puor_r", "purd", "purd_r", "purples", "purples_r", "qpe", - "rainbow", "rainbow_r", "rdbu", "rdbu_r", "rdgy", "rdgy_r", "rdpu", "rdpu_r", "rdylbu", - "rdylbu_r", "rdylgn", "rdylgn_r", "reds", "reds_r", "rplumbo", "schwarzwald", "seismic", - "seismic_r", "set1", "set1_r", "set2", "set2_r", "set3", "set3_r", "spectral", "spectral_r", - "spring", "spring_r", "summer", "summer_r", "tab10", "tab10_r", "tab20", "tab20_r", "tab20b", - "tab20b_r", "tab20c", "tab20c_r", "terrain", "terrain_r", "twilight", "twilight_r", - "twilight_shifted", "twilight_shifted_r", "usda-cdl", "usda-cdl-corn", "usda-cdl-cotton", - "usda-cdl-soybeans", "usda-cdl-wheat", "usgs-lcmap", "viirs-10a1", "viirs-13a1", "viirs-14a1", - "viirs-15a2H", "viridis", "viridis_r", "winter", "winter_r", "wistia", "wistia_r", "ylgn", - "ylgn_r", "ylgnbu", "ylgnbu_r", "ylorbr", "ylorbr_r", "ylorrd", and "ylorrd_r". Default value - is None. - :paramtype color_map_name: str or ~azure.planetarycomputer.models.ColorMapNames - :keyword color_map: JSON encoded custom Colormap. Default value is None. - :paramtype color_map: str - :keyword return_mask: Add mask to the output data. Default value is None. - :paramtype return_mask: bool - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param longitude: Longitude. Required. + :type longitude: float + :param latitude: Latitude. Required. + :type latitude: float + :keyword scan_limit: Return as soon as we scan N items (defaults to 10000). Default value is + None. + :paramtype scan_limit: int + :keyword items_limit: Return as soon as we have N items per geometry (defaults to 100). Default + value is None. + :paramtype items_limit: int + :keyword time_limit: Return after N seconds to avoid long requests (defaults to 5). Default + value is None. + :paramtype time_limit: int + :keyword exit_when_full: Return as soon as the geometry is fully covered (defaults to True). + Default value is None. + :paramtype exit_when_full: bool + :keyword skip_covered: Skip any items that would show up completely under the previous items + (defaults + to True). Default value is None. + :paramtype skip_covered: bool + :keyword subdataset_name: The name of a subdataset within the asset. Default value is None. + :paramtype subdataset_name: str + :keyword subdataset_bands: The index of a subdataset band within the asset. Default value is + None. + :paramtype subdataset_bands: list[int] + :keyword crs: Coordinate Reference System. Default value is None. + :paramtype crs: str + :keyword datetime: Datetime to use for subsetting the asset. Default value is None. + :paramtype datetime: str + :keyword sel: Xarray Indexing using dimension names ``{dimension}={value}``. Default value is + None. + :paramtype sel: list[str] + :keyword sel_method: Xarray indexing method to use for inexact matches. Known values are: + "nearest", "linear", "bilinear", "cubic", "cubic_spline", "lanczos", "area", and "mode". + Default value is None. + :paramtype sel_method: str or ~azure.planetarycomputer.models.SelMethod + :keyword collection: STAC Collection Identifier. Default value is None. + :paramtype collection: str + :keyword coordinate_reference_system: Coordinate Reference System of the input coords. Default + to ``epsg:4326``. Default value is None. + :paramtype coordinate_reference_system: str + :return: list of StacItemPointAsset + :rtype: list[~azure.planetarycomputer.models.StacItemPointAsset] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14439,30 +39940,25 @@ def get_mosaics_wmts_capabilities( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.StacItemPointAsset]] = kwargs.pop("cls", None) - _request = build_data_get_mosaics_wmts_capabilities_request( + _request = build_data_get_searches_point_with_assets_request( search_id=search_id, - tile_matrix_set_id=tile_matrix_set_id, - assets=assets, - expression=expression, - asset_band_indices=asset_band_indices, - asset_as_band=asset_as_band, - no_data=no_data, - unscale=unscale, - algorithm=algorithm, - algorithm_params=algorithm_params, - tile_format=tile_format, - tile_scale=tile_scale, - min_zoom=min_zoom, - max_zoom=max_zoom, - buffer=buffer, - color_formula=color_formula, - resampling=resampling, - rescale=rescale, - color_map_name=color_map_name, - color_map=color_map, - return_mask=return_mask, + longitude=longitude, + latitude=latitude, + scan_limit=scan_limit, + items_limit=items_limit, + time_limit=time_limit, + exit_when_full=exit_when_full, + skip_covered=skip_covered, + subdataset_name=subdataset_name, + subdataset_bands=subdataset_bands, + crs=crs, + datetime=datetime, + sel=sel, + sel_method=sel_method, + collection=collection, + coordinate_reference_system=coordinate_reference_system, api_version=self._config.api_version, headers=_headers, params=_params, @@ -14472,7 +39968,8 @@ def get_mosaics_wmts_capabilities( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", True) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -14488,25 +39985,25 @@ def get_mosaics_wmts_capabilities( # pylint: disable=too-many-locals map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.StacItemPointAsset], response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore -class SharedAccessSignatureOperations: +class SasOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.planetarycomputer.PlanetaryComputerProClient`'s - :attr:`shared_access_signature` attribute. + :attr:`sas` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -14550,7 +40047,7 @@ def get_sign( cls: ClsType[_models.SharedAccessSignatureSignedLink] = kwargs.pop("cls", None) - _request = build_shared_access_signature_get_sign_request( + _request = build_sas_get_sign_request( href=href, duration_in_minutes=duration_in_minutes, api_version=self._config.api_version, @@ -14562,6 +40059,7 @@ def get_sign( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14579,7 +40077,7 @@ def get_sign( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.SharedAccessSignatureSignedLink, response.json()) @@ -14621,7 +40119,7 @@ def get_token( cls: ClsType[_models.SharedAccessSignatureToken] = kwargs.pop("cls", None) - _request = build_shared_access_signature_get_token_request( + _request = build_sas_get_token_request( collection_id=collection_id, duration_in_minutes=duration_in_minutes, api_version=self._config.api_version, @@ -14633,6 +40131,7 @@ def get_token( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14650,7 +40149,7 @@ def get_token( raise HttpResponseError(response=response) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models.SharedAccessSignatureToken, response.json()) @@ -14688,7 +40187,7 @@ def revoke_token( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_shared_access_signature_revoke_token_request( + _request = build_sas_revoke_token_request( duration_in_minutes=duration_in_minutes, api_version=self._config.api_version, headers=_headers, diff --git a/sdk/planetarycomputer/azure-planetarycomputer/conftest.py b/sdk/planetarycomputer/azure-planetarycomputer/conftest.py new file mode 100644 index 000000000000..1910a9848d18 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/conftest.py @@ -0,0 +1 @@ +collect_ignore_glob = ["generated_tests/*", "generated_samples/*"] diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_delete.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_delete.py new file mode 100644 index 000000000000..a882070275c5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_operations_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.ingestion.cancel_operation( + operation_id="00000000-0000-0000-0000-000000000000", + ) + + +# x-ms-original-file: 2026-04-15/IngestionOperations_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_delete_all.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_delete_all.py new file mode 100644 index 000000000000..50cd47953ec0 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_delete_all.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_operations_delete_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.ingestion.cancel_all_operations() + + +# x-ms-original-file: 2026-04-15/IngestionOperations_DeleteAll.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_get.py new file mode 100644 index 000000000000..87d2950e3f9a --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_operations_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.get_operation( + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/IngestionOperations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_list.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_list.py new file mode 100644 index 000000000000..fde2907a3d82 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_operations_list.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.list_operations() + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-15/IngestionOperations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_runs_create.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_runs_create.py new file mode 100644 index 000000000000..c5678142541d --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_runs_create.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_runs_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.create_run( + collection_id="naip-atl", + ingestion_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/IngestionRuns_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_runs_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_runs_get.py new file mode 100644 index 000000000000..7174266701d8 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_runs_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_runs_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.get_run( + collection_id="naip-atl", + ingestion_id="00000000-0000-0000-0000-000000000000", + run_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/IngestionRuns_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_runs_list.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_runs_list.py new file mode 100644 index 000000000000..2c0b0b7e0f8e --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_runs_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_runs_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.list_runs( + collection_id="naip-atl", + ingestion_id="00000000-0000-0000-0000-000000000000", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-15/IngestionRuns_List.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_create.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_create.py new file mode 100644 index 000000000000..76917025c52f --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_create.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_sources_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.create_source( + body={ + "connectionInfo": { + "containerUrl": "https://SANITIZED.blob.core.windows.net/sample-container", + "sasToken": "sv=2021-01-01&st=Sanitized&se=Sanitized&sr=c&sp=rl&sig=Sanitized", + }, + "id": "00000000-0000-0000-0000-000000000000", + "kind": "SasToken", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/IngestionSources_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_delete.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_delete.py new file mode 100644 index 000000000000..5e9497c5285c --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_sources_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.ingestion.delete_source( + id="00000000-0000-0000-0000-000000000000", + ) + + +# x-ms-original-file: 2026-04-15/IngestionSources_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_get.py new file mode 100644 index 000000000000..37ffc1c2ea1c --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_sources_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.get_source( + id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/IngestionSources_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_list.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_list.py new file mode 100644 index 000000000000..35d372f1b912 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_list.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_sources_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.list_sources() + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-15/IngestionSources_List.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_list_managed_identities.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_list_managed_identities.py new file mode 100644 index 000000000000..167e0cf72fce --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_list_managed_identities.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_sources_list_managed_identities.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.list_managed_identities() + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-15/IngestionSources_ListManagedIdentities.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_replace.py new file mode 100644 index 000000000000..ef0a24978483 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestion_sources_replace.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestion_sources_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.replace_source( + id="00000000-0000-0000-0000-000000000000", + body={ + "connectionInfo": { + "containerUrl": "https://SANITIZED.blob.core.windows.net/sample-container", + "sasToken": "sp=rl&st=Sanitized&se=Sanitized&sv=Sanitized&sr=c&sig=Sanitized", + }, + "id": "00000000-0000-0000-0000-000000000000", + "kind": "SasToken", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/IngestionSources_Replace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_create.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_create.py new file mode 100644 index 000000000000..ba83d6d2455d --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_create.py @@ -0,0 +1,49 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestions_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.create( + collection_id="naip-atl", + body={ + "displayName": "Ingestion", + "importType": "StaticCatalog", + "keepOriginalAssets": True, + "skipExistingItems": True, + "sourceCatalogUrl": "https://raw.githubusercontent.com/aloverro/mpcpro-sample-datasets/main/datasets/planetary_computer/naip/catalog.json", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/Ingestions_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_delete.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_delete.py new file mode 100644 index 000000000000..4d6706091706 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestions_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.ingestion.begin_delete( + collection_id="naip-atl", + ingestion_id="00000000-0000-0000-0000-000000000000", + ).result() + + +# x-ms-original-file: 2026-04-15/Ingestions_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_get.py new file mode 100644 index 000000000000..6b305ff3a08b --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestions_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.get( + collection_id="naip-atl", + ingestion_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/Ingestions_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_list.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_list.py new file mode 100644 index 000000000000..866bbf69909f --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestions_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.list( + collection_id="naip-atl", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-15/Ingestions_List.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_stac_create_geoparquet.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_stac_create_geoparquet.py new file mode 100644 index 000000000000..3eca0bdf1dee --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_stac_create_geoparquet.py @@ -0,0 +1,49 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestions_stac_create_geoparquet.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.create( + collection_id="naip-atl", + body={ + "displayName": "Geoparquet Ingestion", + "importType": "StacGeoparquet", + "keepOriginalAssets": True, + "skipExistingItems": True, + "stacGeoparquetUrl": "https://raw.githubusercontent.com/aloverro/mpcpro-sample-datasets/main/datasets/planetary_computer/naip/items.parquet", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/Ingestions_StacCreateGeoparquet.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_update.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_update.py new file mode 100644 index 000000000000..5cfe247d7020 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/ingestions_update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python ingestions_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.ingestion.update( + collection_id="naip-atl", + ingestion_id="00000000-0000-0000-0000-000000000000", + body={"displayName": "Updated Ingestion Name", "importType": "StaticCatalog"}, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/Ingestions_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/maps_class_map_legends_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/maps_class_map_legends_get.py new file mode 100644 index 000000000000..bd479094b95e --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/maps_class_map_legends_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python maps_class_map_legends_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_class_map_legend( + classmap_name="mtbs-severity", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MapsClassMapLegends_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/maps_interval_legends_get_by_class_map_name.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/maps_interval_legends_get_by_class_map_name.py new file mode 100644 index 000000000000..f4eca8788173 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/maps_interval_legends_get_by_class_map_name.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python maps_interval_legends_get_by_class_map_name.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_interval_legend( + classmap_name="modis-64A1", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MapsIntervalLegends_GetByClassMapName.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/maps_legends_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/maps_legends_get.py new file mode 100644 index 000000000000..d47f17dc0ab2 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/maps_legends_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python maps_legends_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_legend( + color_map_name="rdylgn", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MapsLegends_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_assets_for_bbox_get_bbox_assets.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_assets_for_bbox_get_bbox_assets.py new file mode 100644 index 000000000000..1f5d645033e6 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_assets_for_bbox_get_bbox_assets.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_assets_for_bbox_get_bbox_assets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_assets_for_bbox( + collection_id="naip-atl", + minx=-122.5, + miny=37.7, + maxx=-122.3, + maxy=37.8, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsAssetsForBbox_GetBboxAssets.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_assets_for_tile_matrix_sets_get_zxy_assets.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_assets_for_tile_matrix_sets_get_zxy_assets.py new file mode 100644 index 000000000000..ea8ad243812e --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_assets_for_tile_matrix_sets_get_zxy_assets.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_assets_for_tile_matrix_sets_get_zxy_assets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_assets_for_tile( + collection_id="naip-atl", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsAssetsForTileMatrixSets_GetZxyAssets.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_assets_for_tiles_get_zxy_assets.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_assets_for_tiles_get_zxy_assets.py new file mode 100644 index 000000000000..5c0c12c0464a --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_assets_for_tiles_get_zxy_assets.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_assets_for_tiles_get_zxy_assets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_assets_for_tile_no_tms( + collection_id="naip-atl", + z=13, + x=2174, + y=3282, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsAssetsForTiles_GetZxyAssets.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_bbox_get_cropped_to_bounding_box.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_bbox_get_cropped_to_bounding_box.py new file mode 100644 index 000000000000..af4012c5f950 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_bbox_get_cropped_to_bounding_box.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_bbox_get_cropped_to_bounding_box.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_bbox_crop( + collection_id="naip-atl", + minx=-122.5, + miny=37.7, + maxx=-122.3, + maxy=37.8, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsBbox_GetCroppedToBoundingBox.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py new file mode 100644 index 000000000000..47274b0e04e0 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_bbox_crop_with_dimensions( + collection_id="naip-atl", + minx=-122.5, + miny=37.7, + maxx=-122.3, + maxy=37.8, + width=256, + height=256, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsBboxWithDimensions_GetCroppedToBoundingBoxWidthByHeight.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_feature_geo_json_crop.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_feature_geo_json_crop.py new file mode 100644 index 000000000000..b7f63cc34ee2 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_feature_geo_json_crop.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_feature_geo_json_crop.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.crop_collection_feature_geo_json( + collection_id="naip-atl", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsFeatureGeoJson_Crop.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_feature_geo_json_format_crop_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_feature_geo_json_format_crop_format.py new file mode 100644 index 000000000000..b8ff4f698fde --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_feature_geo_json_format_crop_format.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_feature_geo_json_format_crop_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.crop_collection_feature_geo_json_format( + collection_id="naip-atl", + format="png", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsFeatureGeoJsonFormat_CropFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_feature_geo_json_width_by_height_crop_width_by_height_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_feature_geo_json_width_by_height_crop_width_by_height_format.py new file mode 100644 index 000000000000..c94315dc621a --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_feature_geo_json_width_by_height_crop_width_by_height_format.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_feature_geo_json_width_by_height_crop_width_by_height_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.crop_collection_feature_geo_json_width_by_height( + collection_id="naip-atl", + width=256, + height=256, + format="png", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsFeatureGeoJsonWidthByHeight_CropWidthByHeightFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_info_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_info_get.py new file mode 100644 index 000000000000..1365de7c70da --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_info_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_info_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_info( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsInfo_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_point_assets_get_point_assets.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_point_assets_get_point_assets.py new file mode 100644 index 000000000000..a5fb152c2153 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_point_assets_get_point_assets.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_point_assets_get_point_assets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_point_assets( + collection_id="naip-atl", + longitude=-122.4194, + latitude=37.7749, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsPointAssets_GetPointAssets.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_point_get_point.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_point_get_point.py new file mode 100644 index 000000000000..17e47d16db4d --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_point_get_point.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_point_get_point.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_point( + collection_id="naip-atl", + longitude=-84.386, + latitude=33.676, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsPoint_GetPoint.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_json_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_json_get.py new file mode 100644 index 000000000000..eaa019d1cec6 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_json_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tile_json_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile_json( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTileJson_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_format_get_zxy_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_format_get_zxy_by_format.py new file mode 100644 index 000000000000..bea017b9275d --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_format_get_zxy_by_format.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tile_matrix_sets_format_get_zxy_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile_by_format( + collection_id="naip-atl", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTileMatrixSetsFormat_GetZxyByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_get_zxy_scale_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_get_zxy_scale_by_format.py new file mode 100644 index 000000000000..18b3d7cf35b4 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_get_zxy_scale_by_format.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tile_matrix_sets_get_zxy_scale_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile_by_scale_and_format( + collection_id="naip-atl", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + scale=1, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTileMatrixSets_GetZxyScaleByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_plain_get_zxy.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_plain_get_zxy.py new file mode 100644 index 000000000000..fd5e0d769117 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_plain_get_zxy.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tile_matrix_sets_plain_get_zxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile( + collection_id="naip-atl", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTileMatrixSetsPlain_GetZxy.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_scale_get_zxy_by_scale.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_scale_get_zxy_by_scale.py new file mode 100644 index 000000000000..5fc45177d040 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_scale_get_zxy_by_scale.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tile_matrix_sets_scale_get_zxy_by_scale.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile_by_scale( + collection_id="naip-atl", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + scale=1, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTileMatrixSetsScale_GetZxyByScale.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_tile_json_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_tile_json_get.py new file mode 100644 index 000000000000..7c400b6d6911 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_matrix_sets_tile_json_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tile_matrix_sets_tile_json_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile_json_tms( + collection_id="naip-atl", + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTileMatrixSetsTileJson_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_set_list_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_set_list_get.py new file mode 100644 index 000000000000..86113fafdd8c --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_set_list_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tile_set_list_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.list_collection_tilesets( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTileSetList_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_set_metadata_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_set_metadata_get.py new file mode 100644 index 000000000000..ac5abde962e7 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tile_set_metadata_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tile_set_metadata_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tileset_metadata( + collection_id="naip-atl", + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTileSetMetadata_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_format_get_zxy_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_format_get_zxy_by_format.py new file mode 100644 index 000000000000..c6a58140ff11 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_format_get_zxy_by_format.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tiles_format_get_zxy_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile_no_tms_by_format( + collection_id="naip-atl", + z=13, + x=2174, + y=3282, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTilesFormat_GetZxyByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_get_zxy_scale_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_get_zxy_scale_by_format.py new file mode 100644 index 000000000000..4dae9c07b496 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_get_zxy_scale_by_format.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tiles_get_zxy_scale_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile_no_tms_by_scale_and_format( + collection_id="naip-atl", + z=13, + x=2174, + y=3282, + scale=1, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTiles_GetZxyScaleByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_plain_get_zxy.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_plain_get_zxy.py new file mode 100644 index 000000000000..e40b4229b301 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_plain_get_zxy.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tiles_plain_get_zxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile_no_tms( + collection_id="naip-atl", + z=13, + x=2174, + y=3282, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTilesPlain_GetZxy.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_scale_get_zxy_by_scale.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_scale_get_zxy_by_scale.py new file mode 100644 index 000000000000..fd71920da561 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_tiles_scale_get_zxy_by_scale.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_tiles_scale_get_zxy_by_scale.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_tile_no_tms_by_scale( + collection_id="naip-atl", + z=13, + x=2174, + y=3282, + scale=1, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsTilesScale_GetZxyByScale.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_wmts_get_capabilities_xml.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_wmts_get_capabilities_xml.py new file mode 100644 index 000000000000..47ca2b6a7843 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_wmts_get_capabilities_xml.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_wmts_get_capabilities_xml.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_wmts_capabilities( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsWmts_GetCapabilitiesXml.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_wmts_tile_matrix_sets_get_capabilities_xml.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_wmts_tile_matrix_sets_get_capabilities_xml.py new file mode 100644 index 000000000000..009e407dbdd4 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_collections_wmts_tile_matrix_sets_get_capabilities_xml.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_collections_wmts_tile_matrix_sets_get_capabilities_xml.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_collection_wmts_capabilities_tms( + collection_id="naip-atl", + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicCollectionsWmtsTileMatrixSets_GetCapabilitiesXml.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_asset_statistics_get_all.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_asset_statistics_get_all.py new file mode 100644 index 000000000000..f574064263f1 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_asset_statistics_get_all.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_asset_statistics_get_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_asset_statistics( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsAssetStatistics_GetAll.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_available_assets_get_all.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_available_assets_get_all.py new file mode 100644 index 000000000000..a4a03734ea82 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_available_assets_get_all.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_available_assets_get_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.list_item_available_assets( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsAvailableAssets_GetAll.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_bbox_get_cropped_to_bounding_box.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_bbox_get_cropped_to_bounding_box.py new file mode 100644 index 000000000000..f70bc297d0c5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_bbox_get_cropped_to_bounding_box.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_bbox_get_cropped_to_bounding_box.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_bbox_crop( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + minx=-122.5, + miny=37.7, + maxx=-122.3, + maxy=37.8, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsBbox_GetCroppedToBoundingBox.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py new file mode 100644 index 000000000000..a521022f54ee --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_bbox_crop_with_dimensions( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + minx=-122.5, + miny=37.7, + maxx=-122.3, + maxy=37.8, + width=256, + height=256, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsBboxWithDimensions_GetCroppedToBoundingBoxWidthByHeight.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_bounds_get_all.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_bounds_get_all.py new file mode 100644 index 000000000000..d653fbb96781 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_bounds_get_all.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_bounds_get_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_bounds( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsBounds_GetAll.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_feature_geo_json_crop.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_feature_geo_json_crop.py new file mode 100644 index 000000000000..e18be48f3b42 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_feature_geo_json_crop.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_feature_geo_json_crop.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.crop_feature_geo_json( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsFeatureGeoJson_Crop.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_feature_geo_json_format_crop_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_feature_geo_json_format_crop_format.py new file mode 100644 index 000000000000..49357da8dd11 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_feature_geo_json_format_crop_format.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_feature_geo_json_format_crop_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.crop_feature_geo_json_format( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + format="png", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsFeatureGeoJsonFormat_CropFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_feature_geo_json_width_by_height_crop_width_by_height_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_feature_geo_json_width_by_height_crop_width_by_height_format.py new file mode 100644 index 000000000000..640152c61cf5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_feature_geo_json_width_by_height_crop_width_by_height_format.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_feature_geo_json_width_by_height_crop_width_by_height_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.crop_feature_geo_json_width_by_height( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + width=256, + height=256, + format="png", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsFeatureGeoJsonWidthByHeight_CropWidthByHeightFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_geo_json_statistics_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_geo_json_statistics_get.py new file mode 100644 index 000000000000..e2def44c9c46 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_geo_json_statistics_get.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_geo_json_statistics_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_geo_json_statistics( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsGeoJsonStatistics_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_info_geo_json_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_info_geo_json_get.py new file mode 100644 index 000000000000..9ef34048414d --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_info_geo_json_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_info_geo_json_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_info_geo_json( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsInfoGeoJson_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_info_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_info_get.py new file mode 100644 index 000000000000..4d662832545f --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_info_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_info_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_info( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsInfo_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_point_get_point.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_point_get_point.py new file mode 100644 index 000000000000..c9bfb3c91f35 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_point_get_point.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_point_get_point.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_point( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + longitude=-84.386, + latitude=33.676, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsPoint_GetPoint.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_preview_format_get_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_preview_format_get_format.py new file mode 100644 index 000000000000..069ba98c1906 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_preview_format_get_format.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_preview_format_get_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_preview_with_format( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + format="jpeg", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsPreviewFormat_GetFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_preview_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_preview_get.py new file mode 100644 index 000000000000..0de2f24629d5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_preview_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_preview_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_preview( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsPreview_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_statistics_get_all.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_statistics_get_all.py new file mode 100644 index 000000000000..ea2301f011a3 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_statistics_get_all.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_statistics_get_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.list_item_statistics( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsStatistics_GetAll.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_json_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_json_get.py new file mode 100644 index 000000000000..fe5fc5247015 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_json_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tile_json_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_tile_json( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTileJson_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_format_get_zxy_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_format_get_zxy_by_format.py new file mode 100644 index 000000000000..c67be0a4ee47 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_format_get_zxy_by_format.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tile_matrix_sets_format_get_zxy_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tile_by_format( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + tile_matrix_set_id="WebMercatorQuad", + z=14, + x=4349, + y=6564, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTileMatrixSetsFormat_GetZxyByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_plain_get_zxy.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_plain_get_zxy.py new file mode 100644 index 000000000000..8d0572281ef2 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_plain_get_zxy.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tile_matrix_sets_plain_get_zxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tile( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + tile_matrix_set_id="WebMercatorQuad", + z=14, + x=4349, + y=6564, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTileMatrixSetsPlain_GetZxy.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_scale_by_format_get_zxy_scale_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_scale_by_format_get_zxy_scale_by_format.py new file mode 100644 index 000000000000..9317dff72f57 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_scale_by_format_get_zxy_scale_by_format.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tile_matrix_sets_scale_by_format_get_zxy_scale_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tile_by_scale_and_format( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + tile_matrix_set_id="WebMercatorQuad", + z=14, + x=4349, + y=6564, + scale=2, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTileMatrixSetsScaleByFormat_GetZxyScaleByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_scale_get_zxy_by_scale.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_scale_get_zxy_by_scale.py new file mode 100644 index 000000000000..7c464bbe0c55 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_scale_get_zxy_by_scale.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tile_matrix_sets_scale_get_zxy_by_scale.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tile_by_scale( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + tile_matrix_set_id="WebMercatorQuad", + z=14, + x=4349, + y=6564, + scale=2, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTileMatrixSetsScale_GetZxyByScale.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_tile_json_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_tile_json_get.py new file mode 100644 index 000000000000..bd76931ca631 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_matrix_sets_tile_json_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tile_matrix_sets_tile_json_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_tile_json_tms( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTileMatrixSetsTileJson_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_set_list_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_set_list_get.py new file mode 100644 index 000000000000..93e1c07cf89e --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_set_list_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tile_set_list_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.list_tilesets( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTileSetList_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_set_metadata_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_set_metadata_get.py new file mode 100644 index 000000000000..6206d7de140d --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tile_set_metadata_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tile_set_metadata_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tileset_metadata( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTileSetMetadata_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_format_get_zxy_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_format_get_zxy_by_format.py new file mode 100644 index 000000000000..60a73a0165e4 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_format_get_zxy_by_format.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tiles_format_get_zxy_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tile_no_tms_by_format( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + z=14, + x=4349, + y=6564, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTilesFormat_GetZxyByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_plain_get_zxy.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_plain_get_zxy.py new file mode 100644 index 000000000000..57bfbc66eba5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_plain_get_zxy.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tiles_plain_get_zxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tile_no_tms( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + z=14, + x=4349, + y=6564, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTilesPlain_GetZxy.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_scale_by_format_get_zxy_scale_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_scale_by_format_get_zxy_scale_by_format.py new file mode 100644 index 000000000000..9ebb358e4eee --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_scale_by_format_get_zxy_scale_by_format.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tiles_scale_by_format_get_zxy_scale_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tile_no_tms_by_scale_and_format( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + z=14, + x=4349, + y=6564, + scale=2, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTilesScaleByFormat_GetZxyScaleByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_scale_get_zxy_by_scale.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_scale_get_zxy_by_scale.py new file mode 100644 index 000000000000..524288fb9e32 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_tiles_scale_get_zxy_by_scale.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_tiles_scale_get_zxy_by_scale.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tile_no_tms_by_scale( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + z=14, + x=4349, + y=6564, + scale=2, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsTilesScale_GetZxyByScale.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_wmts_get_capabilities_xml.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_wmts_get_capabilities_xml.py new file mode 100644 index 000000000000..b4751ff1678a --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_wmts_get_capabilities_xml.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_wmts_get_capabilities_xml.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_wmts_capabilities( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsWmts_GetCapabilitiesXml.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_wmts_tile_matrix_sets_get_capabilities_xml.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_wmts_tile_matrix_sets_get_capabilities_xml.py new file mode 100644 index 000000000000..1cb0f6b4a35f --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_items_wmts_tile_matrix_sets_get_capabilities_xml.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_items_wmts_tile_matrix_sets_get_capabilities_xml.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_item_wmts_capabilities_tms( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114", + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicItemsWmtsTileMatrixSets_GetCapabilitiesXml.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_assets_for_bbox_get_bbox_assets.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_assets_for_bbox_get_bbox_assets.py new file mode 100644 index 000000000000..dcbcd11b7194 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_assets_for_bbox_get_bbox_assets.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_assets_for_bbox_get_bbox_assets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_bbox_assets( + search_id="abc123def456", + minx=-122.5, + miny=37.7, + maxx=-122.3, + maxy=37.8, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesAssetsForBbox_GetBboxAssets.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_assets_for_tile_matrix_sets_get_zxy_assets.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_assets_for_tile_matrix_sets_get_zxy_assets.py new file mode 100644 index 000000000000..a9f439a7d4d3 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_assets_for_tile_matrix_sets_get_zxy_assets.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_assets_for_tile_matrix_sets_get_zxy_assets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_assets_for_tile( + search_id="ba13fc7947b9b585690d84ee61aaa653", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesAssetsForTileMatrixSets_GetZxyAssets.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_assets_for_tiles_get_zxy_assets.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_assets_for_tiles_get_zxy_assets.py new file mode 100644 index 000000000000..f169e0010bbb --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_assets_for_tiles_get_zxy_assets.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_assets_for_tiles_get_zxy_assets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_assets_for_tile_no_tms( + search_id="ba13fc7947b9b585690d84ee61aaa653", + z=13, + x=2174, + y=3282, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesAssetsForTiles_GetZxyAssets.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_bbox_get_cropped_to_bounding_box.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_bbox_get_cropped_to_bounding_box.py new file mode 100644 index 000000000000..76e6a6b94b59 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_bbox_get_cropped_to_bounding_box.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_bbox_get_cropped_to_bounding_box.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_bbox_crop( + search_id="ba13fc7947b9b585690d84ee61aaa653", + minx=-122.5, + miny=37.7, + maxx=-122.3, + maxy=37.8, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesBbox_GetCroppedToBoundingBox.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py new file mode 100644 index 000000000000..991109288eb5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_bbox_with_dimensions_get_cropped_to_bounding_box_width_by_height.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_bbox_crop_with_dimensions( + search_id="ba13fc7947b9b585690d84ee61aaa653", + minx=-122.5, + miny=37.7, + maxx=-122.3, + maxy=37.8, + width=256, + height=256, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesBboxWithDimensions_GetCroppedToBoundingBoxWidthByHeight.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_feature_geo_json_crop.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_feature_geo_json_crop.py new file mode 100644 index 000000000000..8649ce826a8e --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_feature_geo_json_crop.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_feature_geo_json_crop.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.crop_searches_feature_geo_json( + search_id="ba13fc7947b9b585690d84ee61aaa653", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesFeatureGeoJson_Crop.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_feature_geo_json_format_crop_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_feature_geo_json_format_crop_format.py new file mode 100644 index 000000000000..7225c83dc68d --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_feature_geo_json_format_crop_format.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_feature_geo_json_format_crop_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.crop_searches_feature_geo_json_format( + search_id="ba13fc7947b9b585690d84ee61aaa653", + format="png", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesFeatureGeoJsonFormat_CropFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_feature_geo_json_width_by_height_crop_width_by_height_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_feature_geo_json_width_by_height_crop_width_by_height_format.py new file mode 100644 index 000000000000..2cbcbf9e0eb5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_feature_geo_json_width_by_height_crop_width_by_height_format.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_feature_geo_json_width_by_height_crop_width_by_height_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.crop_searches_feature_geo_json_width_by_height( + search_id="ba13fc7947b9b585690d84ee61aaa653", + width=256, + height=256, + format="png", + body={ + "geometry": { + "coordinates": [ + [ + [-84.3906, 33.6714], + [-84.3814, 33.6714], + [-84.3814, 33.6806], + [-84.3906, 33.6806], + [-84.3906, 33.6714], + ] + ], + "type": "Polygon", + }, + "properties": {}, + "type": "Feature", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesFeatureGeoJsonWidthByHeight_CropWidthByHeightFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_info_search_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_info_search_get.py new file mode 100644 index 000000000000..1342e2936e04 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_info_search_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_info_search_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_info( + search_id="ba13fc7947b9b585690d84ee61aaa653", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesInfoSearch_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_point_get_point.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_point_get_point.py new file mode 100644 index 000000000000..15eb50b10cc0 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_point_get_point.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_point_get_point.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_point( + search_id="ba13fc7947b9b585690d84ee61aaa653", + longitude=-84.386, + latitude=33.676, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesPoint_GetPoint.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_point_with_assets_get_point_assets.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_point_with_assets_get_point_assets.py new file mode 100644 index 000000000000..a964f4869d62 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_point_with_assets_get_point_assets.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_point_with_assets_get_point_assets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_point_with_assets( + search_id="ba13fc7947b9b585690d84ee61aaa653", + longitude=-122.4194, + latitude=37.7749, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesPointWithAssets_GetPointAssets.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_json_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_json_get.py new file mode 100644 index 000000000000..655220327b67 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_json_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tile_json_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile_json( + search_id="ba13fc7947b9b585690d84ee61aaa653", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTileJson_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_format_get_zxy_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_format_get_zxy_by_format.py new file mode 100644 index 000000000000..0b5ff49c2a73 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_format_get_zxy_by_format.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tile_matrix_sets_format_get_zxy_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile_by_format( + search_id="ba13fc7947b9b585690d84ee61aaa653", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTileMatrixSetsFormat_GetZxyByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_get_zxy_scale_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_get_zxy_scale_by_format.py new file mode 100644 index 000000000000..41bb85ef34f5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_get_zxy_scale_by_format.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tile_matrix_sets_get_zxy_scale_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile_by_scale_and_format( + search_id="ba13fc7947b9b585690d84ee61aaa653", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + scale=1, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTileMatrixSets_GetZxyScaleByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_plain_get_zxy.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_plain_get_zxy.py new file mode 100644 index 000000000000..57d114a10240 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_plain_get_zxy.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tile_matrix_sets_plain_get_zxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile( + search_id="ba13fc7947b9b585690d84ee61aaa653", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTileMatrixSetsPlain_GetZxy.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_scale_get_zxy_by_scale.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_scale_get_zxy_by_scale.py new file mode 100644 index 000000000000..dba1ae5e18be --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_scale_get_zxy_by_scale.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tile_matrix_sets_scale_get_zxy_by_scale.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile_by_scale( + search_id="ba13fc7947b9b585690d84ee61aaa653", + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + scale=1, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTileMatrixSetsScale_GetZxyByScale.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_tile_json_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_tile_json_get.py new file mode 100644 index 000000000000..920667228bfa --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_matrix_sets_tile_json_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tile_matrix_sets_tile_json_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile_json_tms( + search_id="ba13fc7947b9b585690d84ee61aaa653", + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTileMatrixSetsTileJson_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_set_list_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_set_list_get.py new file mode 100644 index 000000000000..c3534032e643 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_set_list_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tile_set_list_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.list_searches_tilesets( + search_id="ba13fc7947b9b585690d84ee61aaa653", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTileSetList_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_set_metadata_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_set_metadata_get.py new file mode 100644 index 000000000000..0a5c6dd8e2bc --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tile_set_metadata_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tile_set_metadata_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tileset_metadata( + search_id="ba13fc7947b9b585690d84ee61aaa653", + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTileSetMetadata_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_format_get_zxy_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_format_get_zxy_by_format.py new file mode 100644 index 000000000000..43dd14ac5975 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_format_get_zxy_by_format.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tiles_format_get_zxy_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile_no_tms_by_format( + search_id="ba13fc7947b9b585690d84ee61aaa653", + z=13, + x=2174, + y=3282, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTilesFormat_GetZxyByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_get_zxy_scale_by_format.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_get_zxy_scale_by_format.py new file mode 100644 index 000000000000..dc52e67fbb41 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_get_zxy_scale_by_format.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tiles_get_zxy_scale_by_format.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile_no_tms_by_scale_and_format( + search_id="ba13fc7947b9b585690d84ee61aaa653", + z=13, + x=2174, + y=3282, + scale=1, + format="png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTiles_GetZxyScaleByFormat.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_plain_get_zxy.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_plain_get_zxy.py new file mode 100644 index 000000000000..a3563b4ea336 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_plain_get_zxy.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tiles_plain_get_zxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile_no_tms( + search_id="ba13fc7947b9b585690d84ee61aaa653", + z=13, + x=2174, + y=3282, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTilesPlain_GetZxy.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_scale_get_zxy_by_scale.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_scale_get_zxy_by_scale.py new file mode 100644 index 000000000000..b4e804abee51 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_tiles_scale_get_zxy_by_scale.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_tiles_scale_get_zxy_by_scale.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_tile_no_tms_by_scale( + search_id="ba13fc7947b9b585690d84ee61aaa653", + z=13, + x=2174, + y=3282, + scale=1, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesTilesScale_GetZxyByScale.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_wmts_get_capabilities_xml.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_wmts_get_capabilities_xml.py new file mode 100644 index 000000000000..405cc486913b --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_wmts_get_capabilities_xml.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_wmts_get_capabilities_xml.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_wmts_capabilities( + search_id="ba13fc7947b9b585690d84ee61aaa653", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesWmts_GetCapabilitiesXml.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_wmts_tile_matrix_sets_get_capabilities_xml.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_wmts_tile_matrix_sets_get_capabilities_xml.py new file mode 100644 index 000000000000..be7057de3913 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaic_searches_wmts_tile_matrix_sets_get_capabilities_xml.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaic_searches_wmts_tile_matrix_sets_get_capabilities_xml.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_searches_wmts_capabilities_tms( + search_id="ba13fc7947b9b585690d84ee61aaa653", + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicSearchesWmtsTileMatrixSets_GetCapabilitiesXml.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaics_register_search_register.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaics_register_search_register.py new file mode 100644 index 000000000000..0f669d6ecc66 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/mosaics_register_search_register.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python mosaics_register_search_register.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.register_mosaics_search( + body={ + "filter": { + "args": [ + {"args": [{"property": "collection"}, "naip-atl"], "op": "="}, + {"args": [{"property": "datetime"}, "2021-01-01T00:00:00Z"], "op": ">="}, + {"args": [{"property": "datetime"}, "2022-12-31T23:59:59Z"], "op": "<="}, + ], + "op": "and", + }, + "filter-lang": "cql2-json", + "sortby": [{"direction": "desc", "field": "datetime"}], + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/MosaicsRegisterSearch_Register.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/sas_get_sign.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/sas_get_sign.py new file mode 100644 index 000000000000..724ef72b664b --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/sas_get_sign.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python sas_get_sign.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.sas.get_sign( + href="https://SANITIZED.blob.core.windows.net/naip-atl-00000000/collection-assets/thumbnail/thumbnail.png", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/Sas_GetSign.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/sas_get_token.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/sas_get_token.py new file mode 100644 index 000000000000..11cb04cd7a10 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/sas_get_token.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python sas_get_token.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.sas.get_token( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/Sas_GetToken.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/sas_revoke_token.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/sas_revoke_token.py new file mode 100644 index 000000000000..3e2078b4025c --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/sas_revoke_token.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python sas_revoke_token.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.sas.revoke_token() + + +# x-ms-original-file: 2026-04-15/Sas_RevokeToken.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_assets_create.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_assets_create.py new file mode 100644 index 000000000000..b86f4807c725 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_assets_create.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_assets_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.create_collection_asset( + collection_id="naip-atl", + body={ + "data": {"description": "str", "key": "str", "roles": ["str"], "title": "str", "type": "str"}, + "file": filetype, + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionAssets_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_assets_delete.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_assets_delete.py new file mode 100644 index 000000000000..2b8275e073d6 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_assets_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_assets_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.delete_collection_asset( + collection_id="naip-atl", + asset_id="test-asset", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionAssets_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_assets_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_assets_replace.py new file mode 100644 index 000000000000..dba7cbfd0796 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_assets_replace.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_assets_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.replace_collection_asset( + collection_id="naip-atl", + asset_id="test-asset", + body={ + "data": {"description": "str", "key": "str", "roles": ["str"], "title": "str", "type": "str"}, + "file": filetype, + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionAssets_Replace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_config_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_config_get.py new file mode 100644 index 000000000000..bc69af750389 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_config_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_config_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_collection_configuration( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionConfig_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_add.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_add.py new file mode 100644 index 000000000000..e9f1fa2af7eb --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_add.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_mosaics_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.add_mosaic( + collection_id="naip-atl", + body={"cql": [], "id": "test-mosaic-1", "name": "Test Most recent available"}, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionMosaics_Add.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_delete.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_delete.py new file mode 100644 index 000000000000..bd2313ef1081 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_mosaics_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.delete_mosaic( + collection_id="naip-atl", + mosaic_id="test-mosaic-1", + ) + + +# x-ms-original-file: 2026-04-15/StacCollectionMosaics_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_get.py new file mode 100644 index 000000000000..fd94468e2f21 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_mosaics_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_mosaic( + collection_id="naip-atl", + mosaic_id="test-mosaic-1", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionMosaics_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_get_all.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_get_all.py new file mode 100644 index 000000000000..78ffae9593ac --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_get_all.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_mosaics_get_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.list_mosaics( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionMosaics_GetAll.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_replace.py new file mode 100644 index 000000000000..ef8692f7425f --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_mosaics_replace.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_mosaics_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.replace_mosaic( + collection_id="naip-atl", + mosaic_id="test-mosaic-1", + body={ + "cql": [], + "description": "Most recent available imagery in this collection - updated", + "id": "test-mosaic-1", + "name": "Test Most recent available", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionMosaics_Replace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_partition_types_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_partition_types_get.py new file mode 100644 index 000000000000..15bdbada19f8 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_partition_types_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_partition_types_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_partition_type( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionPartitionTypes_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_partition_types_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_partition_types_replace.py new file mode 100644 index 000000000000..71e7c389caa3 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_partition_types_replace.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_partition_types_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.replace_partition_type( + collection_id="test-partition-type-collection", + body={"scheme": "year"}, + ) + + +# x-ms-original-file: 2026-04-15/StacCollectionPartitionTypes_Replace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_create.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_create.py new file mode 100644 index 000000000000..0c7e13ba4eba --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_create.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_render_options_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.create_render_option( + collection_id="naip-atl", + body={ + "id": "test-natural-color", + "minZoom": 6, + "name": "Test Natural color", + "options": "assets=image&asset_bidx=image|1,2,3", + "type": "raster-tile", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionRenderOptions_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_delete.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_delete.py new file mode 100644 index 000000000000..dd9793dea094 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_render_options_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.delete_render_option( + collection_id="naip-atl", + render_option_id="test-natural-color", + ) + + +# x-ms-original-file: 2026-04-15/StacCollectionRenderOptions_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_get.py new file mode 100644 index 000000000000..c0c1481300d5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_render_options_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_render_option( + collection_id="naip-atl", + render_option_id="test-natural-color", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionRenderOptions_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_get_all.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_get_all.py new file mode 100644 index 000000000000..b7a5f6bcc2d8 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_get_all.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_render_options_get_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.list_render_options( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionRenderOptions_GetAll.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_replace.py new file mode 100644 index 000000000000..6ffad78f5b4f --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_render_options_replace.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_render_options_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.replace_render_option( + collection_id="naip-atl", + render_option_id="test-natural-color", + body={ + "description": "RGB from visual assets - updated", + "id": "test-natural-color", + "minZoom": 6, + "name": "Test Natural color updated", + "options": "assets=image&asset_bidx=image|1,2,3", + "type": "raster-tile", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionRenderOptions_Replace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_thumbnails_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_thumbnails_get.py new file mode 100644 index 000000000000..a723cefdc994 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_thumbnails_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_thumbnails_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_collection_thumbnail( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionThumbnails_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_tile_settings_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_tile_settings_get.py new file mode 100644 index 000000000000..adb5edc7dbf8 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_tile_settings_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_tile_settings_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_tile_settings( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionTileSettings_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_tile_settings_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_tile_settings_replace.py new file mode 100644 index 000000000000..68e10a82cf37 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collection_tile_settings_replace.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collection_tile_settings_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.replace_tile_settings( + collection_id="naip-atl", + body={"maxItemsPerTile": 35, "minZoom": 6}, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollectionTileSettings_Replace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_create.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_create.py new file mode 100644 index 000000000000..7743f59cac3d --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_create.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collections_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.begin_create_collection( + body={ + "description": "Temporary collection for partition type testing", + "extent": { + "spatial": {"bbox": [[-180, -90, 180, 90]]}, + "temporal": {"interval": [["2020-01-01T00:00:00Z", "2099-12-31T23:59:59Z"]]}, + }, + "id": "test-partition-type-collection", + "license": "proprietary", + "links": [], + "stac_version": "1.0.0", + "title": "Test Partition Type Collection", + "type": "Collection", + }, + ).result() + + +# x-ms-original-file: 2026-04-15/StacCollections_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_create_or_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_create_or_replace.py new file mode 100644 index 000000000000..98fcd8b3b204 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_create_or_replace.py @@ -0,0 +1,78 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collections_create_or_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.replace_collection( + collection_id="test-collection-lifecycle", + body={ + "description": "Test collection for lifecycle operations - UPDATED", + "extent": { + "spatial": {"bbox": [[-180, -90, 180, 90]]}, + "temporal": {"interval": [["2020-01-01T00:00:00Z", "2024-12-31T23:59:59Z"]]}, + }, + "id": "test-collection-lifecycle", + "license": "proprietary", + "links": [ + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/collections/test-collection-lifecycle/items", + "rel": "items", + "type": "application/geo+json", + }, + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/", + "rel": "parent", + "type": "application/json", + }, + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/", + "rel": "root", + "type": "application/json", + }, + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/collections/test-collection-lifecycle", + "rel": "self", + "type": "application/json", + }, + ], + "msft:_created": "2025-10-28T18:47:27.7827791Z", + "msft:_updated": "2025-10-28T18:47:27.7827791Z", + "stac_version": "1.0.0", + "title": "Test Collection Lifecycle", + "type": "Collection", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollections_CreateOrReplace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_delete.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_delete.py new file mode 100644 index 000000000000..95262540b8e4 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_delete.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collections_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.begin_delete_collection( + collection_id="test-partition-type-collection", + ).result() + + +# x-ms-original-file: 2026-04-15/StacCollections_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_get.py new file mode 100644 index 000000000000..009f6384fb25 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collections_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_collection( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollections_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_get_all.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_get_all.py new file mode 100644 index 000000000000..2d4369973321 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_get_all.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collections_get_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_collections() + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollections_GetAll.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_replace.py new file mode 100644 index 000000000000..80d5e97eaac3 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_collections_replace.py @@ -0,0 +1,78 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_collections_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.replace_collection( + collection_id="test-collection-lifecycle", + body={ + "description": "Test collection for lifecycle operations - UPDATED", + "extent": { + "spatial": {"bbox": [[-180, -90, 180, 90]]}, + "temporal": {"interval": [["2020-01-01T00:00:00Z", "2024-12-31T23:59:59Z"]]}, + }, + "id": "test-collection-lifecycle", + "license": "proprietary", + "links": [ + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/collections/test-collection-lifecycle/items", + "rel": "items", + "type": "application/geo+json", + }, + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/", + "rel": "parent", + "type": "application/json", + }, + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/", + "rel": "root", + "type": "application/json", + }, + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/collections/test-collection-lifecycle", + "rel": "self", + "type": "application/json", + }, + ], + "msft:_created": "2025-10-28T18:47:27.7827791Z", + "msft:_updated": "2025-10-28T18:47:27.7827791Z", + "stac_version": "1.0.0", + "title": "Test Collection Lifecycle", + "type": "Collection", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacCollections_Replace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_conformance_class_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_conformance_class_get.py new file mode 100644 index 000000000000..0f26c4f96f15 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_conformance_class_get.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_conformance_class_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_conformance_class() + print(response) + + +# x-ms-original-file: 2026-04-15/StacConformanceClass_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_create.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_create.py new file mode 100644 index 000000000000..a66f574682e7 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_create.py @@ -0,0 +1,86 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_items_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.begin_create_item( + collection_id="naip-atl", + body={ + "assets": { + "image": { + "href": "https://SANITIZED.blob.core.windows.net/naip/v002/ga/2021/ga_060cm_2021/33084/m_3308421_se_16_060_20211114.tif", + "roles": ["data"], + "title": "RGBIR COG tile", + "type": "image/tiff; application=geotiff; profile=cloud-optimized", + } + }, + "bbox": [-84.44157, 33.621853, -84.370894, 33.690654], + "collection": "naip-atl", + "geometry": { + "coordinates": [ + [ + [-84.372943, 33.621853], + [-84.370894, 33.689211], + [-84.439575, 33.690654], + [-84.44157, 33.623293], + [-84.372943, 33.621853], + ] + ], + "type": "Polygon", + }, + "id": "ga_m_3308421_se_16_060_20211114_test", + "links": [ + { + "href": "https://planetarycomputer.microsoft.com/api/stac/v1/collections/naip-atl", + "rel": "collection", + "type": "application/json", + } + ], + "properties": { + "datetime": "2021-11-14T16:00:00Z", + "gsd": 0.6, + "naip:state": "ga", + "naip:year": "2021", + "proj:bbox": [737334, 3723324, 743706, 3730800], + "proj:epsg": 26916, + "proj:shape": [12460, 10620], + "proj:transform": [0.6, 0, 737334, 0, -0.6, 3730800, 0, 0, 1], + }, + "stac_extensions": ["https://stac-extensions.github.io/projection/v1.0.0/schema.json"], + "stac_version": "1.0.0", + "type": "Feature", + }, + ).result() + + +# x-ms-original-file: 2026-04-15/StacItems_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_create_or_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_create_or_replace.py new file mode 100644 index 000000000000..12e1194fbc50 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_create_or_replace.py @@ -0,0 +1,89 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_items_create_or_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.begin_replace_item( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114_replace_test", + body={ + "assets": { + "image": { + "href": "https://SANITIZED.blob.core.windows.net/naip/v002/ga/2021/ga_060cm_2021/33084/m_3308421_se_16_060_20211114.tif", + "roles": ["data"], + "title": "RGBIR COG tile", + "type": "image/tiff; application=geotiff; profile=cloud-optimized", + } + }, + "bbox": [-84.44157, 33.621853, -84.370894, 33.690654], + "collection": "naip-atl", + "geometry": { + "coordinates": [ + [ + [-84.372943, 33.621853], + [-84.370894, 33.689211], + [-84.439575, 33.690654], + [-84.44157, 33.623293], + [-84.372943, 33.621853], + ] + ], + "type": "Polygon", + }, + "id": "ga_m_3308421_se_16_060_20211114_replace_test", + "links": [ + { + "href": "https://planetarycomputer.microsoft.com/api/stac/v1/collections/naip-atl", + "rel": "collection", + "type": "application/json", + } + ], + "properties": { + "datetime": "2021-11-14T16:00:00Z", + "gsd": 0.6, + "naip:state": "ga", + "naip:year": "2021", + "platform": "Imagery Updated", + "processing_level": "L2", + "proj:bbox": [737334, 3723324, 743706, 3730800], + "proj:epsg": 26916, + "proj:shape": [12460, 10620], + "proj:transform": [0.6, 0, 737334, 0, -0.6, 3730800, 0, 0, 1], + }, + "stac_extensions": ["https://stac-extensions.github.io/projection/v1.0.0/schema.json"], + "stac_version": "1.0.0", + "type": "Feature", + }, + ).result() + + +# x-ms-original-file: 2026-04-15/StacItems_CreateOrReplace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_delete.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_delete.py new file mode 100644 index 000000000000..e882c17c3261 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_items_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.begin_delete_item( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114_delete_test", + ).result() + + +# x-ms-original-file: 2026-04-15/StacItems_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_get.py new file mode 100644 index 000000000000..2262d7102357 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_items_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_item( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114_test", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacItems_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_get_features.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_get_features.py new file mode 100644 index 000000000000..45492664be94 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_get_features.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_items_get_features.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_item_collection( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacItems_GetFeatures.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_replace.py new file mode 100644 index 000000000000..856615cd2652 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_replace.py @@ -0,0 +1,89 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_items_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.begin_replace_item( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114_replace_test", + body={ + "assets": { + "image": { + "href": "https://SANITIZED.blob.core.windows.net/naip/v002/ga/2021/ga_060cm_2021/33084/m_3308421_se_16_060_20211114.tif", + "roles": ["data"], + "title": "RGBIR COG tile", + "type": "image/tiff; application=geotiff; profile=cloud-optimized", + } + }, + "bbox": [-84.44157, 33.621853, -84.370894, 33.690654], + "collection": "naip-atl", + "geometry": { + "coordinates": [ + [ + [-84.372943, 33.621853], + [-84.370894, 33.689211], + [-84.439575, 33.690654], + [-84.44157, 33.623293], + [-84.372943, 33.621853], + ] + ], + "type": "Polygon", + }, + "id": "ga_m_3308421_se_16_060_20211114_replace_test", + "links": [ + { + "href": "https://planetarycomputer.microsoft.com/api/stac/v1/collections/naip-atl", + "rel": "collection", + "type": "application/json", + } + ], + "properties": { + "datetime": "2021-11-14T16:00:00Z", + "gsd": 0.6, + "naip:state": "ga", + "naip:year": "2021", + "platform": "Imagery Updated", + "processing_level": "L2", + "proj:bbox": [737334, 3723324, 743706, 3730800], + "proj:epsg": 26916, + "proj:shape": [12460, 10620], + "proj:transform": [0.6, 0, 737334, 0, -0.6, 3730800, 0, 0, 1], + }, + "stac_extensions": ["https://stac-extensions.github.io/projection/v1.0.0/schema.json"], + "stac_version": "1.0.0", + "type": "Feature", + }, + ).result() + + +# x-ms-original-file: 2026-04-15/StacItems_Replace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_update.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_update.py new file mode 100644 index 000000000000..8a8288fb7124 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_items_update.py @@ -0,0 +1,105 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_items_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.begin_update_item( + collection_id="naip-atl", + item_id="ga_m_3308421_se_16_060_20211114_test", + body={ + "_msft:etag": "73fab31c-2e93-422b-b30a-7d259590992f", + "_msft:ts": "2025-10-28T17:52:49.659975Z", + "assets": { + "image": { + "href": "https://SANITIZED.blob.core.windows.net/naip-atl-bde3e846/08a/ga_m_3308421_se_16_060_20211114_test/image.tif", + "roles": ["data"], + "title": "RGBIR COG tile", + "type": "image/tiff; application=geotiff; profile=cloud-optimized", + } + }, + "bbox": [-84.44157, 33.621853, -84.370894, 33.690654], + "collection": "naip-atl", + "geometry": { + "coordinates": [ + [ + [-84.372943, 33.621853], + [-84.370894, 33.689211], + [-84.439575, 33.690654], + [-84.44157, 33.623293], + [-84.372943, 33.621853], + ] + ], + "type": "Polygon", + }, + "id": "ga_m_3308421_se_16_060_20211114_test", + "links": [ + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/collections/naip-atl", + "rel": "collection", + "type": "application/json", + }, + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/collections/naip-atl", + "rel": "parent", + "type": "application/json", + }, + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/", + "rel": "root", + "type": "application/json", + }, + { + "href": "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com/stac/collections/naip-atl/items/ga_m_3308421_se_16_060_20211114_test", + "rel": "self", + "type": "application/geo+json", + }, + ], + "properties": { + "datetime": "2021-11-14T16:00:00Z", + "gsd": 0.6, + "naip:state": "ga", + "naip:year": "2021", + "platform": "Imagery", + "proj:bbox": [737334, 3723324, 743706, 3730800], + "proj:epsg": 26916, + "proj:shape": [12460, 10620], + "proj:transform": [0.6, 0, 737334, 0, -0.6, 3730800, 0, 0, 1], + }, + "stac_extensions": ["https://stac-extensions.github.io/projection/v1.1.0/schema.json"], + "stac_version": "1.0.0", + "type": "Feature", + }, + ).result() + + +# x-ms-original-file: 2026-04-15/StacItems_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_landing_pages_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_landing_pages_get.py new file mode 100644 index 000000000000..ed7c19c13747 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_landing_pages_get.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_landing_pages_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_landing_page() + print(response) + + +# x-ms-original-file: 2026-04-15/StacLandingPages_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_create.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_create.py new file mode 100644 index 000000000000..bd44edb1f58f --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_create.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_queryables_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.create_queryables( + collection_id="naip-atl", + body=[ + { + "create_index": False, + "data_type": "number", + "definition": {"data_type": "number"}, + "name": "test:property", + } + ], + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacQueryables_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_delete.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_delete.py new file mode 100644 index 000000000000..ea7ea607fde9 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_queryables_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.stac.delete_queryable( + collection_id="naip-atl", + queryable_name="test%3Aproperty", + ) + + +# x-ms-original-file: 2026-04-15/StacQueryables_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_get_all.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_get_all.py new file mode 100644 index 000000000000..c82a65f3578f --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_get_all.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_queryables_get_all.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.list_queryables() + print(response) + + +# x-ms-original-file: 2026-04-15/StacQueryables_GetAll.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_get_all_by_collection.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_get_all_by_collection.py new file mode 100644 index 000000000000..636a68b3afc0 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_get_all_by_collection.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_queryables_get_all_by_collection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.get_collection_queryables( + collection_id="naip-atl", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacQueryables_GetAllByCollection.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_replace.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_replace.py new file mode 100644 index 000000000000..69d165c6c471 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_queryables_replace.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_queryables_replace.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.replace_queryable( + collection_id="naip-atl", + queryable_name="test%3Aproperty", + body={ + "create_index": False, + "data_type": "number", + "definition": {"data_type": "number", "description": "Test property - updated"}, + "name": "test:property", + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacQueryables_Replace.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_search_create.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_search_create.py new file mode 100644 index 000000000000..dfd9f9a48e54 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/stac_search_create.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python stac_search_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stac.search( + body={ + "collections": ["naip-atl"], + "datetime": "2021-01-01T00:00:00Z/2022-12-31T00:00:00Z", + "filter": { + "args": [ + {"property": "geometry"}, + { + "coordinates": [ + [ + [-84.46416308610219, 33.6033686729869], + [-84.38815071170247, 33.6033686729869], + [-84.38815071170247, 33.6713179813099], + [-84.46416308610219, 33.6713179813099], + [-84.46416308610219, 33.6033686729869], + ] + ], + "type": "Polygon", + }, + ], + "op": "s_intersects", + }, + "filter-lang": "cql2-json", + "limit": 50, + "sortby": [{"direction": "desc", "field": "datetime"}], + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-15/StacSearch_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/tile_matrix_definitions_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/tile_matrix_definitions_get.py new file mode 100644 index 000000000000..d488808cb2eb --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/tile_matrix_definitions_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python tile_matrix_definitions_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.get_tile_matrix_definitions( + tile_matrix_set_id="WebMercatorQuad", + ) + print(response) + + +# x-ms-original-file: 2026-04-15/TileMatrixDefinitions_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/tile_matrix_list_get.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/tile_matrix_list_get.py new file mode 100644 index 000000000000..68554883a412 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_samples/tile_matrix_list_get.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.planetarycomputer import PlanetaryComputerProClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-planetarycomputer +# USAGE + python tile_matrix_list_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PlanetaryComputerProClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.data.list_tile_matrices() + print(response) + + +# x-ms-original-file: 2026-04-15/TileMatrixList_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/conftest.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/conftest.py new file mode 100644 index 000000000000..7b69612cb0a9 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/conftest.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + planetarycomputerpro_subscription_id = os.environ.get( + "PLANETARYCOMPUTERPRO_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + planetarycomputerpro_tenant_id = os.environ.get( + "PLANETARYCOMPUTERPRO_TENANT_ID", "00000000-0000-0000-0000-000000000000" + ) + planetarycomputerpro_client_id = os.environ.get( + "PLANETARYCOMPUTERPRO_CLIENT_ID", "00000000-0000-0000-0000-000000000000" + ) + planetarycomputerpro_client_secret = os.environ.get( + "PLANETARYCOMPUTERPRO_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=planetarycomputerpro_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=planetarycomputerpro_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=planetarycomputerpro_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=planetarycomputerpro_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_data_operations.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_data_operations.py new file mode 100644 index 000000000000..1fbb36b25b1b --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_data_operations.py @@ -0,0 +1,1204 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import PlanetaryComputerProClientTestBase, PlanetaryComputerProPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProDataOperations(PlanetaryComputerProClientTestBase): + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tile_matrix_definitions(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tile_matrix_definitions( + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_list_tile_matrices(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.list_tile_matrices() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_class_map_legend(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_class_map_legend( + classmap_name="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_interval_legend(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_interval_legend( + classmap_name="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_legend(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_legend( + color_map_name="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_register_mosaics_search(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.register_mosaics_search( + body={ + "bbox": [0.0], + "collections": ["str"], + "datetime": "str", + "filter": {"str": {}}, + "filter-lang": "str", + "ids": ["str"], + "intersects": "geometry", + "metadata": { + "assets": ["str"], + "bounds": "str", + "defaults": {"str": "str"}, + "maxzoom": 0, + "minzoom": 0, + "name": "str", + "type": "str", + }, + "query": {"str": {}}, + "sortby": [{"direction": "str", "field": "str"}], + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_list_tilesets(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.list_tilesets( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tileset_metadata(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tileset_metadata( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tile(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tile( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tile_by_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tile_by_format( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tile_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tile_by_scale( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tile_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tile_by_scale_and_format( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tile_no_tms( + collection_id="str", + item_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tile_no_tms_by_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tile_no_tms_by_format( + collection_id="str", + item_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tile_no_tms_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tile_no_tms_by_scale( + collection_id="str", + item_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_tile_no_tms_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_tile_no_tms_by_scale_and_format( + collection_id="str", + item_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_crop_feature_geo_json(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.crop_feature_geo_json( + collection_id="str", + item_id="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_crop_feature_geo_json_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.crop_feature_geo_json_format( + collection_id="str", + item_id="str", + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_crop_feature_geo_json_width_by_height(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.crop_feature_geo_json_width_by_height( + collection_id="str", + item_id="str", + width=0, + height=0, + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_bounds(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_bounds( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_info(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_info( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_info_geo_json(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_info_geo_json( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_list_item_available_assets(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.list_item_available_assets( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_asset_statistics(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_asset_statistics( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_list_item_statistics(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.list_item_statistics( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_geo_json_statistics(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_geo_json_statistics( + collection_id="str", + item_id="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_tile_json(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_tile_json( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_tile_json_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_tile_json_tms( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_wmts_capabilities(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_wmts_capabilities( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_wmts_capabilities_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_wmts_capabilities_tms( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_point(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_point( + collection_id="str", + item_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_preview(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_preview( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_preview_with_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_preview_with_format( + collection_id="str", + item_id="str", + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_bbox_crop(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_bbox_crop( + collection_id="str", + item_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_item_bbox_crop_with_dimensions(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_item_bbox_crop_with_dimensions( + collection_id="str", + item_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + width=0, + height=0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_list_collection_tilesets(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.list_collection_tilesets( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tileset_metadata(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tileset_metadata( + collection_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile_by_scale_and_format( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile_by_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile_by_format( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile_by_scale( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile_no_tms_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile_no_tms_by_scale_and_format( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile_no_tms( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile_no_tms_by_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile_no_tms_by_format( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile_no_tms_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile_no_tms_by_scale( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile_json(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile_json( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_tile_json_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_tile_json_tms( + collection_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_wmts_capabilities(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_wmts_capabilities( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_wmts_capabilities_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_wmts_capabilities_tms( + collection_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_assets_for_tile(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_assets_for_tile( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_assets_for_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_assets_for_tile_no_tms( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_assets_for_bbox(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_assets_for_bbox( + collection_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_info(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_info( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_bbox_crop(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_bbox_crop( + collection_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_bbox_crop_with_dimensions(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_bbox_crop_with_dimensions( + collection_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + width=0, + height=0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_crop_collection_feature_geo_json(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.crop_collection_feature_geo_json( + collection_id="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_crop_collection_feature_geo_json_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.crop_collection_feature_geo_json_format( + collection_id="str", + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_crop_collection_feature_geo_json_width_by_height(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.crop_collection_feature_geo_json_width_by_height( + collection_id="str", + width=0, + height=0, + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_point(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_point( + collection_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_collection_point_assets(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_collection_point_assets( + collection_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_list_searches_tilesets(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.list_searches_tilesets( + search_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tileset_metadata(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tileset_metadata( + search_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile_by_scale_and_format( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile_by_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile_by_format( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile_by_scale( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_assets_for_tile(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_assets_for_tile( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile_json_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile_json_tms( + search_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_wmts_capabilities_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_wmts_capabilities_tms( + search_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_info(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_info( + search_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_bbox_crop(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_bbox_crop( + search_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_bbox_crop_with_dimensions(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_bbox_crop_with_dimensions( + search_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + width=0, + height=0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_bbox_assets(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_bbox_assets( + search_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_crop_searches_feature_geo_json(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.crop_searches_feature_geo_json( + search_id="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_crop_searches_feature_geo_json_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.crop_searches_feature_geo_json_format( + search_id="str", + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_crop_searches_feature_geo_json_width_by_height(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.crop_searches_feature_geo_json_width_by_height( + search_id="str", + width=0, + height=0, + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_wmts_capabilities(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_wmts_capabilities( + search_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile_json(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile_json( + search_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile_no_tms( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile_no_tms_by_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile_no_tms_by_format( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile_no_tms_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile_no_tms_by_scale( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_tile_no_tms_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_tile_no_tms_by_scale_and_format( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_assets_for_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_assets_for_tile_no_tms( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_point(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_point( + search_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_data_get_searches_point_with_assets(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.data.get_searches_point_with_assets( + search_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_data_operations_async.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_data_operations_async.py new file mode 100644 index 000000000000..194babc42a23 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_data_operations_async.py @@ -0,0 +1,1205 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import PlanetaryComputerProPreparer +from testpreparer_async import PlanetaryComputerProClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProDataOperationsAsync(PlanetaryComputerProClientTestBaseAsync): + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tile_matrix_definitions(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tile_matrix_definitions( + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_list_tile_matrices(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.list_tile_matrices() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_class_map_legend(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_class_map_legend( + classmap_name="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_interval_legend(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_interval_legend( + classmap_name="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_legend(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_legend( + color_map_name="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_register_mosaics_search(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.register_mosaics_search( + body={ + "bbox": [0.0], + "collections": ["str"], + "datetime": "str", + "filter": {"str": {}}, + "filter-lang": "str", + "ids": ["str"], + "intersects": "geometry", + "metadata": { + "assets": ["str"], + "bounds": "str", + "defaults": {"str": "str"}, + "maxzoom": 0, + "minzoom": 0, + "name": "str", + "type": "str", + }, + "query": {"str": {}}, + "sortby": [{"direction": "str", "field": "str"}], + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_list_tilesets(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.list_tilesets( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tileset_metadata(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tileset_metadata( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tile(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tile( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tile_by_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tile_by_format( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tile_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tile_by_scale( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tile_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tile_by_scale_and_format( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tile_no_tms( + collection_id="str", + item_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tile_no_tms_by_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tile_no_tms_by_format( + collection_id="str", + item_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tile_no_tms_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tile_no_tms_by_scale( + collection_id="str", + item_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_tile_no_tms_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_tile_no_tms_by_scale_and_format( + collection_id="str", + item_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_crop_feature_geo_json(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.crop_feature_geo_json( + collection_id="str", + item_id="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_crop_feature_geo_json_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.crop_feature_geo_json_format( + collection_id="str", + item_id="str", + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_crop_feature_geo_json_width_by_height(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.crop_feature_geo_json_width_by_height( + collection_id="str", + item_id="str", + width=0, + height=0, + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_bounds(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_bounds( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_info(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_info( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_info_geo_json(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_info_geo_json( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_list_item_available_assets(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.list_item_available_assets( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_asset_statistics(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_asset_statistics( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_list_item_statistics(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.list_item_statistics( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_geo_json_statistics(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_geo_json_statistics( + collection_id="str", + item_id="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_tile_json(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_tile_json( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_tile_json_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_tile_json_tms( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_wmts_capabilities(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_wmts_capabilities( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_wmts_capabilities_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_wmts_capabilities_tms( + collection_id="str", + item_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_point(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_point( + collection_id="str", + item_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_preview(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_preview( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_preview_with_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_preview_with_format( + collection_id="str", + item_id="str", + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_bbox_crop(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_bbox_crop( + collection_id="str", + item_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_item_bbox_crop_with_dimensions(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_item_bbox_crop_with_dimensions( + collection_id="str", + item_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + width=0, + height=0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_list_collection_tilesets(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.list_collection_tilesets( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tileset_metadata(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tileset_metadata( + collection_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile_by_scale_and_format( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile_by_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile_by_format( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile_by_scale( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile_no_tms_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile_no_tms_by_scale_and_format( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile_no_tms( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile_no_tms_by_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile_no_tms_by_format( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile_no_tms_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile_no_tms_by_scale( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile_json(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile_json( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_tile_json_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_tile_json_tms( + collection_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_wmts_capabilities(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_wmts_capabilities( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_wmts_capabilities_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_wmts_capabilities_tms( + collection_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_assets_for_tile(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_assets_for_tile( + collection_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_assets_for_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_assets_for_tile_no_tms( + collection_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_assets_for_bbox(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_assets_for_bbox( + collection_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_info(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_info( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_bbox_crop(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_bbox_crop( + collection_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_bbox_crop_with_dimensions(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_bbox_crop_with_dimensions( + collection_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + width=0, + height=0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_crop_collection_feature_geo_json(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.crop_collection_feature_geo_json( + collection_id="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_crop_collection_feature_geo_json_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.crop_collection_feature_geo_json_format( + collection_id="str", + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_crop_collection_feature_geo_json_width_by_height(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.crop_collection_feature_geo_json_width_by_height( + collection_id="str", + width=0, + height=0, + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_point(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_point( + collection_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_collection_point_assets(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_collection_point_assets( + collection_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_list_searches_tilesets(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.list_searches_tilesets( + search_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tileset_metadata(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tileset_metadata( + search_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile_by_scale_and_format( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile_by_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile_by_format( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile_by_scale( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_assets_for_tile(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_assets_for_tile( + search_id="str", + tile_matrix_set_id="str", + z=0.0, + x=0.0, + y=0.0, + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile_json_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile_json_tms( + search_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_wmts_capabilities_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_wmts_capabilities_tms( + search_id="str", + tile_matrix_set_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_info(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_info( + search_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_bbox_crop(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_bbox_crop( + search_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_bbox_crop_with_dimensions(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_bbox_crop_with_dimensions( + search_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + width=0, + height=0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_bbox_assets(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_bbox_assets( + search_id="str", + minx=0.0, + miny=0.0, + maxx=0.0, + maxy=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_crop_searches_feature_geo_json(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.crop_searches_feature_geo_json( + search_id="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_crop_searches_feature_geo_json_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.crop_searches_feature_geo_json_format( + search_id="str", + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_crop_searches_feature_geo_json_width_by_height(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.crop_searches_feature_geo_json_width_by_height( + search_id="str", + width=0, + height=0, + format="str", + body={"geometry": "geometry", "type": "str", "properties": {"str": {}}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_wmts_capabilities(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_wmts_capabilities( + search_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile_json(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile_json( + search_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile_no_tms( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile_no_tms_by_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile_no_tms_by_format( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile_no_tms_by_scale(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile_no_tms_by_scale( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_tile_no_tms_by_scale_and_format(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_tile_no_tms_by_scale_and_format( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + scale=0.0, + format="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_assets_for_tile_no_tms(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_assets_for_tile_no_tms( + search_id="str", + z=0.0, + x=0.0, + y=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_point(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_point( + search_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_data_get_searches_point_with_assets(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.data.get_searches_point_with_assets( + search_id="str", + longitude=0.0, + latitude=0.0, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_ingestion_operations.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_ingestion_operations.py new file mode 100644 index 000000000000..309c6bd75968 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_ingestion_operations.py @@ -0,0 +1,243 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import PlanetaryComputerProClientTestBase, PlanetaryComputerProPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProIngestionOperations(PlanetaryComputerProClientTestBase): + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_cancel_operation(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.cancel_operation( + operation_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_cancel_all_operations(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.cancel_all_operations() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_get_operation(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.get_operation( + operation_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_list_operations(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list_operations() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_create_run(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.create_run( + collection_id="str", + ingestion_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_get_run(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.get_run( + collection_id="str", + ingestion_id="str", + run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_list_runs(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list_runs( + collection_id="str", + ingestion_id="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_create(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.create( + collection_id="str", + body={ + "creationTime": "2020-02-20 00:00:00", + "id": "str", + "importType": "str", + "status": "str", + "displayName": "str", + "keepOriginalAssets": bool, + "skipExistingItems": bool, + "sourceCatalogUrl": "str", + "stacGeoparquetUrl": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_begin_delete(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.begin_delete( + collection_id="str", + ingestion_id="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_get(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.get( + collection_id="str", + ingestion_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_list(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list( + collection_id="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_update(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.update( + collection_id="str", + ingestion_id="str", + body={ + "creationTime": "2020-02-20 00:00:00", + "id": "str", + "importType": "str", + "status": "str", + "displayName": "str", + "keepOriginalAssets": bool, + "skipExistingItems": bool, + "sourceCatalogUrl": "str", + "stacGeoparquetUrl": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_create_source(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.create_source( + body={ + "connectionInfo": {"containerUrl": "str", "objectId": "str"}, + "id": "str", + "kind": "BlobManagedIdentity", + "created": "2020-02-20 00:00:00", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_replace_source(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.replace_source( + id="str", + body={ + "connectionInfo": {"containerUrl": "str", "objectId": "str"}, + "id": "str", + "kind": "BlobManagedIdentity", + "created": "2020-02-20 00:00:00", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_delete_source(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.delete_source( + id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_get_source(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.get_source( + id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_list_sources(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list_sources() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_ingestion_list_managed_identities(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list_managed_identities() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_ingestion_operations_async.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_ingestion_operations_async.py new file mode 100644 index 000000000000..75f1b0fb0613 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_ingestion_operations_async.py @@ -0,0 +1,246 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import PlanetaryComputerProPreparer +from testpreparer_async import PlanetaryComputerProClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProIngestionOperationsAsync(PlanetaryComputerProClientTestBaseAsync): + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_cancel_operation(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.cancel_operation( + operation_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_cancel_all_operations(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.cancel_all_operations() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_get_operation(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.get_operation( + operation_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_list_operations(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list_operations() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_create_run(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.create_run( + collection_id="str", + ingestion_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_get_run(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.get_run( + collection_id="str", + ingestion_id="str", + run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_list_runs(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list_runs( + collection_id="str", + ingestion_id="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_create(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.create( + collection_id="str", + body={ + "creationTime": "2020-02-20 00:00:00", + "id": "str", + "importType": "str", + "status": "str", + "displayName": "str", + "keepOriginalAssets": bool, + "skipExistingItems": bool, + "sourceCatalogUrl": "str", + "stacGeoparquetUrl": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_begin_delete(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await ( + await client.ingestion.begin_delete( + collection_id="str", + ingestion_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_get(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.get( + collection_id="str", + ingestion_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_list(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list( + collection_id="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_update(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.update( + collection_id="str", + ingestion_id="str", + body={ + "creationTime": "2020-02-20 00:00:00", + "id": "str", + "importType": "str", + "status": "str", + "displayName": "str", + "keepOriginalAssets": bool, + "skipExistingItems": bool, + "sourceCatalogUrl": "str", + "stacGeoparquetUrl": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_create_source(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.create_source( + body={ + "connectionInfo": {"containerUrl": "str", "objectId": "str"}, + "id": "str", + "kind": "BlobManagedIdentity", + "created": "2020-02-20 00:00:00", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_replace_source(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.replace_source( + id="str", + body={ + "connectionInfo": {"containerUrl": "str", "objectId": "str"}, + "id": "str", + "kind": "BlobManagedIdentity", + "created": "2020-02-20 00:00:00", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_delete_source(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.delete_source( + id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_get_source(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.ingestion.get_source( + id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_list_sources(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list_sources() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_ingestion_list_managed_identities(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = client.ingestion.list_managed_identities() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_sas_operations.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_sas_operations.py new file mode 100644 index 000000000000..a9cdc0535438 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_sas_operations.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import PlanetaryComputerProClientTestBase, PlanetaryComputerProPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProSasOperations(PlanetaryComputerProClientTestBase): + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_sas_get_sign(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.sas.get_sign( + href="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_sas_get_token(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.sas.get_token( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_sas_revoke_token(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.sas.revoke_token() + + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_sas_operations_async.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_sas_operations_async.py new file mode 100644 index 000000000000..c497f81ab67a --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_sas_operations_async.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import PlanetaryComputerProPreparer +from testpreparer_async import PlanetaryComputerProClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProSasOperationsAsync(PlanetaryComputerProClientTestBaseAsync): + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_sas_get_sign(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.sas.get_sign( + href="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_sas_get_token(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.sas.get_token( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_sas_revoke_token(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.sas.revoke_token() + + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_shared_access_signature_operations.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_shared_access_signature_operations.py new file mode 100644 index 000000000000..e38d58578c56 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_shared_access_signature_operations.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import PlanetaryComputerProClientTestBase, PlanetaryComputerProPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProSharedAccessSignatureOperations(PlanetaryComputerProClientTestBase): + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_shared_access_signature_get_sign(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.shared_access_signature.get_sign( + href="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_shared_access_signature_get_token(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.shared_access_signature.get_token( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_shared_access_signature_revoke_token(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.shared_access_signature.revoke_token() + + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_shared_access_signature_operations_async.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_shared_access_signature_operations_async.py new file mode 100644 index 000000000000..ac7b41c36d62 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_shared_access_signature_operations_async.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import PlanetaryComputerProPreparer +from testpreparer_async import PlanetaryComputerProClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProSharedAccessSignatureOperationsAsync(PlanetaryComputerProClientTestBaseAsync): + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_shared_access_signature_get_sign(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.shared_access_signature.get_sign( + href="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_shared_access_signature_get_token(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.shared_access_signature.get_token( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_shared_access_signature_revoke_token(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.shared_access_signature.revoke_token() + + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_stac_operations.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_stac_operations.py new file mode 100644 index 000000000000..4880829ed0cb --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_stac_operations.py @@ -0,0 +1,809 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import PlanetaryComputerProClientTestBase, PlanetaryComputerProPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProStacOperations(PlanetaryComputerProClientTestBase): + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_create_collection_asset(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.create_collection_asset( + collection_id="str", + body={ + "data": {"description": "str", "key": "str", "roles": ["str"], "title": "str", "type": "str"}, + "file": "filetype", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_replace_collection_asset(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.replace_collection_asset( + collection_id="str", + asset_id="str", + body={ + "data": {"description": "str", "key": "str", "roles": ["str"], "title": "str", "type": "str"}, + "file": "filetype", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_delete_collection_asset(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.delete_collection_asset( + collection_id="str", + asset_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_collection_configuration(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_collection_configuration( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_add_mosaic(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.add_mosaic( + collection_id="str", + body={"cql": [{"str": {}}], "id": "str", "name": "str", "description": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_replace_mosaic(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.replace_mosaic( + collection_id="str", + mosaic_id="str", + body={"cql": [{"str": {}}], "id": "str", "name": "str", "description": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_delete_mosaic(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.delete_mosaic( + collection_id="str", + mosaic_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_mosaic(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_mosaic( + collection_id="str", + mosaic_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_list_mosaics(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.list_mosaics( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_begin_create_collection(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.begin_create_collection( + body={ + "description": "str", + "extent": {"spatial": {"bbox": [[0.0]]}, "temporal": {"interval": [["2020-02-20 00:00:00"]]}}, + "id": "str", + "license": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "item_assets": { + "str": { + "title": "str", + "type": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "href": "str", + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "updated": "2020-02-20 00:00:00", + } + }, + "keywords": ["str"], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "stac_extensions": ["str"], + "stac_version": "str", + "summaries": {"str": {}}, + "title": "str", + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_replace_collection(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.replace_collection( + collection_id="str", + body={ + "description": "str", + "extent": {"spatial": {"bbox": [[0.0]]}, "temporal": {"interval": [["2020-02-20 00:00:00"]]}}, + "id": "str", + "license": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "item_assets": { + "str": { + "title": "str", + "type": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "href": "str", + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "updated": "2020-02-20 00:00:00", + } + }, + "keywords": ["str"], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "stac_extensions": ["str"], + "stac_version": "str", + "summaries": {"str": {}}, + "title": "str", + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_begin_delete_collection(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.begin_delete_collection( + collection_id="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_collection(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_collection( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_collections(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_collections() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_partition_type(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_partition_type( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_replace_partition_type(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.replace_partition_type( + collection_id="str", + body={"scheme": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_create_render_option(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.create_render_option( + collection_id="str", + body={ + "id": "str", + "name": "str", + "conditions": [{"property": "str", "value": "str"}], + "description": "str", + "legend": {"labels": ["str"], "scaleFactor": 0.0, "trimEnd": 0, "trimStart": 0, "type": "str"}, + "minZoom": 0, + "options": "str", + "type": "str", + "vectorOptions": { + "sourceLayer": "str", + "tilejsonKey": "str", + "fillColor": "str", + "filter": ["str"], + "strokeColor": "str", + "strokeWidth": 0, + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_replace_render_option(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.replace_render_option( + collection_id="str", + render_option_id="str", + body={ + "id": "str", + "name": "str", + "conditions": [{"property": "str", "value": "str"}], + "description": "str", + "legend": {"labels": ["str"], "scaleFactor": 0.0, "trimEnd": 0, "trimStart": 0, "type": "str"}, + "minZoom": 0, + "options": "str", + "type": "str", + "vectorOptions": { + "sourceLayer": "str", + "tilejsonKey": "str", + "fillColor": "str", + "filter": ["str"], + "strokeColor": "str", + "strokeWidth": 0, + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_delete_render_option(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.delete_render_option( + collection_id="str", + render_option_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_render_option(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_render_option( + collection_id="str", + render_option_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_list_render_options(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.list_render_options( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_collection_thumbnail(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_collection_thumbnail( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_tile_settings(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_tile_settings( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_replace_tile_settings(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.replace_tile_settings( + collection_id="str", + body={"maxItemsPerTile": 0, "minZoom": 0, "defaultLocation": {"coordinates": [0.0], "zoom": 0}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_conformance_class(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_conformance_class() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_landing_page(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_landing_page() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_begin_create_item(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.begin_create_item( + collection_id="str", + body={ + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "bbox": [0.0], + "geometry": "geometry", + "id": "str", + "properties": { + "datetime": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "end_datetime": "2020-02-20 00:00:00", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "start_datetime": "2020-02-20 00:00:00", + "title": "str", + "updated": "2020-02-20 00:00:00", + }, + "type": "Feature", + "_msft:etag": "str", + "_msft:ts": "2020-02-20 00:00:00", + "collection": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "stac_extensions": ["str"], + "stac_version": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_begin_replace_item(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.begin_replace_item( + collection_id="str", + item_id="str", + body={ + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "bbox": [0.0], + "geometry": "geometry", + "id": "str", + "properties": { + "datetime": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "end_datetime": "2020-02-20 00:00:00", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "start_datetime": "2020-02-20 00:00:00", + "title": "str", + "updated": "2020-02-20 00:00:00", + }, + "type": "Feature", + "_msft:etag": "str", + "_msft:ts": "2020-02-20 00:00:00", + "collection": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "stac_extensions": ["str"], + "stac_version": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_begin_delete_item(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.begin_delete_item( + collection_id="str", + item_id="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_item(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_item( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_item_collection(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_item_collection( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_begin_update_item(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.begin_update_item( + collection_id="str", + item_id="str", + body={ + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "bbox": [0.0], + "geometry": "geometry", + "id": "str", + "properties": { + "datetime": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "end_datetime": "2020-02-20 00:00:00", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "start_datetime": "2020-02-20 00:00:00", + "title": "str", + "updated": "2020-02-20 00:00:00", + }, + "type": "Feature", + "_msft:etag": "str", + "_msft:ts": "2020-02-20 00:00:00", + "collection": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "stac_extensions": ["str"], + "stac_version": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_create_queryables(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.create_queryables( + collection_id="str", + body=[{"definition": {"str": {}}, "name": "str", "create_index": bool, "data_type": "str"}], + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_replace_queryable(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.replace_queryable( + collection_id="str", + queryable_name="str", + body={"definition": {"str": {}}, "name": "str", "create_index": bool, "data_type": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_delete_queryable(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.delete_queryable( + collection_id="str", + queryable_name="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_list_queryables(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.list_queryables() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_get_collection_queryables(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.get_collection_queryables( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy + def test_stac_search(self, planetarycomputerpro_endpoint): + client = self.create_client(endpoint=planetarycomputerpro_endpoint) + response = client.stac.search( + body={ + "bbox": [0.0], + "collections": ["str"], + "conf": {"str": {}}, + "datetime": "str", + "fields": [{"exclude": ["str"], "include": ["str"]}], + "filter": {"str": {}}, + "filter-crs": "str", + "filter-lang": "str", + "ids": ["str"], + "intersects": "geometry", + "limit": 0, + "query": {"str": {}}, + "sortby": [{"direction": "str", "field": "str"}], + "token": "str", + }, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_stac_operations_async.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_stac_operations_async.py new file mode 100644 index 000000000000..c338c4b3f1b7 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/test_planetary_computer_pro_stac_operations_async.py @@ -0,0 +1,822 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import PlanetaryComputerProPreparer +from testpreparer_async import PlanetaryComputerProClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPlanetaryComputerProStacOperationsAsync(PlanetaryComputerProClientTestBaseAsync): + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_create_collection_asset(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.create_collection_asset( + collection_id="str", + body={ + "data": {"description": "str", "key": "str", "roles": ["str"], "title": "str", "type": "str"}, + "file": "filetype", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_replace_collection_asset(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.replace_collection_asset( + collection_id="str", + asset_id="str", + body={ + "data": {"description": "str", "key": "str", "roles": ["str"], "title": "str", "type": "str"}, + "file": "filetype", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_delete_collection_asset(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.delete_collection_asset( + collection_id="str", + asset_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_collection_configuration(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_collection_configuration( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_add_mosaic(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.add_mosaic( + collection_id="str", + body={"cql": [{"str": {}}], "id": "str", "name": "str", "description": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_replace_mosaic(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.replace_mosaic( + collection_id="str", + mosaic_id="str", + body={"cql": [{"str": {}}], "id": "str", "name": "str", "description": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_delete_mosaic(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.delete_mosaic( + collection_id="str", + mosaic_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_mosaic(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_mosaic( + collection_id="str", + mosaic_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_list_mosaics(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.list_mosaics( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_begin_create_collection(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await ( + await client.stac.begin_create_collection( + body={ + "description": "str", + "extent": {"spatial": {"bbox": [[0.0]]}, "temporal": {"interval": [["2020-02-20 00:00:00"]]}}, + "id": "str", + "license": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "item_assets": { + "str": { + "title": "str", + "type": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "href": "str", + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "updated": "2020-02-20 00:00:00", + } + }, + "keywords": ["str"], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "stac_extensions": ["str"], + "stac_version": "str", + "summaries": {"str": {}}, + "title": "str", + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_replace_collection(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.replace_collection( + collection_id="str", + body={ + "description": "str", + "extent": {"spatial": {"bbox": [[0.0]]}, "temporal": {"interval": [["2020-02-20 00:00:00"]]}}, + "id": "str", + "license": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "item_assets": { + "str": { + "title": "str", + "type": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "href": "str", + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "updated": "2020-02-20 00:00:00", + } + }, + "keywords": ["str"], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "stac_extensions": ["str"], + "stac_version": "str", + "summaries": {"str": {}}, + "title": "str", + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_begin_delete_collection(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await ( + await client.stac.begin_delete_collection( + collection_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_collection(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_collection( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_collections(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_collections() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_partition_type(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_partition_type( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_replace_partition_type(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.replace_partition_type( + collection_id="str", + body={"scheme": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_create_render_option(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.create_render_option( + collection_id="str", + body={ + "id": "str", + "name": "str", + "conditions": [{"property": "str", "value": "str"}], + "description": "str", + "legend": {"labels": ["str"], "scaleFactor": 0.0, "trimEnd": 0, "trimStart": 0, "type": "str"}, + "minZoom": 0, + "options": "str", + "type": "str", + "vectorOptions": { + "sourceLayer": "str", + "tilejsonKey": "str", + "fillColor": "str", + "filter": ["str"], + "strokeColor": "str", + "strokeWidth": 0, + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_replace_render_option(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.replace_render_option( + collection_id="str", + render_option_id="str", + body={ + "id": "str", + "name": "str", + "conditions": [{"property": "str", "value": "str"}], + "description": "str", + "legend": {"labels": ["str"], "scaleFactor": 0.0, "trimEnd": 0, "trimStart": 0, "type": "str"}, + "minZoom": 0, + "options": "str", + "type": "str", + "vectorOptions": { + "sourceLayer": "str", + "tilejsonKey": "str", + "fillColor": "str", + "filter": ["str"], + "strokeColor": "str", + "strokeWidth": 0, + }, + }, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_delete_render_option(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.delete_render_option( + collection_id="str", + render_option_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_render_option(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_render_option( + collection_id="str", + render_option_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_list_render_options(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.list_render_options( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_collection_thumbnail(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_collection_thumbnail( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_tile_settings(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_tile_settings( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_replace_tile_settings(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.replace_tile_settings( + collection_id="str", + body={"maxItemsPerTile": 0, "minZoom": 0, "defaultLocation": {"coordinates": [0.0], "zoom": 0}}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_conformance_class(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_conformance_class() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_landing_page(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_landing_page() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_begin_create_item(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await ( + await client.stac.begin_create_item( + collection_id="str", + body={ + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "bbox": [0.0], + "geometry": "geometry", + "id": "str", + "properties": { + "datetime": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "end_datetime": "2020-02-20 00:00:00", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "start_datetime": "2020-02-20 00:00:00", + "title": "str", + "updated": "2020-02-20 00:00:00", + }, + "type": "Feature", + "_msft:etag": "str", + "_msft:ts": "2020-02-20 00:00:00", + "collection": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "stac_extensions": ["str"], + "stac_version": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_begin_replace_item(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await ( + await client.stac.begin_replace_item( + collection_id="str", + item_id="str", + body={ + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "bbox": [0.0], + "geometry": "geometry", + "id": "str", + "properties": { + "datetime": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "end_datetime": "2020-02-20 00:00:00", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "start_datetime": "2020-02-20 00:00:00", + "title": "str", + "updated": "2020-02-20 00:00:00", + }, + "type": "Feature", + "_msft:etag": "str", + "_msft:ts": "2020-02-20 00:00:00", + "collection": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "stac_extensions": ["str"], + "stac_version": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_begin_delete_item(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await ( + await client.stac.begin_delete_item( + collection_id="str", + item_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_item(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_item( + collection_id="str", + item_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_item_collection(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_item_collection( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_begin_update_item(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await ( + await client.stac.begin_update_item( + collection_id="str", + item_id="str", + body={ + "assets": { + "str": { + "href": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "roles": ["str"], + "title": "str", + "type": "str", + "updated": "2020-02-20 00:00:00", + } + }, + "bbox": [0.0], + "geometry": "geometry", + "id": "str", + "properties": { + "datetime": "str", + "constellation": "str", + "created": "2020-02-20 00:00:00", + "description": "str", + "end_datetime": "2020-02-20 00:00:00", + "gsd": 0.0, + "instruments": ["str"], + "mission": "str", + "platform": "str", + "providers": [{"name": "str", "description": "str", "roles": ["str"], "url": "str"}], + "start_datetime": "2020-02-20 00:00:00", + "title": "str", + "updated": "2020-02-20 00:00:00", + }, + "type": "Feature", + "_msft:etag": "str", + "_msft:ts": "2020-02-20 00:00:00", + "collection": "str", + "links": [ + { + "href": "str", + "body": {"str": {}}, + "headers": {"str": "str"}, + "hreflang": "str", + "length": 0, + "merge": bool, + "method": "GET", + "rel": "str", + "title": "str", + "type": "str", + } + ], + "msft:_created": "2020-02-20 00:00:00", + "msft:_updated": "2020-02-20 00:00:00", + "msft:short_description": "str", + "stac_extensions": ["str"], + "stac_version": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_create_queryables(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.create_queryables( + collection_id="str", + body=[{"definition": {"str": {}}, "name": "str", "create_index": bool, "data_type": "str"}], + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_replace_queryable(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.replace_queryable( + collection_id="str", + queryable_name="str", + body={"definition": {"str": {}}, "name": "str", "create_index": bool, "data_type": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_delete_queryable(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.delete_queryable( + collection_id="str", + queryable_name="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_list_queryables(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.list_queryables() + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_get_collection_queryables(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.get_collection_queryables( + collection_id="str", + ) + + # please add some check logic here by yourself + # ... + + @PlanetaryComputerProPreparer() + @recorded_by_proxy_async + async def test_stac_search(self, planetarycomputerpro_endpoint): + client = self.create_async_client(endpoint=planetarycomputerpro_endpoint) + response = await client.stac.search( + body={ + "bbox": [0.0], + "collections": ["str"], + "conf": {"str": {}}, + "datetime": "str", + "fields": [{"exclude": ["str"], "include": ["str"]}], + "filter": {"str": {}}, + "filter-crs": "str", + "filter-lang": "str", + "ids": ["str"], + "intersects": "geometry", + "limit": 0, + "query": {"str": {}}, + "sortby": [{"direction": "str", "field": "str"}], + "token": "str", + }, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/testpreparer.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/testpreparer.py new file mode 100644 index 000000000000..c9ea7dd4aac5 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/testpreparer.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.planetarycomputer import PlanetaryComputerProClient +from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer +import functools + + +class PlanetaryComputerProClientTestBase(AzureRecordedTestCase): + + def create_client(self, endpoint): + credential = self.get_credential(PlanetaryComputerProClient) + return self.create_client_from_credential( + PlanetaryComputerProClient, + credential=credential, + endpoint=endpoint, + ) + + +PlanetaryComputerProPreparer = functools.partial( + PowerShellPreparer, + "planetarycomputerpro", + planetarycomputerpro_endpoint="https://fake_planetarycomputerpro_endpoint.com", +) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/testpreparer_async.py b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/testpreparer_async.py new file mode 100644 index 000000000000..52bbf3fab937 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/generated_tests/testpreparer_async.py @@ -0,0 +1,20 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.planetarycomputer.aio import PlanetaryComputerProClient +from devtools_testutils import AzureRecordedTestCase + + +class PlanetaryComputerProClientTestBaseAsync(AzureRecordedTestCase): + + def create_async_client(self, endpoint): + credential = self.get_credential(PlanetaryComputerProClient, is_async=True) + return self.create_client_from_credential( + PlanetaryComputerProClient, + credential=credential, + endpoint=endpoint, + ) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/pyproject.toml b/sdk/planetarycomputer/azure-planetarycomputer/pyproject.toml index 10a1800c3cdc..a83c599a3b82 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/pyproject.toml +++ b/sdk/planetarycomputer/azure-planetarycomputer/pyproject.toml @@ -17,23 +17,24 @@ authors = [ description = "Microsoft Corporation Azure Planetarycomputer Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ "isodate>=0.6.1", "azure-core>=1.37.0", "typing-extensions>=4.6.0", + "pystac>=1.11.0", + "geojson>=2.0.0", ] dynamic = [ "version", "readme" @@ -58,3 +59,9 @@ exclude = [ [tool.setuptools.package-data] pytyped = ["py.typed"] + +[tool.azure-sdk-build] +is_stable = true + +[tool.azure-sdk-conda] +in_bundle = false diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_00_stac_collection_async.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_00_stac_collection_async.py index 38fa9538ece3..00f209395fbc 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_00_stac_collection_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_00_stac_collection_async.py @@ -49,9 +49,7 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -63,16 +61,12 @@ async def create_collection(client: PlanetaryComputerProClient, collection_id): if any(c.id == collection_id for c in get_all_collections_response["collections"]): logging.info(f"Collection '{collection_id}' already exists, deleting it...") - collection_delete_operation = await client.stac.begin_delete_collection( - collection_id, polling=True - ) + collection_delete_operation = await client.stac.begin_delete_collection(collection_id, polling=True) await collection_delete_operation.result() logging.info(f"Deleted collection '{collection_id}'") # Define collection spatial and temporal extents (Georgia state bounds) - spatial_extent = StacExtensionSpatialExtent( - bounding_box=[[-85.605165, 30.357851, -80.839729, 35.000659]] - ) + spatial_extent = StacExtensionSpatialExtent(bounding_box=[[-85.605165, 30.357851, -80.839729, 35.000659]]) temporal_extent = StacCollectionTemporalExtent( interval=[ [ @@ -150,9 +144,7 @@ async def create_collection(client: PlanetaryComputerProClient, collection_id): # Create the collection logging.info(f"Creating collection '{collection_id}'...") - collection_create_operation = await client.stac.begin_create_collection( - body=collection_data, polling=False - ) + collection_create_operation = await client.stac.begin_create_collection(body=collection_data, polling=False) await collection_create_operation.result() logging.info(f"Collection '{collection_id}' created successfully") @@ -177,9 +169,7 @@ async def update_collection(client: PlanetaryComputerProClient, collection_id): # Update the collection logging.info("Updating collection...") - await client.stac.create_or_replace_collection( - collection_id=collection_id, body=collection - ) + await client.stac.replace_collection(collection_id=collection_id, body=collection) # Verify the update updated_collection = await client.stac.get_collection(collection_id=collection_id) @@ -200,9 +190,7 @@ async def manage_partition_type(client: PlanetaryComputerProClient, collection_i logging.info("Collection is not empty, skipping partition type update") else: logging.info("Updating partition type to YEAR scheme...") - await client.stac.replace_partition_type( - collection_id, body=PartitionType(scheme=PartitionTypeScheme.YEAR) - ) + await client.stac.replace_partition_type(collection_id, body=PartitionType(scheme=PartitionTypeScheme.YEAR)) logging.info("Partition type updated successfully") @@ -219,20 +207,12 @@ async def manage_render_options(client: PlanetaryComputerProClient, collection_i ) # Check if render option already exists - stac_collection_mosaics_get_all_response = await client.stac.list_render_options( - collection_id=collection_id - ) + stac_collection_mosaics_get_all_response = await client.stac.list_render_options(collection_id=collection_id) - if any( - ro.id == render_option.id for ro in stac_collection_mosaics_get_all_response - ): + if any(ro.id == render_option.id for ro in stac_collection_mosaics_get_all_response): logging.info("Render option 'natural-color' already exists.") - await client.stac.delete_render_option( - collection_id=collection_id, render_option_id=render_option.id - ) - logging.info( - "Deleted existing render option 'natural-color'. Proceeding to create a new one." - ) + await client.stac.delete_render_option(collection_id=collection_id, render_option_id=render_option.id) + logging.info("Deleted existing render option 'natural-color'. Proceeding to create a new one.") # Create render option without description initially render_option = RenderOption( @@ -244,9 +224,7 @@ async def manage_render_options(client: PlanetaryComputerProClient, collection_i ) logging.info(f"Creating render option '{render_option.id}'...") - await client.stac.create_render_option( - collection_id=collection_id, body=render_option - ) + await client.stac.create_render_option(collection_id=collection_id, body=render_option) # List render options await client.stac.list_render_options(collection_id=collection_id) @@ -277,17 +255,11 @@ async def manage_mosaics(client: PlanetaryComputerProClient, collection_id): ) # Check existing mosaics - stac_collection_mosaics_get_all_response = await client.stac.list_mosaics( - collection_id=collection_id - ) + stac_collection_mosaics_get_all_response = await client.stac.list_mosaics(collection_id=collection_id) if any(m.id == mosaic.id for m in stac_collection_mosaics_get_all_response): - logging.info( - f"Mosaic {mosaic.id} already exists. Deleting it before creating a new one." - ) - await client.stac.delete_mosaic( - collection_id=collection_id, mosaic_id=mosaic.id - ) + logging.info(f"Mosaic {mosaic.id} already exists. Deleting it before creating a new one.") + await client.stac.delete_mosaic(collection_id=collection_id, mosaic_id=mosaic.id) # Create Mosaic stac_collection_mosaics_add_response = await client.stac.add_mosaic( @@ -299,19 +271,15 @@ async def manage_mosaics(client: PlanetaryComputerProClient, collection_id): # Update with description mosaic.description = "Most recent available imagery in this collection" - stac_collection_mosaics_create_or_replace_response = ( - await client.stac.replace_mosaic( - collection_id=collection_id, - mosaic_id=mosaic.id, - body=mosaic, - ) + stac_collection_mosaics_create_or_replace_response = await client.stac.replace_mosaic( + collection_id=collection_id, + mosaic_id=mosaic.id, + body=mosaic, ) logging.info(stac_collection_mosaics_create_or_replace_response) # Get the mosaic - retrieved_mosaic = await client.stac.get_mosaic( - collection_id=collection_id, mosaic_id=mosaic.id - ) + retrieved_mosaic = await client.stac.get_mosaic(collection_id=collection_id, mosaic_id=mosaic.id) logging.info(retrieved_mosaic) @@ -349,9 +317,7 @@ async def get_landing_page(client: "PlanetaryComputerProClient"): async def manage_queryables(client: PlanetaryComputerProClient, collection_id): """Create and manage queryables for a collection.""" - stac_queryables_get_all_response = await client.stac.get_collection_queryables( - collection_id=collection_id - ) + stac_queryables_get_all_response = await client.stac.get_collection_queryables(collection_id=collection_id) queryable = StacQueryable( name="eo:cloud_cover", @@ -362,13 +328,8 @@ async def manage_queryables(client: PlanetaryComputerProClient, collection_id): }, ) - if any( - q == queryable.name - for q in stac_queryables_get_all_response["properties"].keys() - ): - await client.stac.delete_queryable( - collection_id=collection_id, queryable_name=queryable.name - ) + if any(q == queryable.name for q in stac_queryables_get_all_response["properties"].keys()): + await client.stac.delete_queryable(collection_id=collection_id, queryable_name=queryable.name) logging.info(f"Deleted existing '{queryable.name}' queryable.") stac_queryables_create_response = await client.stac.create_queryables( @@ -391,9 +352,7 @@ async def manage_queryables(client: PlanetaryComputerProClient, collection_id): await client.stac.list_queryables() -async def get_collection_configuration( - client: PlanetaryComputerProClient, collection_id -): +async def get_collection_configuration(client: PlanetaryComputerProClient, collection_id): """Get collection configuration.""" result = await client.stac.get_collection_configuration(collection_id=collection_id) logging.info(result) @@ -419,17 +378,13 @@ async def manage_collection_assets(client: PlanetaryComputerProClient, collectio thumbnail_tuple = ("thumbnail.png", thumbnail_bytes) try: - await client.stac.delete_collection_asset( - collection_id=collection_id, asset_id="thumbnail" - ) + await client.stac.delete_collection_asset(collection_id=collection_id, asset_id="thumbnail") logging.info("Deleted existing thumbnail asset.") except Exception: logging.info("No existing thumbnail asset to delete.") # Create Collection Asset - await client.stac.create_collection_asset( - collection_id=collection_id, body={"data": data, "file": thumbnail_tuple} - ) + await client.stac.create_collection_asset(collection_id=collection_id, body={"data": data, "file": thumbnail_tuple}) # Create or replace Collection Asset thumbnail_bytes.seek(0) # Reset BytesIO position @@ -448,9 +403,7 @@ async def manage_collection_assets(client: PlanetaryComputerProClient, collectio ) # Get the thumbnail as bytes - thumbnail_response = await client.stac.get_collection_thumbnail( - collection_id=collection_id - ) + thumbnail_response = await client.stac.get_collection_thumbnail(collection_id=collection_id) # Convert the generator to bytes # Collect the async iterator into a list @@ -472,9 +425,7 @@ async def main(): # Create client credential = DefaultAzureCredential() - client = PlanetaryComputerProClient( - endpoint=endpoint, credential=credential, logging_enable=True - ) + client = PlanetaryComputerProClient(endpoint=endpoint, credential=credential, logging_enable=True) logging.info(f"Connected to: {endpoint}") logging.info(f"Collection ID: {collection_id}\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_01_ingestion_management_async.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_01_ingestion_management_async.py index 8a2a3535fa17..260ab7bf7551 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_01_ingestion_management_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_01_ingestion_management_async.py @@ -53,9 +53,7 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -84,15 +82,11 @@ async def create_managed_identity_ingestion_sources( logging.info(f"Deleted existing source: {source.id}") # Create connection info with managed identity - connection_info = ManagedIdentityConnection( - container_uri=container_uri, object_id=managed_identity_object_id - ) + connection_info = ManagedIdentityConnection(container_uri=container_uri, object_id=managed_identity_object_id) # Create ingestion source with unique ID source_id = str(uuid.uuid4()) - ingestion_source = ManagedIdentityIngestionSource( - id=source_id, connection_info=connection_info - ) + ingestion_source = ManagedIdentityIngestionSource(id=source_id, connection_info=connection_info) created_source = await client.ingestion.create_source(body=ingestion_source) logging.info(f"Created managed identity ingestion source: {created_source.id}") @@ -123,9 +117,7 @@ async def create_or_replace_source( "AZURE_INGESTION_SAS_CONTAINER_URI environment variable must be set for create_or_replace_source" ) if not sas_token: - raise ValueError( - "AZURE_INGESTION_SAS_TOKEN environment variable must be set for create_or_replace_source" - ) + raise ValueError("AZURE_INGESTION_SAS_TOKEN environment variable must be set for create_or_replace_source") # Create connection info with SAS token connection_info = SharedAccessSignatureTokenConnection( @@ -133,21 +125,17 @@ async def create_or_replace_source( ) # Create ingestion source - ingestion_source = SharedAccessSignatureTokenIngestionSource( - id=source_id, connection_info=connection_info - ) + ingestion_source = SharedAccessSignatureTokenIngestionSource(id=source_id, connection_info=connection_info) # First call - replaces the existing source with original token - logging.info( - f"First call to create_or_replace_source with existing source ID: {source_id}" - ) - first_result = await client.ingestion.replace_source( - id=source_id, body=ingestion_source - ) + logging.info(f"First call to create_or_replace_source with existing source ID: {source_id}") + first_result = await client.ingestion.replace_source(id=source_id, body=ingestion_source) logging.info(f"First call result: {first_result.id}") # Second call - replaces again with modified token (demonstrates update capability) - updated_token = "sp=rl&st=2024-01-01T00:00:00Z&se=2024-12-31T23:59:59Z&sv=2023-01-03&sr=c&sig=UpdatedRandomSignature123456" + updated_token = ( + "sp=rl&st=2024-01-01T00:00:00Z&se=2024-12-31T23:59:59Z&sv=2023-01-03&sr=c&sig=UpdatedRandomSignature123456" + ) updated_connection_info = SharedAccessSignatureTokenConnection( container_uri=sas_container_uri, shared_access_signature_token=updated_token @@ -157,9 +145,7 @@ async def create_or_replace_source( ) logging.info("Second call to create_or_replace_source with updated SAS token") - second_result = await client.ingestion.replace_source( - id=source_id, body=updated_ingestion_source - ) + second_result = await client.ingestion.replace_source(id=source_id, body=updated_ingestion_source) logging.info(f"Second call result: {second_result.id}") return second_result.id @@ -190,9 +176,7 @@ async def create_github_public_ingestion( # Delete all existing ingestions logging.info("Deleting all existing ingestions...") async for ingestion in client.ingestion.list(collection_id=collection_id): - await client.ingestion.begin_delete( - collection_id=collection_id, ingestion_id=ingestion.id, polling=True - ) + await client.ingestion.begin_delete(collection_id=collection_id, ingestion_id=ingestion.id, polling=True) logging.info(f"Deleted existing ingestion: {ingestion.id}") # Create ingestion definition @@ -206,9 +190,7 @@ async def create_github_public_ingestion( # Create the ingestion logging.info("Creating ingestion for sample catalog...") - ingestion_response = await client.ingestion.create( - collection_id=collection_id, body=ingestion_definition - ) + ingestion_response = await client.ingestion.create(collection_id=collection_id, body=ingestion_definition) ingestion_id = ingestion_response.id logging.info(f"Created ingestion: {ingestion_id}") @@ -221,29 +203,21 @@ async def create_github_public_ingestion( ingestion = await client.ingestion.update( collection_id=collection_id, ingestion_id=ingestion_id, body=updated_definition ) - logging.info( - f"Updated ingestion display name to: {updated_definition.display_name}" - ) + logging.info(f"Updated ingestion display name to: {updated_definition.display_name}") return ingestion_id -async def get_ingestion_by_id( - client: PlanetaryComputerProClient, collection_id: str, ingestion_id: str -): +async def get_ingestion_by_id(client: PlanetaryComputerProClient, collection_id: str, ingestion_id: str): """Retrieve a specific ingestion by ID. This demonstrates using get to fetch a specific ingestion directly instead of listing all ingestions. """ - logging.info( - f"Retrieving ingestion: {ingestion_id} from collection: {collection_id}" - ) + logging.info(f"Retrieving ingestion: {ingestion_id} from collection: {collection_id}") try: - ingestion = await client.ingestion.get( - collection_id=collection_id, ingestion_id=ingestion_id - ) + ingestion = await client.ingestion.get(collection_id=collection_id, ingestion_id=ingestion_id) logging.info(f"Successfully retrieved ingestion: {ingestion.id}") logging.info(f" Display name: {ingestion.display_name}") @@ -257,9 +231,7 @@ async def get_ingestion_by_id( return None -async def list_ingestion_runs( - client: PlanetaryComputerProClient, collection_id: str, ingestion_id: str -): +async def list_ingestion_runs(client: PlanetaryComputerProClient, collection_id: str, ingestion_id: str): """List all runs for a specific ingestion. This demonstrates using list_runs to get all execution runs for an ingestion, @@ -268,9 +240,7 @@ async def list_ingestion_runs( logging.info(f"Listing runs for ingestion: {ingestion_id}") try: - async for run in client.ingestion.list_runs( - collection_id=collection_id, ingestion_id=ingestion_id - ): + async for run in client.ingestion.list_runs(collection_id=collection_id, ingestion_id=ingestion_id): operation = run.operation logging.info(f" Run ID: {run.id}") logging.info(f" Status: {operation.status}") @@ -284,16 +254,12 @@ async def list_ingestion_runs( if operation.status_history: for status_item in operation.status_history: if status_item.error_code: - logging.info( - f" Error: {status_item.error_code} - {status_item.error_message}" - ) + logging.info(f" Error: {status_item.error_code} - {status_item.error_message}") except Exception as e: logging.error(f"Failed to list runs for ingestion {ingestion_id}: {str(e)}") -async def create_sas_token_ingestion_source( - client: PlanetaryComputerProClient, sas_container_uri: str, sas_token: str -): +async def create_sas_token_ingestion_source(client: PlanetaryComputerProClient, sas_container_uri: str, sas_token: str): """Create a SAS token ingestion source with example values.""" # Validate required parameters @@ -327,15 +293,11 @@ async def create_sas_token_ingestion_source( return created_sas_source.id -async def create_ingestion_run( - client: PlanetaryComputerProClient, collection_id: str, ingestion_id: str -): +async def create_ingestion_run(client: PlanetaryComputerProClient, collection_id: str, ingestion_id: str): """Create an ingestion run.""" # Create ingestion run - run_response = await client.ingestion.create_run( - collection_id=collection_id, ingestion_id=ingestion_id - ) + run_response = await client.ingestion.create_run(collection_id=collection_id, ingestion_id=ingestion_id) logging.info(f"Created ingestion run: {run_response.id}") return run_response.id @@ -362,6 +324,8 @@ async def manage_operations(client: "PlanetaryComputerProClient"): # Cancel all operations try: + # Cancel all operations across the entire GeoCatalog instance. + # WARNING: This cancels ALL pending/running operations, not just those for a specific collection. await client.ingestion.cancel_all_operations() except HttpResponseError as e: raise RuntimeError("Failed to cancel all operations") from e @@ -375,9 +339,7 @@ async def main(): # Get optional ingestion-specific configuration (for examples) container_uri = os.environ.get("PLANETARYCOMPUTER_INGESTION_CONTAINER_URI") source_catalog_url = os.environ.get("PLANETARYCOMPUTER_INGESTION_CATALOG_URL") - managed_identity_object_id = os.environ.get( - "PLANETARYCOMPUTER_MANAGED_IDENTITY_OBJECT_ID" - ) + managed_identity_object_id = os.environ.get("PLANETARYCOMPUTER_MANAGED_IDENTITY_OBJECT_ID") sas_container_uri = os.environ.get("AZURE_INGESTION_SAS_CONTAINER_URI") sas_token = os.environ.get("AZURE_INGESTION_SAS_TOKEN") @@ -405,23 +367,15 @@ async def main(): # Execute ingestion management workflow # 1. Create managed identity and SAS token ingestion sources - await create_managed_identity_ingestion_sources( - client, container_uri, managed_identity_object_id - ) - sas_source_id = await create_sas_token_ingestion_source( - client, sas_container_uri, sas_token - ) + await create_managed_identity_ingestion_sources(client, container_uri, managed_identity_object_id) + sas_source_id = await create_sas_token_ingestion_source(client, sas_container_uri, sas_token) # 2. Demonstrate advanced source operations (idempotent) - updated_source_id = await create_or_replace_source( - client, sas_container_uri, sas_token, sas_source_id - ) + updated_source_id = await create_or_replace_source(client, sas_container_uri, sas_token, sas_source_id) await get_source_by_id(client, updated_source_id) # 3. Run actual ingestion hosted on GitHub - public_ingestion_id = await create_github_public_ingestion( - client, collection_id, source_catalog_url - ) + public_ingestion_id = await create_github_public_ingestion(client, collection_id, source_catalog_url) # 4. Demonstrate advanced ingestion operations await get_ingestion_by_id(client, collection_id, public_ingestion_id) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_02_stac_specification_async.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_02_stac_specification_async.py index 808223554c38..cfbe302fc6fe 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_02_stac_specification_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_02_stac_specification_async.py @@ -48,9 +48,7 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -69,11 +67,7 @@ async def search_collections(client: "PlanetaryComputerProClient"): # Show first few collections for collection in collections.collections[:3]: if collection.description: - desc = ( - collection.description[:100] + "..." - if len(collection.description) > 100 - else collection.description - ) + desc = collection.description[:100] + "..." if len(collection.description) > 100 else collection.description logging.info(f" - {collection.id}: {desc}") @@ -103,11 +97,7 @@ async def search_items(client: PlanetaryComputerProClient, collection_id): ], }, date_time="2021-01-01T00:00:00Z/2022-12-31T00:00:00Z", - sort_by=[ - StacSortExtension( - field="datetime", direction=StacSearchSortingDirection.DESC - ) - ], + sort_by=[StacSortExtension(field="datetime", direction=StacSearchSortingDirection.DESC)], limit=50, ) @@ -232,16 +222,12 @@ def get_sample_stac_item(collection_id: str, item_id: str) -> StacItem: async def create_stac_item(client: PlanetaryComputerProClient, collection_id, item_id): """Create a STAC item.""" stac_item = get_sample_stac_item(collection_id, item_id) - stac_item_get_items_response = await client.stac.get_item_collection( - collection_id=collection_id - ) + stac_item_get_items_response = await client.stac.get_item_collection(collection_id=collection_id) for item in stac_item_get_items_response.features: logging.error(item.id) if any(item.id == stac_item.id for item in stac_item_get_items_response.features): - logging.info( - f"Item {stac_item.id} already exists. Deleting it before creating a new one." - ) + logging.info(f"Item {stac_item.id} already exists. Deleting it before creating a new one.") delete_poller = await client.stac.begin_delete_item( collection_id=collection_id, item_id=stac_item.id, polling=True ) @@ -273,56 +259,44 @@ async def update_stac_item(client: PlanetaryComputerProClient, collection_id, it ) await stac_item_create_or_update_response.result() - logging.info( - f"Updated item {stac_item.id}, platform: {stac_item.properties['platform']}" - ) + logging.info(f"Updated item {stac_item.id}, platform: {stac_item.properties['platform']}") -async def create_or_replace_stac_item( - client: PlanetaryComputerProClient, collection_id, item_id -): +async def create_or_replace_stac_item(client: PlanetaryComputerProClient, collection_id, item_id): """Create or replace a STAC item (idempotent operation). - This demonstrates using begin_create_or_replace_item which is idempotent: + This demonstrates using begin_replace_item: - First ensures item exists by creating it with begin_create_item - - Then demonstrates replace using begin_create_or_replace_item + - Then demonstrates replace using begin_replace_item - Multiple calls with the same data produce the same result """ # First, create the item using begin_create_item stac_item = get_sample_stac_item(collection_id, item_id) try: - create_poller = await client.stac.begin_create_item( - collection_id=collection_id, body=stac_item, polling=True - ) + create_poller = await client.stac.begin_create_item(collection_id=collection_id, body=stac_item, polling=True) await create_poller.result() logging.info(f"Created item {item_id}") except ResourceExistsError: logging.info(f"Item {item_id} already exists, continuing...") # Verify creation - created_item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + created_item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) logging.info(f"Verified item {created_item.id}") # Now demonstrate create_or_replace (replace since item exists) stac_item.properties["platform"] = "Imagery Updated" stac_item.properties["processing_level"] = "L2" - replace_poller = await client.stac.begin_create_or_replace_item( + replace_poller = await client.stac.begin_replace_item( collection_id=collection_id, item_id=item_id, body=stac_item, polling=True ) await replace_poller.result() logging.info(f"Replaced item {item_id} using create_or_replace") # Verify replacement - replaced_item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) - logging.info( - f"Verified replaced item, platform: {replaced_item.properties.get('platform', 'N/A')}" - ) + replaced_item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) + logging.info(f"Verified replaced item, platform: {replaced_item.properties.get('platform', 'N/A')}") async def delete_stac_item(client: PlanetaryComputerProClient, collection_id, item_id): @@ -333,24 +307,18 @@ async def delete_stac_item(client: PlanetaryComputerProClient, collection_id, it """ try: # Check if item exists before attempting deletion - existing_item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + existing_item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) logging.info(f"Found item {existing_item.id} to delete") # Delete the item using begin_delete_item - delete_poller = await client.stac.begin_delete_item( - collection_id=collection_id, item_id=item_id, polling=True - ) + delete_poller = await client.stac.begin_delete_item(collection_id=collection_id, item_id=item_id, polling=True) await delete_poller.result() logging.info(f"Successfully deleted item {item_id}") # Verify deletion by attempting to retrieve the item try: await client.stac.get_item(collection_id=collection_id, item_id=item_id) - logging.warning( - f"Item {item_id} still exists after deletion (may take time to propagate)" - ) + logging.warning(f"Item {item_id} still exists after deletion (may take time to propagate)") except ResourceNotFoundError: logging.info(f"Verified item {item_id} was successfully deleted") @@ -386,11 +354,7 @@ async def query_items(client: PlanetaryComputerProClient, collection_id): # Sorted query sorted_options = StacSearchParameters( collections=[collection_id], - sort_by=[ - StacSortExtension( - field="eo:cloud_cover", direction=StacSearchSortingDirection.ASC - ) - ], + sort_by=[StacSortExtension(field="eo:cloud_cover", direction=StacSearchSortingDirection.ASC)], limit=3, ) @@ -404,16 +368,12 @@ async def query_items(client: PlanetaryComputerProClient, collection_id): async def get_queryables(client: PlanetaryComputerProClient, collection_id): """Get queryable properties for a collection.""" - queryables = await client.stac.get_collection_queryables( - collection_id=collection_id - ) + queryables = await client.stac.get_collection_queryables(collection_id=collection_id) properties = queryables.get("properties") if properties: for prop_name in list(properties.keys())[:10]: # Show first 10 - logging.info( - f" - {prop_name}: {properties[prop_name].get('description', '')}" - ) + logging.info(f" - {prop_name}: {properties[prop_name].get('description', '')}") async def main(): @@ -427,9 +387,7 @@ async def main(): # Create client credential = DefaultAzureCredential() - client = PlanetaryComputerProClient( - endpoint=endpoint, credential=credential, logging_enable=False - ) + client = PlanetaryComputerProClient(endpoint=endpoint, credential=credential, logging_enable=False) # Execute STAC specification operations await get_landing_page(client) @@ -442,9 +400,7 @@ async def main(): await create_stac_item(client, collection_id, item_id) await update_stac_item(client, collection_id, item_id) await create_or_replace_stac_item(client, collection_id, f"{item_id}_replace_demo") - await delete_stac_item( - client, collection_id, f"{item_id}_replace_demo" - ) # Clean up the item created above + await delete_stac_item(client, collection_id, f"{item_id}_replace_demo") # Clean up the item created above await get_collection(client, collection_id) await client.close() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_03_shared_access_signature_async.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_03_shared_access_signature_async.py index 84d2a5b64bc6..29ca1fad1292 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_03_shared_access_signature_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_03_shared_access_signature_async.py @@ -30,17 +30,13 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) async def generate_sas_token(client: PlanetaryComputerProClient, collection_id: str): """Generate a SAS token for a collection.""" - get_token_response = await client.shared_access_signature.get_token( - collection_id=collection_id, duration_in_minutes=60 - ) + get_token_response = await client.sas.get_token(collection_id=collection_id, duration_in_minutes=60) return get_token_response @@ -59,9 +55,7 @@ async def sign_asset_href(client: PlanetaryComputerProClient, collection_id: str else: raise Exception("No thumbnail found in collection assets.") - get_sign_response = await client.shared_access_signature.get_sign( - href=href, duration_in_minutes=60 - ) + get_sign_response = await client.sas.get_sign(href=href, duration_in_minutes=60) return get_sign_response.href, href # Return both signed and unsigned hrefs @@ -82,14 +76,12 @@ async def download_asset(signed_href: str): # Check that it's a PNG by verifying the PNG magic bytes (89 50 4E 47) is_png = content[:8] == b"\x89PNG\r\n\x1a\n" if not is_png: - raise Exception( - f"Downloaded content is not a valid PNG file (magic bytes: {content[:8].hex()})" - ) + raise Exception(f"Downloaded content is not a valid PNG file (magic bytes: {content[:8].hex()})") async def revoke_token(client: "PlanetaryComputerProClient") -> None: """Revoke the current SAS token.""" - await client.shared_access_signature.revoke_token() + await client.sas.revoke_token() async def main(): diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_04_stac_item_tiler_async.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_04_stac_item_tiler_async.py index 6b1267aecb4a..26e59b93ec0f 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_04_stac_item_tiler_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_04_stac_item_tiler_async.py @@ -32,9 +32,7 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -52,9 +50,7 @@ async def display_response(response, filename): async def get_tile_matrix_definitions(client: "PlanetaryComputerProClient"): """Get tile matrix definitions for WebMercatorQuad.""" - result = await client.data.get_tile_matrix_definitions( - tile_matrix_set_id="WebMercatorQuad" - ) + result = await client.data.get_tile_matrix_definitions(tile_matrix_set_id="WebMercatorQuad") logging.info(result) @@ -64,29 +60,19 @@ async def list_tile_matrices(client: "PlanetaryComputerProClient"): logging.info(result) -async def get_asset_statistics( - client: PlanetaryComputerProClient, collection_id, item_id -): +async def get_asset_statistics(client: PlanetaryComputerProClient, collection_id, item_id): """Get asset statistics for an item.""" - result = await client.data.get_asset_statistics( - collection_id=collection_id, item_id=item_id, assets=["image"] - ) + result = await client.data.get_item_asset_statistics(collection_id=collection_id, item_id=item_id, assets=["image"]) logging.info(result) -async def list_available_assets( - client: PlanetaryComputerProClient, collection_id, item_id -): +async def list_available_assets(client: PlanetaryComputerProClient, collection_id, item_id): """List available assets for an item.""" - result = client.data.list_available_assets( - collection_id=collection_id, item_id=item_id - ) + result = client.data.list_item_available_assets(collection_id=collection_id, item_id=item_id) logging.info(result) -async def get_item_asset_details( - client: PlanetaryComputerProClient, collection_id, item_id -): +async def get_item_asset_details(client: PlanetaryComputerProClient, collection_id, item_id): """Get basic info for dataset's assets. Returns dataset's basic information including data types, bounds, and other metadata @@ -94,61 +80,49 @@ async def get_item_asset_details( """ # Get info for specific assets - result_specific = await client.data.get_item_asset_details( - collection_id=collection_id, item_id=item_id, assets=["image"] - ) + result_specific = await client.data.get_item_info(collection_id=collection_id, item_id=item_id, assets=["image"]) logging.info("Assets info (image asset only):") logging.info(f" Dataset: {result_specific}") async def get_bounds(client: PlanetaryComputerProClient, collection_id, item_id): """List bounds for an item.""" - result = await client.data.get_bounds(collection_id=collection_id, item_id=item_id) + result = await client.data.get_item_bounds(collection_id=collection_id, item_id=item_id) logging.info(result) -async def crop_geo_json( - client: PlanetaryComputerProClient, collection_id, item_id, geojson -): +async def crop_geo_json(client: PlanetaryComputerProClient, collection_id, item_id, geojson): """Crop an item using GeoJSON geometry.""" - crop_geo_json_response = await client.data.crop_geo_json( + crop_geo_json_response = await client.data.crop_feature_geo_json( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], body=geojson, ) logging.info("Cropping with GeoJSON completed") await display_response(crop_geo_json_response, f"crop_geojson_{item_id}.png") -async def crop_geo_json_with_dimensions( - client: PlanetaryComputerProClient, collection_id, item_id, geojson -): +async def crop_geo_json_with_dimensions(client: PlanetaryComputerProClient, collection_id, item_id, geojson): """Crop an item using GeoJSON geometry with specific dimensions.""" - crop_geo_json_with_dimensions_response = ( - await client.data.crop_geo_json_with_dimensions( - collection_id=collection_id, - item_id=item_id, - format=TilerImageFormat.PNG, - width=512, - height=512, - assets=["image"], - asset_band_indices="image|1,2,3", - body=geojson, - ) - ) - await display_response( - crop_geo_json_with_dimensions_response, f"crop_geojson_dims_{item_id}.png" + crop_geo_json_with_dimensions_response = await client.data.crop_feature_geo_json_width_by_height( + collection_id=collection_id, + item_id=item_id, + format=TilerImageFormat.PNG, + width=512, + height=512, + assets=["image"], + asset_band_indices=["image|1,2,3"], + body=geojson, ) + await display_response(crop_geo_json_with_dimensions_response, f"crop_geojson_dims_{item_id}.png") -async def get_geo_json_statistics( - client: PlanetaryComputerProClient, collection_id, item_id, geojson -): +async def get_geo_json_statistics(client: PlanetaryComputerProClient, collection_id, item_id, geojson): """Get statistics for a GeoJSON area.""" - result = await client.data.get_geo_json_statistics( + result = await client.data.get_item_geo_json_statistics( collection_id=collection_id, item_id=item_id, body=geojson, assets=["image"] ) logging.info(result) @@ -156,15 +130,13 @@ async def get_geo_json_statistics( async def get_info_geo_json(client: PlanetaryComputerProClient, collection_id, item_id): """Get info for GeoJSON.""" - result = await client.data.get_info_geo_json( - collection_id=collection_id, item_id=item_id, assets=["image"] - ) + result = await client.data.get_item_info_geo_json(collection_id=collection_id, item_id=item_id, assets=["image"]) logging.info(result) async def get_part(client: PlanetaryComputerProClient, collection_id, item_id, bounds): """Get a part of an item with specific bounds.""" - get_part_response = await client.data.get_part( + get_part_response = await client.data.get_item_bbox_crop( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, @@ -175,16 +147,14 @@ async def get_part(client: PlanetaryComputerProClient, collection_id, item_id, b width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) await display_response(get_part_response, f"part_{item_id}.png") -async def get_part_with_dimensions( - client: PlanetaryComputerProClient, collection_id, item_id, bounds -): +async def get_part_with_dimensions(client: PlanetaryComputerProClient, collection_id, item_id, bounds): """Get a part of an item with specific bounds and dimensions.""" - get_part_with_dimensions_response = await client.data.get_part_with_dimensions( + get_part_with_dimensions_response = await client.data.get_item_bbox_crop_with_dimensions( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, @@ -195,69 +165,61 @@ async def get_part_with_dimensions( width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", - ) - await display_response( - get_part_with_dimensions_response, f"part_dims_{item_id}.png" + asset_band_indices=["image|1,2,3"], ) + await display_response(get_part_with_dimensions_response, f"part_dims_{item_id}.png") async def get_point(client: PlanetaryComputerProClient, collection_id, item_id, point): """Get point value at a specific location.""" - result = await client.data.get_point( + result = await client.data.get_item_point( collection_id=collection_id, item_id=item_id, assets=["image"], longitude=point[0], latitude=point[1], - no_data=0, + no_data="0", ) logging.info(f"Point values at ({point[0]}, {point[1]}): {result}") async def get_preview(client: PlanetaryComputerProClient, collection_id, item_id): """Get a preview of an item.""" - get_preview_response = await client.data.get_preview( + get_preview_response = await client.data.get_item_preview( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) await display_response(get_preview_response, f"preview_{item_id}.png") -async def get_preview_with_format( - client: PlanetaryComputerProClient, collection_id, item_id -): +async def get_preview_with_format(client: PlanetaryComputerProClient, collection_id, item_id): """Get a preview of an item with specific format.""" - get_preview_with_format_response = await client.data.get_preview_with_format( + get_preview_with_format_response = await client.data.get_item_preview_with_format( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", - ) - await display_response( - get_preview_with_format_response, f"preview_format_{item_id}.png" + asset_band_indices=["image|1,2,3"], ) + await display_response(get_preview_with_format_response, f"preview_format_{item_id}.png") async def list_statistics(client: PlanetaryComputerProClient, collection_id, item_id): """List statistics for an item.""" - result = client.data.list_statistics( - collection_id=collection_id, item_id=item_id, assets=["image"] - ) + result = client.data.list_item_statistics(collection_id=collection_id, item_id=item_id, assets=["image"]) logging.info(result) async def get_tile_json(client: PlanetaryComputerProClient, collection_id, item_id): """Get TileJSON for an item.""" - result = await client.data.get_tile_json( + result = await client.data.get_item_tile_json( collection_id=collection_id, item_id=item_id, tile_matrix_set_id="WebMercatorQuad", @@ -266,7 +228,7 @@ async def get_tile_json(client: PlanetaryComputerProClient, collection_id, item_ min_zoom=7, max_zoom=14, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) logging.info(result) @@ -283,18 +245,14 @@ async def get_tile(client: PlanetaryComputerProClient, collection_id, item_id): scale=1, format="png", assets=["image"], - asset_band_indices="image|1,2,3", - ) - await display_response( - get_tile_with_matrix_set_response, f"tile_{item_id}_z14_x4349_y6564.png" + asset_band_indices=["image|1,2,3"], ) + await display_response(get_tile_with_matrix_set_response, f"tile_{item_id}_z14_x4349_y6564.png") -async def get_wmts_capabilities( - client: PlanetaryComputerProClient, collection_id, item_id -): +async def get_wmts_capabilities(client: PlanetaryComputerProClient, collection_id, item_id): """Get WMTS capabilities and save it locally.""" - get_wmts_capabilities_response = await client.data.get_wmts_capabilities( + get_wmts_capabilities_response = await client.data.get_item_wmts_capabilities( collection_id=collection_id, item_id=item_id, tile_matrix_set_id="WebMercatorQuad", @@ -303,7 +261,7 @@ async def get_wmts_capabilities( min_zoom=7, max_zoom=14, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) # Collect the async iterator into a list xml_bytes_chunks = [] diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_05_mosaics_tiler_async.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_05_mosaics_tiler_async.py index 2cc4d7916119..aab5afe3e7fb 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_05_mosaics_tiler_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_05_mosaics_tiler_async.py @@ -27,15 +27,11 @@ StacSortExtension, StacSearchSortingDirection, TilerImageFormat, - ImageParameters, - Polygon, ) import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -57,50 +53,38 @@ async def register_mosaics_search(client: PlanetaryComputerProClient, collection ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], - ) - register_search_response = await client.data.register_mosaics_search( - register_search_request + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) + register_search_response = await client.data.register_mosaics_search(register_search_request) logging.info(register_search_response) return register_search_response async def get_mosaics_search_info(client: PlanetaryComputerProClient, search_id): """Get mosaics search info.""" - mosaics_info_search_response = await client.data.get_mosaics_search_info( - search_id=search_id - ) + mosaics_info_search_response = await client.data.get_searches_info(search_id=search_id) search = mosaics_info_search_response.search return search -async def get_mosaics_tile_json( - client: PlanetaryComputerProClient, search_id, collection_id -): +async def get_mosaics_tile_json(client: PlanetaryComputerProClient, search_id, collection_id): """Get mosaics tile JSON.""" - get_mosaics_tile_json_response = await client.data.get_mosaics_tile_json( + get_mosaics_tile_json_response = await client.data.get_searches_tile_json( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], tile_scale=1, min_zoom=9, - collection=collection_id, + collection_id=collection_id, tile_format="png", ) logging.info(get_mosaics_tile_json_response.as_dict()) -async def get_mosaics_tile( - client: PlanetaryComputerProClient, search_id, collection_id -): +async def get_mosaics_tile(client: PlanetaryComputerProClient, search_id, collection_id): """Get a mosaic tile and save it locally.""" - mosaics_tile_matrix_sets_response = await client.data.get_mosaics_tile( + mosaics_tile_matrix_sets_response = await client.data.get_searches_tile_by_scale_and_format( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", z=13, @@ -109,7 +93,7 @@ async def get_mosaics_tile( scale=1, format="png", assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], collection=collection_id, ) # Collect the async iterator into a list @@ -122,14 +106,12 @@ async def get_mosaics_tile( filename = f"mosaic_tile_{search_id}_z13_x2174_y3282.png" with open(filename, "wb") as f: f.write(mosaics_tile_matrix_sets_bytes) - logging.info( - f"Tile saved as: {filename} ({len(mosaics_tile_matrix_sets_bytes)} bytes)" - ) + logging.info(f"Tile saved as: {filename} ({len(mosaics_tile_matrix_sets_bytes)} bytes)") async def get_mosaics_wmts_capabilities(client: PlanetaryComputerProClient, search_id): """Get WMTS capabilities for mosaics and save it locally.""" - get_capabilities_xml_response = await client.data.get_mosaics_wmts_capabilities( + get_capabilities_xml_response = await client.data.get_searches_wmts_capabilities( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", tile_format=TilerImageFormat.PNG, @@ -137,7 +119,7 @@ async def get_mosaics_wmts_capabilities(client: PlanetaryComputerProClient, sear min_zoom=7, max_zoom=13, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) # Collect the async iterator into a list xml_bytes_chunks = [] @@ -156,7 +138,7 @@ async def get_mosaics_wmts_capabilities(client: PlanetaryComputerProClient, sear async def get_mosaics_assets_for_point(client: PlanetaryComputerProClient, search_id): """Get mosaic assets for a specific point (center of the bbox).""" # Using center point from the coordinate bbox: -84.43202751899601, 33.639647639722273 - get_lon_lat_assets_response = await client.data.get_mosaics_assets_for_point( + get_lon_lat_assets_response = await client.data.get_searches_point_with_assets( search_id=search_id, longitude=-84.43202751899601, latitude=33.639647639722273, @@ -170,11 +152,9 @@ async def get_mosaics_assets_for_point(client: PlanetaryComputerProClient, searc logging.info(f"Assets for point: {get_lon_lat_assets_response[0]['id']}") -async def get_mosaics_assets_for_tile( - client: PlanetaryComputerProClient, search_id, collection_id -): +async def get_mosaics_assets_for_tile(client: PlanetaryComputerProClient, search_id, collection_id): """Get mosaic assets for a specific tile.""" - result = await client.data.get_mosaics_assets_for_tile( + result = await client.data.get_searches_assets_for_tile( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", z=13, @@ -185,91 +165,6 @@ async def get_mosaics_assets_for_tile( logging.info(f"Assets for tile: {result}") -async def create_static_image(client: PlanetaryComputerProClient, collection_id): - """Create a static image from a STAC item. - - This demonstrates creating a static image tile with specific rendering parameters. - The image is created asynchronously and can be retrieved using the returned image ID. - """ - # Define CQL filter with date range - cql_filter = { - "op": "and", - "args": [ - {"op": "=", "args": [{"property": "collection"}, collection_id]}, - { - "op": "anyinteracts", - "args": [ - {"property": "datetime"}, - {"interval": ["2023-01-01T00:00:00Z", "2023-12-31T00:00:00Z"]}, - ], - }, - ], - } - - # Define geometry for the image (within dataset bounds) - geometry = Polygon( - coordinates=[ - [ - [-84.45378097481053, 33.6567321707079], - [-84.39805886744838, 33.6567321707079], - [-84.39805886744838, 33.61945681366625], - [-84.45378097481053, 33.61945681366625], - [-84.45378097481053, 33.6567321707079], - ] - ] - ) - - # Create image request with rendering parameters - image_request = ImageParameters( - cql=cql_filter, - zoom=13, - geometry=geometry, - render_parameters=f"assets=image&asset_bidx=image|1,2,3&collection={collection_id}", - columns=1080, - rows=1080, - image_size="1080x1080", - show_branding=False, - ) - - # Create static image - image_response = await client.data.create_static_image( - collection_id=collection_id, body=image_request - ) - - # Extract image ID from the response URL - image_id = image_response.url.split("?")[0].split("/")[-1] - logging.info(f"Created static image with ID: {image_id}") - logging.info(f"Image URL: {image_response.url}") - - return image_id - - -async def get_static_image(client: PlanetaryComputerProClient, collection_id, image_id): - """Retrieve a static image by its ID. - - This demonstrates fetching the actual image data from a previously created static image. - The image data is returned as an iterator of bytes. - """ - # Get static image data - image_data = await client.data.get_static_image( - collection_id=collection_id, id=image_id - ) - - # Join the generator to get bytes - # Collect the async iterator into a list - image_bytes_chunks = [] - async for chunk in image_data: - image_bytes_chunks.append(chunk) - image_bytes = b"".join(image_bytes_chunks) - - # Save the image locally - filename = f"static_image_{image_id}" - with open(filename, "wb") as f: - f.write(image_bytes) - - logging.info(f"Static image saved as: {filename} ({len(image_bytes)} bytes)") - - async def main(): endpoint = os.environ.get("PLANETARYCOMPUTER_ENDPOINT") collection_id = os.environ.get("PLANETARYCOMPUTER_COLLECTION_ID") @@ -292,10 +187,6 @@ async def main(): await get_mosaics_assets_for_point(client, search_id) await get_mosaics_assets_for_tile(client, search_id, collection_id) - # Execute static image operations - image_id = await create_static_image(client, collection_id) - await get_static_image(client, collection_id, image_id) - await client.close() await credential.close() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_06_map_legends_async.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_06_map_legends_async.py index 95d19941f5e0..cb716e754128 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_06_map_legends_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_06_map_legends_async.py @@ -25,9 +25,7 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -41,9 +39,7 @@ async def get_class_map_legend(client: "PlanetaryComputerProClient"): async def get_interval_legend(client: "PlanetaryComputerProClient"): """Get an interval legend (continuous color map).""" - result = await client.data.get_interval_legend( - classmap_name=ColorMapNames.MODIS64_A1 - ) + result = await client.data.get_interval_legend(classmap_name=ColorMapNames.MODIS64_A1) logging.info(result) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_00_stac_collection.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_00_stac_collection.py index 30214826b636..714a77265561 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_00_stac_collection.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_00_stac_collection.py @@ -48,9 +48,7 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -62,16 +60,12 @@ def create_collection(client: PlanetaryComputerProClient, collection_id): if any(c.id == collection_id for c in get_all_collections_response["collections"]): logging.info(f"Collection '{collection_id}' already exists, deleting it...") - collection_delete_operation = client.stac.begin_delete_collection( - collection_id, polling=True - ) + collection_delete_operation = client.stac.begin_delete_collection(collection_id, polling=True) collection_delete_operation.result() logging.info(f"Deleted collection '{collection_id}'") # Define collection spatial and temporal extents (Georgia state bounds) - spatial_extent = StacExtensionSpatialExtent( - bounding_box=[[-85.605165, 30.357851, -80.839729, 35.000659]] - ) + spatial_extent = StacExtensionSpatialExtent(bounding_box=[[-85.605165, 30.357851, -80.839729, 35.000659]]) temporal_extent = StacCollectionTemporalExtent( interval=[ [ @@ -149,9 +143,7 @@ def create_collection(client: PlanetaryComputerProClient, collection_id): # Create the collection logging.info(f"Creating collection '{collection_id}'...") - collection_create_operation = client.stac.begin_create_collection( - body=collection_data, polling=False - ) + collection_create_operation = client.stac.begin_create_collection(body=collection_data, polling=False) collection_create_operation.result() logging.info(f"Collection '{collection_id}' created successfully") @@ -176,9 +168,7 @@ def update_collection(client: PlanetaryComputerProClient, collection_id): # Update the collection logging.info("Updating collection...") - client.stac.create_or_replace_collection( - collection_id=collection_id, body=collection - ) + client.stac.replace_collection(collection_id=collection_id, body=collection) # Verify the update updated_collection = client.stac.get_collection(collection_id=collection_id) @@ -199,9 +189,7 @@ def manage_partition_type(client: PlanetaryComputerProClient, collection_id): logging.info("Collection is not empty, skipping partition type update") else: logging.info("Updating partition type to YEAR scheme...") - client.stac.replace_partition_type( - collection_id, body=PartitionType(scheme=PartitionTypeScheme.YEAR) - ) + client.stac.replace_partition_type(collection_id, body=PartitionType(scheme=PartitionTypeScheme.YEAR)) logging.info("Partition type updated successfully") @@ -218,20 +206,12 @@ def manage_render_options(client: PlanetaryComputerProClient, collection_id): ) # Check if render option already exists - stac_collection_mosaics_get_all_response = client.stac.list_render_options( - collection_id=collection_id - ) + stac_collection_mosaics_get_all_response = client.stac.list_render_options(collection_id=collection_id) - if any( - ro.id == render_option.id for ro in stac_collection_mosaics_get_all_response - ): + if any(ro.id == render_option.id for ro in stac_collection_mosaics_get_all_response): logging.info("Render option 'natural-color' already exists.") - client.stac.delete_render_option( - collection_id=collection_id, render_option_id=render_option.id - ) - logging.info( - "Deleted existing render option 'natural-color'. Proceeding to create a new one." - ) + client.stac.delete_render_option(collection_id=collection_id, render_option_id=render_option.id) + logging.info("Deleted existing render option 'natural-color'. Proceeding to create a new one.") # Create render option without description initially render_option = RenderOption( @@ -258,9 +238,7 @@ def manage_render_options(client: PlanetaryComputerProClient, collection_id): ) # Get the created render option - retrieved_option = client.stac.get_render_option( - collection_id=collection_id, render_option_id=render_option.id - ) + retrieved_option = client.stac.get_render_option(collection_id=collection_id, render_option_id=render_option.id) logging.info(f"Retrieved: {retrieved_option.name}") @@ -274,14 +252,10 @@ def manage_mosaics(client: PlanetaryComputerProClient, collection_id): ) # Check existing mosaics - stac_collection_mosaics_get_all_response = client.stac.list_mosaics( - collection_id=collection_id - ) + stac_collection_mosaics_get_all_response = client.stac.list_mosaics(collection_id=collection_id) if any(m.id == mosaic.id for m in stac_collection_mosaics_get_all_response): - logging.info( - f"Mosaic {mosaic.id} already exists. Deleting it before creating a new one." - ) + logging.info(f"Mosaic {mosaic.id} already exists. Deleting it before creating a new one.") client.stac.delete_mosaic(collection_id=collection_id, mosaic_id=mosaic.id) # Create Mosaic @@ -302,9 +276,7 @@ def manage_mosaics(client: PlanetaryComputerProClient, collection_id): logging.info(stac_collection_mosaics_create_or_replace_response) # Get the mosaic - retrieved_mosaic = client.stac.get_mosaic( - collection_id=collection_id, mosaic_id=mosaic.id - ) + retrieved_mosaic = client.stac.get_mosaic(collection_id=collection_id, mosaic_id=mosaic.id) logging.info(retrieved_mosaic) @@ -342,9 +314,7 @@ def get_landing_page(client: PlanetaryComputerProClient): def manage_queryables(client: PlanetaryComputerProClient, collection_id): """Create and manage queryables for a collection.""" - stac_queryables_get_all_response = client.stac.get_collection_queryables( - collection_id=collection_id - ) + stac_queryables_get_all_response = client.stac.get_collection_queryables(collection_id=collection_id) queryable = StacQueryable( name="eo:cloud_cover", @@ -355,13 +325,8 @@ def manage_queryables(client: PlanetaryComputerProClient, collection_id): }, ) - if any( - q == queryable.name - for q in stac_queryables_get_all_response["properties"].keys() - ): - client.stac.delete_queryable( - collection_id=collection_id, queryable_name=queryable.name - ) + if any(q == queryable.name for q in stac_queryables_get_all_response["properties"].keys()): + client.stac.delete_queryable(collection_id=collection_id, queryable_name=queryable.name) logging.info(f"Deleted existing '{queryable.name}' queryable.") stac_queryables_create_response = client.stac.create_queryables( @@ -410,17 +375,13 @@ def manage_collection_assets(client: PlanetaryComputerProClient, collection_id): thumbnail_tuple = ("thumbnail.png", thumbnail_bytes) try: - client.stac.delete_collection_asset( - collection_id=collection_id, asset_id="thumbnail" - ) + client.stac.delete_collection_asset(collection_id=collection_id, asset_id="thumbnail") logging.info("Deleted existing thumbnail asset.") except Exception: logging.info("No existing thumbnail asset to delete.") # Create Collection Asset - client.stac.create_collection_asset( - collection_id=collection_id, body={"data": data, "file": thumbnail_tuple} - ) + client.stac.create_collection_asset(collection_id=collection_id, body={"data": data, "file": thumbnail_tuple}) # Create or replace Collection Asset thumbnail_bytes.seek(0) # Reset BytesIO position @@ -439,9 +400,7 @@ def manage_collection_assets(client: PlanetaryComputerProClient, collection_id): ) # Get the thumbnail as bytes - thumbnail_response = client.stac.get_collection_thumbnail( - collection_id=collection_id - ) + thumbnail_response = client.stac.get_collection_thumbnail(collection_id=collection_id) # Convert the generator to bytes thumbnail_bytes_result = b"".join(thumbnail_response) @@ -459,9 +418,7 @@ def main(): # Create client credential = DefaultAzureCredential() - client = PlanetaryComputerProClient( - endpoint=endpoint, credential=credential, logging_enable=True - ) + client = PlanetaryComputerProClient(endpoint=endpoint, credential=credential, logging_enable=True) logging.info(f"Connected to: {endpoint}") logging.info(f"Collection ID: {collection_id}\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_01_ingestion_management.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_01_ingestion_management.py index f207d51dce88..6403b1bc83e4 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_01_ingestion_management.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_01_ingestion_management.py @@ -129,7 +129,9 @@ def create_or_replace_source( logging.info(f"First call result: {first_result.id}") # Second call - replaces again with modified token (demonstrates update capability) - updated_token = "sp=rl&st=2024-01-01T00:00:00Z&se=2024-12-31T23:59:59Z&sv=2023-01-03&sr=c&sig=UpdatedRandomSignature123456" + updated_token = ( + "sp=rl&st=2024-01-01T00:00:00Z&se=2024-12-31T23:59:59Z&sv=2023-01-03&sr=c&sig=UpdatedRandomSignature123456" + ) updated_connection_info = SharedAccessSignatureTokenConnection( container_uri=sas_container_uri, shared_access_signature_token=updated_token @@ -317,7 +319,8 @@ def manage_operations(client: PlanetaryComputerProClient): logging.info(f"Failed to cancel operation {operation.id}: {e.message}") pass - # Cancel all operations + # Cancel all operations across the entire GeoCatalog instance. + # WARNING: This cancels ALL pending/running operations, not just those for a specific collection. try: client.ingestion.cancel_all_operations() except HttpResponseError as e: diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_02_stac_specification.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_02_stac_specification.py index a0cfb9f890f5..650f165ea273 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_02_stac_specification.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_02_stac_specification.py @@ -47,9 +47,7 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -68,11 +66,7 @@ def search_collections(client: PlanetaryComputerProClient): # Show first few collections for collection in collections.collections[:3]: if collection.description: - desc = ( - collection.description[:100] + "..." - if len(collection.description) > 100 - else collection.description - ) + desc = collection.description[:100] + "..." if len(collection.description) > 100 else collection.description logging.info(f" - {collection.id}: {desc}") @@ -102,11 +96,7 @@ def search_items(client: PlanetaryComputerProClient, collection_id): ], }, date_time="2021-01-01T00:00:00Z/2022-12-31T00:00:00Z", - sort_by=[ - StacSortExtension( - field="datetime", direction=StacSearchSortingDirection.DESC - ) - ], + sort_by=[StacSortExtension(field="datetime", direction=StacSearchSortingDirection.DESC)], limit=50, ) @@ -231,19 +221,13 @@ def get_sample_stac_item(collection_id: str, item_id: str) -> StacItem: def create_stac_item(client: PlanetaryComputerProClient, collection_id, item_id): """Create a STAC item.""" stac_item = get_sample_stac_item(collection_id, item_id) - stac_item_get_items_response = client.stac.get_item_collection( - collection_id=collection_id - ) + stac_item_get_items_response = client.stac.get_item_collection(collection_id=collection_id) for item in stac_item_get_items_response.features: logging.error(item.id) if any(item.id == stac_item.id for item in stac_item_get_items_response.features): - logging.info( - f"Item {stac_item.id} already exists. Deleting it before creating a new one." - ) - client.stac.begin_delete_item( - collection_id=collection_id, item_id=stac_item.id, polling=True - ).result() + logging.info(f"Item {stac_item.id} already exists. Deleting it before creating a new one.") + client.stac.begin_delete_item(collection_id=collection_id, item_id=stac_item.id, polling=True).result() logging.info(f"Deleted item {stac_item.id}. Proceeding to create a new one.") else: logging.info(f"Item {stac_item.id} does not exist. Proceeding to create it.") @@ -271,28 +255,22 @@ def update_stac_item(client: PlanetaryComputerProClient, collection_id, item_id) ) stac_item_create_or_update_response.result() - logging.info( - f"Updated item {stac_item.id}, platform: {stac_item.properties['platform']}" - ) + logging.info(f"Updated item {stac_item.id}, platform: {stac_item.properties['platform']}") -def create_or_replace_stac_item( - client: PlanetaryComputerProClient, collection_id, item_id -): +def create_or_replace_stac_item(client: PlanetaryComputerProClient, collection_id, item_id): """Create or replace a STAC item (idempotent operation). - This demonstrates using begin_create_or_replace_item which is idempotent: + This demonstrates using begin_replace_item: - First ensures item exists by creating it with begin_create_item - - Then demonstrates replace using begin_create_or_replace_item + - Then demonstrates replace using begin_replace_item - Multiple calls with the same data produce the same result """ # First, create the item using begin_create_item stac_item = get_sample_stac_item(collection_id, item_id) try: - create_poller = client.stac.begin_create_item( - collection_id=collection_id, body=stac_item, polling=True - ) + create_poller = client.stac.begin_create_item(collection_id=collection_id, body=stac_item, polling=True) create_poller.result() logging.info(f"Created item {item_id}") except ResourceExistsError: @@ -306,7 +284,7 @@ def create_or_replace_stac_item( stac_item.properties["platform"] = "Imagery Updated" stac_item.properties["processing_level"] = "L2" - replace_poller = client.stac.begin_create_or_replace_item( + replace_poller = client.stac.begin_replace_item( collection_id=collection_id, item_id=item_id, body=stac_item, polling=True ) replace_poller.result() @@ -314,9 +292,7 @@ def create_or_replace_stac_item( # Verify replacement replaced_item = client.stac.get_item(collection_id=collection_id, item_id=item_id) - logging.info( - f"Verified replaced item, platform: {replaced_item.properties.get('platform', 'N/A')}" - ) + logging.info(f"Verified replaced item, platform: {replaced_item.properties.get('platform', 'N/A')}") def delete_stac_item(client: PlanetaryComputerProClient, collection_id, item_id): @@ -327,24 +303,18 @@ def delete_stac_item(client: PlanetaryComputerProClient, collection_id, item_id) """ try: # Check if item exists before attempting deletion - existing_item = client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + existing_item = client.stac.get_item(collection_id=collection_id, item_id=item_id) logging.info(f"Found item {existing_item.id} to delete") # Delete the item using begin_delete_item - delete_poller = client.stac.begin_delete_item( - collection_id=collection_id, item_id=item_id, polling=True - ) + delete_poller = client.stac.begin_delete_item(collection_id=collection_id, item_id=item_id, polling=True) delete_poller.result() logging.info(f"Successfully deleted item {item_id}") # Verify deletion by attempting to retrieve the item try: client.stac.get_item(collection_id=collection_id, item_id=item_id) - logging.warning( - f"Item {item_id} still exists after deletion (may take time to propagate)" - ) + logging.warning(f"Item {item_id} still exists after deletion (may take time to propagate)") except ResourceNotFoundError: logging.info(f"Verified item {item_id} was successfully deleted") @@ -380,11 +350,7 @@ def query_items(client: PlanetaryComputerProClient, collection_id): # Sorted query sorted_options = StacSearchParameters( collections=[collection_id], - sort_by=[ - StacSortExtension( - field="eo:cloud_cover", direction=StacSearchSortingDirection.ASC - ) - ], + sort_by=[StacSortExtension(field="eo:cloud_cover", direction=StacSearchSortingDirection.ASC)], limit=3, ) @@ -403,9 +369,7 @@ def get_queryables(client: PlanetaryComputerProClient, collection_id): if properties: for prop_name in list(properties.keys())[:10]: # Show first 10 - logging.info( - f" - {prop_name}: {properties[prop_name].get('description', '')}" - ) + logging.info(f" - {prop_name}: {properties[prop_name].get('description', '')}") def main(): @@ -419,9 +383,7 @@ def main(): # Create client credential = DefaultAzureCredential() - client = PlanetaryComputerProClient( - endpoint=endpoint, credential=credential, logging_enable=False - ) + client = PlanetaryComputerProClient(endpoint=endpoint, credential=credential, logging_enable=False) # Execute STAC specification operations get_landing_page(client) @@ -434,9 +396,7 @@ def main(): create_stac_item(client, collection_id, item_id) update_stac_item(client, collection_id, item_id) create_or_replace_stac_item(client, collection_id, f"{item_id}_replace_demo") - delete_stac_item( - client, collection_id, f"{item_id}_replace_demo" - ) # Clean up the item created above + delete_stac_item(client, collection_id, f"{item_id}_replace_demo") # Clean up the item created above get_collection(client, collection_id) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_03_shared_access_signature.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_03_shared_access_signature.py index 701b7be5f029..68a146aa5056 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_03_shared_access_signature.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_03_shared_access_signature.py @@ -35,7 +35,7 @@ def generate_sas_token(client: PlanetaryComputerProClient, collection_id: str): """Generate a SAS token for a collection.""" - get_token_response = client.shared_access_signature.get_token(collection_id=collection_id, duration_in_minutes=60) + get_token_response = client.sas.get_token(collection_id=collection_id, duration_in_minutes=60) return get_token_response @@ -54,7 +54,7 @@ def sign_asset_href(client: PlanetaryComputerProClient, collection_id: str): else: raise Exception("No thumbnail found in collection assets.") - get_sign_response = client.shared_access_signature.get_sign(href=href, duration_in_minutes=60) + get_sign_response = client.sas.get_sign(href=href, duration_in_minutes=60) return get_sign_response.href, href # Return both signed and unsigned hrefs @@ -80,7 +80,7 @@ def download_asset(signed_href: str): def revoke_token(client: PlanetaryComputerProClient): """Revoke the current SAS token.""" - revoke_token_response = client.shared_access_signature.revoke_token() + revoke_token_response = client.sas.revoke_token() return revoke_token_response diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_04_stac_item_tiler.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_04_stac_item_tiler.py index c224d90aac58..108146f4d9a4 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_04_stac_item_tiler.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_04_stac_item_tiler.py @@ -31,9 +31,7 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -47,9 +45,7 @@ def display_response(response, filename): def get_tile_matrix_definitions(client: PlanetaryComputerProClient): """Get tile matrix definitions for WebMercatorQuad.""" - result = client.data.get_tile_matrix_definitions( - tile_matrix_set_id="WebMercatorQuad" - ) + result = client.data.get_tile_matrix_definitions(tile_matrix_set_id="WebMercatorQuad") logging.info(result) @@ -61,17 +57,13 @@ def list_tile_matrices(client: PlanetaryComputerProClient): def get_asset_statistics(client: PlanetaryComputerProClient, collection_id, item_id): """Get asset statistics for an item.""" - result = client.data.get_asset_statistics( - collection_id=collection_id, item_id=item_id, assets=["image"] - ) + result = client.data.get_item_asset_statistics(collection_id=collection_id, item_id=item_id, assets=["image"]) logging.info(result) def list_available_assets(client: PlanetaryComputerProClient, collection_id, item_id): """List available assets for an item.""" - result = client.data.list_available_assets( - collection_id=collection_id, item_id=item_id - ) + result = client.data.list_item_available_assets(collection_id=collection_id, item_id=item_id) logging.info(result) @@ -83,57 +75,49 @@ def get_item_asset_details(client: PlanetaryComputerProClient, collection_id, it """ # Get info for specific assets - result_specific = client.data.get_item_asset_details( - collection_id=collection_id, item_id=item_id, assets=["image"] - ) + result_specific = client.data.get_item_info(collection_id=collection_id, item_id=item_id, assets=["image"]) logging.info("Assets info (image asset only):") logging.info(f" Dataset: {result_specific}") def get_bounds(client: PlanetaryComputerProClient, collection_id, item_id): """List bounds for an item.""" - result = client.data.get_bounds(collection_id=collection_id, item_id=item_id) + result = client.data.get_item_bounds(collection_id=collection_id, item_id=item_id) logging.info(result) def crop_geo_json(client: PlanetaryComputerProClient, collection_id, item_id, geojson): """Crop an item using GeoJSON geometry.""" - crop_geo_json_response = client.data.crop_geo_json( + crop_geo_json_response = client.data.crop_feature_geo_json( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], body=geojson, ) logging.info("Cropping with GeoJSON completed") display_response(crop_geo_json_response, f"crop_geojson_{item_id}.png") -def crop_geo_json_with_dimensions( - client: PlanetaryComputerProClient, collection_id, item_id, geojson -): +def crop_geo_json_with_dimensions(client: PlanetaryComputerProClient, collection_id, item_id, geojson): """Crop an item using GeoJSON geometry with specific dimensions.""" - crop_geo_json_with_dimensions_response = client.data.crop_geo_json_with_dimensions( + crop_geo_json_with_dimensions_response = client.data.crop_feature_geo_json_width_by_height( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], body=geojson, ) - display_response( - crop_geo_json_with_dimensions_response, f"crop_geojson_dims_{item_id}.png" - ) + display_response(crop_geo_json_with_dimensions_response, f"crop_geojson_dims_{item_id}.png") -def get_geo_json_statistics( - client: PlanetaryComputerProClient, collection_id, item_id, geojson -): +def get_geo_json_statistics(client: PlanetaryComputerProClient, collection_id, item_id, geojson): """Get statistics for a GeoJSON area.""" - result = client.data.get_geo_json_statistics( + result = client.data.get_item_geo_json_statistics( collection_id=collection_id, item_id=item_id, body=geojson, assets=["image"] ) logging.info(result) @@ -141,15 +125,13 @@ def get_geo_json_statistics( def get_info_geo_json(client: PlanetaryComputerProClient, collection_id, item_id): """Get info for GeoJSON.""" - result = client.data.get_info_geo_json( - collection_id=collection_id, item_id=item_id, assets=["image"] - ) + result = client.data.get_item_info_geo_json(collection_id=collection_id, item_id=item_id, assets=["image"]) logging.info(result) def get_part(client: PlanetaryComputerProClient, collection_id, item_id, bounds): """Get a part of an item with specific bounds.""" - get_part_response = client.data.get_part( + get_part_response = client.data.get_item_bbox_crop( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, @@ -160,16 +142,14 @@ def get_part(client: PlanetaryComputerProClient, collection_id, item_id, bounds) width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) display_response(get_part_response, f"part_{item_id}.png") -def get_part_with_dimensions( - client: PlanetaryComputerProClient, collection_id, item_id, bounds -): +def get_part_with_dimensions(client: PlanetaryComputerProClient, collection_id, item_id, bounds): """Get a part of an item with specific bounds and dimensions.""" - get_part_with_dimensions_response = client.data.get_part_with_dimensions( + get_part_with_dimensions_response = client.data.get_item_bbox_crop_with_dimensions( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, @@ -180,63 +160,61 @@ def get_part_with_dimensions( width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) display_response(get_part_with_dimensions_response, f"part_dims_{item_id}.png") def get_point(client: PlanetaryComputerProClient, collection_id, item_id, point): """Get point value at a specific location.""" - result = client.data.get_point( + result = client.data.get_item_point( collection_id=collection_id, item_id=item_id, assets=["image"], longitude=point[0], latitude=point[1], - no_data=0, + no_data="0", ) logging.info(f"Point values at ({point[0]}, {point[1]}): {result}") def get_preview(client: PlanetaryComputerProClient, collection_id, item_id): """Get a preview of an item.""" - get_preview_response = client.data.get_preview( + get_preview_response = client.data.get_item_preview( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) display_response(get_preview_response, f"preview_{item_id}.png") def get_preview_with_format(client: PlanetaryComputerProClient, collection_id, item_id): """Get a preview of an item with specific format.""" - get_preview_with_format_response = client.data.get_preview_with_format( + get_preview_with_format_response = client.data.get_item_preview_with_format( collection_id=collection_id, item_id=item_id, format=TilerImageFormat.PNG, width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) display_response(get_preview_with_format_response, f"preview_format_{item_id}.png") def list_statistics(client: PlanetaryComputerProClient, collection_id, item_id): """List statistics for an item.""" - result = client.data.list_statistics( - collection_id=collection_id, item_id=item_id, assets=["image"] - ) + result = client.data.list_item_statistics(collection_id=collection_id, item_id=item_id, assets=["image"]) logging.info(result) def get_tile_json(client: PlanetaryComputerProClient, collection_id, item_id): """Get TileJSON for an item.""" - result = client.data.get_tile_json( + result = client.data.get_item_tile_json( collection_id=collection_id, item_id=item_id, tile_matrix_set_id="WebMercatorQuad", @@ -245,7 +223,7 @@ def get_tile_json(client: PlanetaryComputerProClient, collection_id, item_id): min_zoom=7, max_zoom=14, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) logging.info(result) @@ -262,16 +240,14 @@ def get_tile(client: PlanetaryComputerProClient, collection_id, item_id): scale=1, format="png", assets=["image"], - asset_band_indices="image|1,2,3", - ) - display_response( - get_tile_with_matrix_set_response, f"tile_{item_id}_z14_x4349_y6564.png" + asset_band_indices=["image|1,2,3"], ) + display_response(get_tile_with_matrix_set_response, f"tile_{item_id}_z14_x4349_y6564.png") def get_wmts_capabilities(client: PlanetaryComputerProClient, collection_id, item_id): """Get WMTS capabilities and save it locally.""" - get_wmts_capabilities_response = client.data.get_wmts_capabilities( + get_wmts_capabilities_response = client.data.get_item_wmts_capabilities( collection_id=collection_id, item_id=item_id, tile_matrix_set_id="WebMercatorQuad", @@ -280,7 +256,7 @@ def get_wmts_capabilities(client: PlanetaryComputerProClient, collection_id, ite min_zoom=7, max_zoom=14, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) xml_bytes = b"".join(get_wmts_capabilities_response) xml_string = xml_bytes.decode("utf-8") @@ -300,9 +276,7 @@ def main(): collection_id = os.environ.get("PLANETARYCOMPUTER_COLLECTION_ID") item_id = "ga_m_3308421_se_16_060_20211114" - client = PlanetaryComputerProClient( - endpoint=endpoint, credential=DefaultAzureCredential() - ) + client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) # Define geometry for operations geometry = Polygon( diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_05_mosaics_tiler.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_05_mosaics_tiler.py index 1f615ff2314a..3d6325482a61 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_05_mosaics_tiler.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_05_mosaics_tiler.py @@ -26,15 +26,11 @@ StacSortExtension, StacSearchSortingDirection, TilerImageFormat, - ImageParameters, - Polygon, ) import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -56,38 +52,30 @@ def register_mosaics_search(client: PlanetaryComputerProClient, collection_id): ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], - ) - register_search_response = client.data.register_mosaics_search( - register_search_request + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) + register_search_response = client.data.register_mosaics_search(register_search_request) logging.info(register_search_response) return register_search_response def get_mosaics_search_info(client: PlanetaryComputerProClient, search_id): """Get mosaics search info.""" - mosaics_info_search_response = client.data.get_mosaics_search_info( - search_id=search_id - ) + mosaics_info_search_response = client.data.get_searches_info(search_id=search_id) search = mosaics_info_search_response.search return search def get_mosaics_tile_json(client: PlanetaryComputerProClient, search_id, collection_id): """Get mosaics tile JSON.""" - get_mosaics_tile_json_response = client.data.get_mosaics_tile_json( + get_mosaics_tile_json_response = client.data.get_searches_tile_json( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], tile_scale=1, min_zoom=9, - collection=collection_id, + collection_id=collection_id, tile_format="png", ) logging.info(get_mosaics_tile_json_response.as_dict()) @@ -95,7 +83,7 @@ def get_mosaics_tile_json(client: PlanetaryComputerProClient, search_id, collect def get_mosaics_tile(client: PlanetaryComputerProClient, search_id, collection_id): """Get a mosaic tile and save it locally.""" - mosaics_tile_matrix_sets_response = client.data.get_mosaics_tile( + mosaics_tile_matrix_sets_response = client.data.get_searches_tile_by_scale_and_format( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", z=13, @@ -104,7 +92,7 @@ def get_mosaics_tile(client: PlanetaryComputerProClient, search_id, collection_i scale=1, format="png", assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], collection=collection_id, ) mosaics_tile_matrix_sets_bytes = b"".join(mosaics_tile_matrix_sets_response) @@ -113,14 +101,12 @@ def get_mosaics_tile(client: PlanetaryComputerProClient, search_id, collection_i filename = f"mosaic_tile_{search_id}_z13_x2174_y3282.png" with open(filename, "wb") as f: f.write(mosaics_tile_matrix_sets_bytes) - logging.info( - f"Tile saved as: {filename} ({len(mosaics_tile_matrix_sets_bytes)} bytes)" - ) + logging.info(f"Tile saved as: {filename} ({len(mosaics_tile_matrix_sets_bytes)} bytes)") def get_mosaics_wmts_capabilities(client: PlanetaryComputerProClient, search_id): """Get WMTS capabilities for mosaics and save it locally.""" - get_capabilities_xml_response = client.data.get_mosaics_wmts_capabilities( + get_capabilities_xml_response = client.data.get_searches_wmts_capabilities( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", tile_format=TilerImageFormat.PNG, @@ -128,7 +114,7 @@ def get_mosaics_wmts_capabilities(client: PlanetaryComputerProClient, search_id) min_zoom=7, max_zoom=13, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) xml_bytes = b"".join(get_capabilities_xml_response) xml_string = xml_bytes.decode("utf-8") @@ -143,7 +129,7 @@ def get_mosaics_wmts_capabilities(client: PlanetaryComputerProClient, search_id) def get_mosaics_assets_for_point(client: PlanetaryComputerProClient, search_id): """Get mosaic assets for a specific point (center of the bbox).""" # Using center point from the coordinate bbox: -84.43202751899601, 33.639647639722273 - get_lon_lat_assets_response = client.data.get_mosaics_assets_for_point( + get_lon_lat_assets_response = client.data.get_searches_point_with_assets( search_id=search_id, longitude=-84.43202751899601, latitude=33.639647639722273, @@ -157,11 +143,9 @@ def get_mosaics_assets_for_point(client: PlanetaryComputerProClient, search_id): logging.info(f"Assets for point: {get_lon_lat_assets_response[0]['id']}") -def get_mosaics_assets_for_tile( - client: PlanetaryComputerProClient, search_id, collection_id -): +def get_mosaics_assets_for_tile(client: PlanetaryComputerProClient, search_id, collection_id): """Get mosaic assets for a specific tile.""" - result = client.data.get_mosaics_assets_for_tile( + result = client.data.get_searches_assets_for_tile( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", z=13, @@ -172,85 +156,6 @@ def get_mosaics_assets_for_tile( logging.info(f"Assets for tile: {result}") -def create_static_image(client: PlanetaryComputerProClient, collection_id): - """Create a static image from a STAC item. - - This demonstrates creating a static image tile with specific rendering parameters. - The image is created asynchronously and can be retrieved using the returned image ID. - """ - # Define CQL filter with date range - cql_filter = { - "op": "and", - "args": [ - {"op": "=", "args": [{"property": "collection"}, collection_id]}, - { - "op": "anyinteracts", - "args": [ - {"property": "datetime"}, - {"interval": ["2023-01-01T00:00:00Z", "2023-12-31T00:00:00Z"]}, - ], - }, - ], - } - - # Define geometry for the image (within dataset bounds) - geometry = Polygon( - coordinates=[ - [ - [-84.45378097481053, 33.6567321707079], - [-84.39805886744838, 33.6567321707079], - [-84.39805886744838, 33.61945681366625], - [-84.45378097481053, 33.61945681366625], - [-84.45378097481053, 33.6567321707079], - ] - ] - ) - - # Create image request with rendering parameters - image_request = ImageParameters( - cql=cql_filter, - zoom=13, - geometry=geometry, - render_parameters=f"assets=image&asset_bidx=image|1,2,3&collection={collection_id}", - columns=1080, - rows=1080, - image_size="1080x1080", - show_branding=False, - ) - - # Create static image - image_response = client.data.create_static_image( - collection_id=collection_id, body=image_request - ) - - # Extract image ID from the response URL - image_id = image_response.url.split("?")[0].split("/")[-1] - logging.info(f"Created static image with ID: {image_id}") - logging.info(f"Image URL: {image_response.url}") - - return image_id - - -def get_static_image(client: PlanetaryComputerProClient, collection_id, image_id): - """Retrieve a static image by its ID. - - This demonstrates fetching the actual image data from a previously created static image. - The image data is returned as an iterator of bytes. - """ - # Get static image data - image_data = client.data.get_static_image(collection_id=collection_id, id=image_id) - - # Join the generator to get bytes - image_bytes = b"".join(image_data) - - # Save the image locally - filename = f"static_image_{image_id}" - with open(filename, "wb") as f: - f.write(image_bytes) - - logging.info(f"Static image saved as: {filename} ({len(image_bytes)} bytes)") - - def main(): endpoint = os.environ.get("PLANETARYCOMPUTER_ENDPOINT") collection_id = os.environ.get("PLANETARYCOMPUTER_COLLECTION_ID") @@ -258,9 +163,7 @@ def main(): assert endpoint is not None assert collection_id is not None - client = PlanetaryComputerProClient( - endpoint=endpoint, credential=DefaultAzureCredential() - ) + client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) # Execute mosaic tiler operations register_search_response = register_mosaics_search(client, collection_id) @@ -273,10 +176,6 @@ def main(): get_mosaics_assets_for_point(client, search_id) get_mosaics_assets_for_tile(client, search_id, collection_id) - # Execute static image operations - image_id = create_static_image(client, collection_id) - get_static_image(client, collection_id, image_id) - if __name__ == "__main__": main() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_06_map_legends.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_06_map_legends.py index 484ea7b65915..c2ede393ceb1 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_06_map_legends.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_06_map_legends.py @@ -24,9 +24,7 @@ import logging # Enable HTTP request/response logging -logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel( - logging.ERROR -) +logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(logging.ERROR) logging.basicConfig(level=logging.INFO) @@ -63,9 +61,7 @@ def main(): if not endpoint: raise ValueError("PLANETARYCOMPUTER_ENDPOINT environment variable must be set") - client = PlanetaryComputerProClient( - endpoint=endpoint, credential=DefaultAzureCredential() - ) + client = PlanetaryComputerProClient(endpoint=endpoint, credential=DefaultAzureCredential()) get_class_map_legend(client) get_interval_legend(client) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/conftest.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/conftest.py index 42570444fe5d..bf1121f49eec 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/conftest.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/conftest.py @@ -42,12 +42,8 @@ def add_sanitizers(test_proxy): planetarycomputer_subscription_id = os.environ.get( "PLANETARYCOMPUTER_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" ) - planetarycomputer_tenant_id = os.environ.get( - "PLANETARYCOMPUTER_TENANT_ID", "00000000-0000-0000-0000-000000000000" - ) - planetarycomputer_client_id = os.environ.get( - "PLANETARYCOMPUTER_CLIENT_ID", "00000000-0000-0000-0000-000000000000" - ) + planetarycomputer_tenant_id = os.environ.get("PLANETARYCOMPUTER_TENANT_ID", "00000000-0000-0000-0000-000000000000") + planetarycomputer_client_id = os.environ.get("PLANETARYCOMPUTER_CLIENT_ID", "00000000-0000-0000-0000-000000000000") planetarycomputer_client_secret = os.environ.get( "PLANETARYCOMPUTER_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" ) @@ -55,12 +51,8 @@ def add_sanitizers(test_proxy): regex=planetarycomputer_subscription_id, value="00000000-0000-0000-0000-000000000000", ) - add_general_regex_sanitizer( - regex=planetarycomputer_tenant_id, value="00000000-0000-0000-0000-000000000000" - ) - add_general_regex_sanitizer( - regex=planetarycomputer_client_id, value="00000000-0000-0000-0000-000000000000" - ) + add_general_regex_sanitizer(regex=planetarycomputer_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=planetarycomputer_client_id, value="00000000-0000-0000-0000-000000000000") add_general_regex_sanitizer( regex=planetarycomputer_client_secret, value="00000000-0000-0000-0000-000000000000", @@ -71,9 +63,7 @@ def add_sanitizers(test_proxy): add_body_key_sanitizer(json_path="$..access_token", value="access_token") # Sanitize request tracking headers - add_header_regex_sanitizer( - key="X-Request-ID", value="00000000000000000000000000000000" - ) + add_header_regex_sanitizer(key="X-Request-ID", value="00000000000000000000000000000000") add_header_regex_sanitizer(key="Date", value="Mon, 01 Jan 2024 00:00:00 GMT") add_header_regex_sanitizer(key="Server-Timing", value="total;dur=0.0") add_header_regex_sanitizer( @@ -82,9 +72,7 @@ def add_sanitizers(test_proxy): ) # Note: Removed Content-Length sanitizer as it was causing matching issues with DELETE requests # add_header_regex_sanitizer(key="Content-Length", value="100000") - add_header_regex_sanitizer( - key="mise-correlation-id", value="00000000-0000-0000-0000-000000000000" - ) + add_header_regex_sanitizer(key="mise-correlation-id", value="00000000-0000-0000-0000-000000000000") # Sanitize the endpoint hostname to match the test proxy's format from devtools_testutils import add_uri_regex_sanitizer, add_general_string_sanitizer @@ -94,13 +82,12 @@ def add_sanitizers(test_proxy): fake_endpoint = "https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com" # Replace any real geocatalog hostname with our standardized fake value + # Covers both .azure.com and .azure-test.net (PPE) domains add_uri_regex_sanitizer( - regex=r"https?://[a-zA-Z0-9\-\.]+\.geocatalog\.[a-zA-Z0-9\-\.]+\.azure\.com", + regex=r"https?://[a-zA-Z0-9\-\.]+\.geocatalog\.[a-zA-Z0-9\-\.]+\.azure(?:-test)?\.(?:com|net)", value=fake_endpoint, ) - add_uri_regex_sanitizer( - regex=r"https?://[a-zA-Z0-9\-\.]+\.geocatalog\.azure\.com", value=fake_endpoint - ) + add_uri_regex_sanitizer(regex=r"https?://[a-zA-Z0-9\-\.]+\.geocatalog\.azure\.com", value=fake_endpoint) # In live mode, also add a string sanitizer for the real endpoint value # This ensures that the EnvironmentVariableLoader's auto-sanitizer uses our fake value @@ -137,9 +124,7 @@ def add_sanitizers(test_proxy): ]: real_container_url = os.environ.get(env_var, "") if real_container_url: - add_general_string_sanitizer( - target=real_container_url, value=fake_container_url - ) + add_general_string_sanitizer(target=real_container_url, value=fake_container_url) # Sanitize storage account URLs WITH URL-encoded protocol prefix (e.g., in query parameters) # Matches: https%3A%2F%2Fcontosdatasa.blob.core.windows.net → https%3A%2F%2FSANITIZED.blob.core.windows.net @@ -256,17 +241,13 @@ def add_sanitizers(test_proxy): # Pattern: naip-atl-bde3e846 -> naip-atl-00000000 # The service appends a random 8-character hex hash to collection IDs at runtime # The env var may be "naip-atl" but the service will return "naip-atl-bde3e846" - planetarycomputer_collection_id = os.environ.get( - "PLANETARYCOMPUTER_COLLECTION_ID", "naip-atl" - ) + planetarycomputer_collection_id = os.environ.get("PLANETARYCOMPUTER_COLLECTION_ID", "naip-atl") # ALWAYS sanitize any collection ID with hash suffix pattern # We use the base collection name from env var (which may or may not already have a hash) import re - collection_base_match = re.match( - r"^(.+)-[a-f0-9]{8}$", planetarycomputer_collection_id - ) + collection_base_match = re.match(r"^(.+)-[a-f0-9]{8}$", planetarycomputer_collection_id) if collection_base_match: # Env var already has hash: use the base part collection_base = collection_base_match.group(1) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection.py index a3f89ed363e5..f587c4d02618 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection.py @@ -15,6 +15,7 @@ from pathlib import Path from devtools_testutils import recorded_by_proxy, is_live from testpreparer import PlanetaryComputerProClientTestBase, PlanetaryComputerPreparer +from azure.core.exceptions import ResourceNotFoundError from azure.planetarycomputer.models import ( PartitionTypeScheme, ) @@ -63,14 +64,10 @@ def test_01_list_collections(self, planetarycomputer_endpoint): # Validate response structure assert response is not None, "Response should not be None" - assert hasattr( - response, "collections" - ), "Response should have 'collections' attribute" + assert hasattr(response, "collections"), "Response should have 'collections' attribute" collections = response.collections - assert isinstance( - collections, list - ), f"Collections should be a list, got {type(collections)}" + assert isinstance(collections, list), f"Collections should be a list, got {type(collections)}" test_logger.info(f"Number of collections: {len(collections)}") @@ -108,14 +105,10 @@ def test_02_get_conformance_class(self, planetarycomputer_endpoint): # Validate response structure assert response is not None, "Response should not be None" - assert hasattr( - response, "conforms_to" - ), "Response should have 'conforms_to' attribute" + assert hasattr(response, "conforms_to"), "Response should have 'conforms_to' attribute" conforms_to = response.conforms_to - assert isinstance( - conforms_to, list - ), f"conformsTo should be a list, got {type(conforms_to)}" + assert isinstance(conforms_to, list), f"conformsTo should be a list, got {type(conforms_to)}" assert len(conforms_to) > 0, "Should have at least one conformance class" test_logger.info(f"Number of conformance classes: {len(conforms_to)}") @@ -126,9 +119,7 @@ def test_02_get_conformance_class(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy - def test_03_get_collection( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_03_get_collection(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting a specific STAC collection. @@ -144,12 +135,8 @@ def test_03_get_collection( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_collection(collection_id='{planetarycomputer_collection_id}')" - ) - response = client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_collection(collection_id='{planetarycomputer_collection_id}')") + response = client.stac.get_collection(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Collection ID: {response.id}") @@ -158,12 +145,8 @@ def test_03_get_collection( # Validate response structure assert response is not None, "Response should not be None" - assert ( - response.id == planetarycomputer_collection_id - ), "Collection ID should match requested ID" - assert ( - response.title is not None and len(response.title) > 0 - ), "Collection should have a title" + assert response.id == planetarycomputer_collection_id, "Collection ID should match requested ID" + assert response.title is not None and len(response.title) > 0, "Collection should have a title" assert response.description is not None, "Collection should have a description" assert response.extent is not None, "Collection should have extent" assert response.license is not None, "Collection should have license" @@ -172,9 +155,7 @@ def test_03_get_collection( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_04_get_partition_type( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_04_get_partition_type(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting partition type for a collection. @@ -190,9 +171,7 @@ def test_04_get_partition_type( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_partition_type(collection_id='{planetarycomputer_collection_id}')" - ) + test_logger.info(f"Calling: get_partition_type(collection_id='{planetarycomputer_collection_id}')") response = client.stac.get_partition_type(planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") @@ -205,17 +184,13 @@ def test_04_get_partition_type( # Validate scheme is a valid PartitionTypeScheme valid_schemes = [s.value for s in PartitionTypeScheme] - assert ( - response.scheme in valid_schemes - ), f"Partition scheme should be one of {valid_schemes}" + assert response.scheme in valid_schemes, f"Partition scheme should be one of {valid_schemes}" test_logger.info("Test PASSED\n") @PlanetaryComputerPreparer() @recorded_by_proxy - def test_05_list_render_options( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_05_list_render_options(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test listing render options for a collection. @@ -231,20 +206,14 @@ def test_05_list_render_options( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: list_render_options(collection_id='{planetarycomputer_collection_id}')" - ) - response = client.stac.list_render_options( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: list_render_options(collection_id='{planetarycomputer_collection_id}')") + response = client.stac.list_render_options(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Number of render options: {len(response)}") # Validate response structure - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" if len(response) > 0: first_option = response[0] @@ -260,9 +229,7 @@ def test_05_list_render_options( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_06_get_tile_settings( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_06_get_tile_settings(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting tile settings for a collection. @@ -278,12 +245,8 @@ def test_06_get_tile_settings( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_tile_settings(collection_id='{planetarycomputer_collection_id}')" - ) - response = client.stac.get_tile_settings( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_tile_settings(collection_id='{planetarycomputer_collection_id}')") + response = client.stac.get_tile_settings(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") if hasattr(response, "as_dict"): @@ -305,9 +268,7 @@ def test_06_get_tile_settings( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_07_list_mosaics( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_07_list_mosaics(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test listing mosaics for a collection. @@ -323,20 +284,14 @@ def test_07_list_mosaics( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: list_mosaics(collection_id='{planetarycomputer_collection_id}')" - ) - response = client.stac.list_mosaics( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: list_mosaics(collection_id='{planetarycomputer_collection_id}')") + response = client.stac.list_mosaics(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Number of mosaics: {len(response)}") # Validate response structure - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" if len(response) > 0: first_mosaic = response[0] @@ -350,9 +305,7 @@ def test_07_list_mosaics( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_08_get_collection_queryables( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_08_get_collection_queryables(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting queryables for a collection. @@ -368,17 +321,11 @@ def test_08_get_collection_queryables( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_collection_queryables(collection_id='{planetarycomputer_collection_id}')" - ) - response = client.stac.get_collection_queryables( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_collection_queryables(collection_id='{planetarycomputer_collection_id}')") + response = client.stac.get_collection_queryables(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") - test_logger.info( - f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}" - ) + test_logger.info(f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}") # Validate response structure assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" @@ -415,9 +362,7 @@ def test_09_list_queryables(self, planetarycomputer_endpoint): response = client.stac.list_queryables() test_logger.info(f"Response type: {type(response)}") - test_logger.info( - f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}" - ) + test_logger.info(f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}") # Validate response structure assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" @@ -430,9 +375,7 @@ def test_09_list_queryables(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy - def test_10_get_collection_configuration( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_10_get_collection_configuration(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting collection configuration. @@ -448,12 +391,8 @@ def test_10_get_collection_configuration( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_collection_configuration(collection_id='{planetarycomputer_collection_id}')" - ) - response = client.stac.get_collection_configuration( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_collection_configuration(collection_id='{planetarycomputer_collection_id}')") + response = client.stac.get_collection_configuration(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") if hasattr(response, "as_dict"): @@ -467,9 +406,7 @@ def test_10_get_collection_configuration( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_10a_create_thumbnail_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_10a_create_thumbnail_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating a thumbnail collection asset. This ensures the collection has a thumbnail for subsequent tests. @@ -487,22 +424,12 @@ def test_10a_create_thumbnail_asset( # Delete the thumbnail asset if it already exists try: - test_logger.info( - "Checking if asset 'thumbnail' already exists and deleting if found..." - ) - client.stac.delete_collection_asset( - collection_id=planetarycomputer_collection_id, asset_id="thumbnail" - ) + test_logger.info("Checking if asset 'thumbnail' already exists and deleting if found...") + client.stac.delete_collection_asset(collection_id=planetarycomputer_collection_id, asset_id="thumbnail") test_logger.info("Deleted existing 'thumbnail'") except Exception as e: - if ( - "404" in str(e) - or "Not Found" in str(e) - or "not found" in str(e).lower() - ): - test_logger.info( - "Asset 'thumbnail' does not exist, proceeding with creation" - ) + if "404" in str(e) or "Not Found" in str(e) or "not found" in str(e).lower(): + test_logger.info("Asset 'thumbnail' does not exist, proceeding with creation") else: test_logger.warning(f"Error checking/deleting asset: {e}") @@ -516,8 +443,7 @@ def test_10a_create_thumbnail_asset( # Minimal valid 16x9 RGB PNG image png_bytes = base64.b64decode( - "iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAIAAAC0SDtlAAAAEklEQVR4nGNg" - "aGAgDY1qGBQaAAlbSAENQjjgAAAAAElFTkSuQmCC" + "iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAIAAAC0SDtlAAAAEklEQVR4nGNg" "aGAgDY1qGBQaAAlbSAENQjjgAAAAAElFTkSuQmCC" ) file_content = BytesIO(png_bytes) @@ -535,18 +461,14 @@ def test_10a_create_thumbnail_asset( assert response is not None # Verify the thumbnail asset now exists on the collection - collection = client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = client.stac.get_collection(collection_id=planetarycomputer_collection_id) assert "thumbnail" in collection.assets, "Collection should now have a thumbnail asset" test_logger.info("Test PASSED\n") @PlanetaryComputerPreparer() @recorded_by_proxy - def test_11_get_collection_thumbnail( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_11_get_collection_thumbnail(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting collection thumbnail. @@ -563,23 +485,13 @@ def test_11_get_collection_thumbnail( client = self.create_client(endpoint=planetarycomputer_endpoint) # First check if collection has thumbnail asset - collection = client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = client.stac.get_collection(collection_id=planetarycomputer_collection_id) - if ( - not hasattr(collection, "assets") - or collection.assets is None - or "thumbnail" not in collection.assets - ): + if not hasattr(collection, "assets") or collection.assets is None or "thumbnail" not in collection.assets: assert False, "Collection does not have a thumbnail asset" - test_logger.info( - f"Calling: get_collection_thumbnail(collection_id='{planetarycomputer_collection_id}')" - ) - response = client.stac.get_collection_thumbnail( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_collection_thumbnail(collection_id='{planetarycomputer_collection_id}')") + response = client.stac.get_collection_thumbnail(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") @@ -590,9 +502,7 @@ def test_11_get_collection_thumbnail( # Validate image data assert len(thumbnail_bytes) > 0, "Thumbnail bytes should not be empty" - assert ( - len(thumbnail_bytes) > 50 - ), f"Thumbnail should be substantial, got only {len(thumbnail_bytes)} bytes" + assert len(thumbnail_bytes) > 50, f"Thumbnail should be substantial, got only {len(thumbnail_bytes)} bytes" # Check for common image format magic bytes # PNG: 89 50 4E 47 @@ -611,9 +521,7 @@ def test_11_get_collection_thumbnail( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_12_create_render_option( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_12_create_render_option(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating a render option for a collection. """ @@ -631,9 +539,7 @@ def test_12_create_render_option( collection_id=planetarycomputer_collection_id, render_option_id="test-natural-color", ) - test_logger.info( - "Render option 'test-natural-color' already exists, deleting it first" - ) + test_logger.info("Render option 'test-natural-color' already exists, deleting it first") client.stac.delete_render_option( collection_id=planetarycomputer_collection_id, render_option_id="test-natural-color", @@ -653,9 +559,7 @@ def test_12_create_render_option( test_logger.info( f"Calling: create_render_option(collection_id='{planetarycomputer_collection_id}', body={render_option})" ) - response = client.stac.create_render_option( - collection_id=planetarycomputer_collection_id, body=render_option - ) + response = client.stac.create_render_option(collection_id=planetarycomputer_collection_id, body=render_option) test_logger.info(f"Response: {response}") assert response is not None @@ -666,9 +570,7 @@ def test_12_create_render_option( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_13_get_render_option( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_13_get_render_option(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting a specific render option. """ @@ -695,9 +597,7 @@ def test_13_get_render_option( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_14_replace_render_option( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_14_replace_render_option(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating or replacing a render option. """ @@ -736,9 +636,7 @@ def test_14_replace_render_option( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_14a_delete_render_option( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_14a_delete_render_option(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test deleting a render option. First creates a render option specifically for deletion. @@ -761,9 +659,7 @@ def test_14a_delete_render_option( ) test_logger.info(f"Creating render option for deletion: {render_option.id}") - client.stac.create_render_option( - collection_id=planetarycomputer_collection_id, body=render_option - ) + client.stac.create_render_option(collection_id=planetarycomputer_collection_id, body=render_option) # Verify it exists retrieved = client.stac.get_render_option( @@ -793,19 +689,13 @@ def test_14a_delete_render_option( assert False, "Render option should have been deleted" except Exception as e: test_logger.info(f"Confirmed deletion (404 expected): {e}") - assert ( - "404" in str(e) - or "Not Found" in str(e) - or "not found" in str(e).lower() - ) + assert "404" in str(e) or "Not Found" in str(e) or "not found" in str(e).lower() test_logger.info("Test PASSED\n") @PlanetaryComputerPreparer() @recorded_by_proxy - def test_15_add_mosaic( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_15_add_mosaic(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test adding a mosaic to a collection. """ @@ -819,13 +709,9 @@ def test_15_add_mosaic( # Check if mosaic already exists and delete it try: - client.stac.get_mosaic( - collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1" - ) + client.stac.get_mosaic(collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1") test_logger.info("Mosaic 'test-mosaic-1' already exists, deleting it first") - client.stac.delete_mosaic( - collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1" - ) + client.stac.delete_mosaic(collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1") test_logger.info("Existing mosaic deleted") except Exception as e: test_logger.info(f"Mosaic does not exist (expected): {e}") @@ -836,12 +722,8 @@ def test_15_add_mosaic( cql=[], ) - test_logger.info( - f"Calling: add_mosaic(collection_id='{planetarycomputer_collection_id}', body={mosaic})" - ) - response = client.stac.add_mosaic( - collection_id=planetarycomputer_collection_id, body=mosaic - ) + test_logger.info(f"Calling: add_mosaic(collection_id='{planetarycomputer_collection_id}', body={mosaic})") + response = client.stac.add_mosaic(collection_id=planetarycomputer_collection_id, body=mosaic) test_logger.info(f"Response: {response}") assert response is not None @@ -852,9 +734,7 @@ def test_15_add_mosaic( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_16_get_mosaic( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_16_get_mosaic(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting a specific mosaic. """ @@ -867,9 +747,7 @@ def test_16_get_mosaic( test_logger.info( f"Calling: get_mosaic(collection_id='{planetarycomputer_collection_id}', mosaic_id='test-mosaic-1')" ) - response = client.stac.get_mosaic( - collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1" - ) + response = client.stac.get_mosaic(collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1") test_logger.info(f"Response: {response}") assert response is not None @@ -880,9 +758,7 @@ def test_16_get_mosaic( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_17_replace_mosaic( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_17_replace_mosaic(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating or replacing a mosaic. """ @@ -919,9 +795,7 @@ def test_17_replace_mosaic( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_17a_delete_mosaic( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_17a_delete_mosaic(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test deleting a mosaic. First creates a mosaic specifically for deletion. @@ -942,9 +816,7 @@ def test_17a_delete_mosaic( ) test_logger.info(f"Creating mosaic for deletion: {mosaic.id}") - client.stac.add_mosaic( - collection_id=planetarycomputer_collection_id, body=mosaic - ) + client.stac.add_mosaic(collection_id=planetarycomputer_collection_id, body=mosaic) # Verify it exists retrieved = client.stac.get_mosaic( @@ -974,11 +846,7 @@ def test_17a_delete_mosaic( assert False, "Mosaic should have been deleted" except Exception as e: test_logger.info(f"Confirmed deletion (404 expected): {e}") - assert ( - "404" in str(e) - or "Not Found" in str(e) - or "not found" in str(e).lower() - ) + assert "404" in str(e) or "Not Found" in str(e) or "not found" in str(e).lower() test_logger.info("Test PASSED\n") @@ -1008,22 +876,21 @@ def test_18_replace_partition_type(self, planetarycomputer_endpoint): # Check if collection exists and delete it first try: - existing_collection = client.stac.get_collection( - collection_id=test_collection_id - ) + existing_collection = client.stac.get_collection(collection_id=test_collection_id) if existing_collection: - test_logger.info( - f"Collection '{test_collection_id}' already exists, deleting first..." - ) - delete_poller = client.stac.begin_delete_collection( - collection_id=test_collection_id, polling=True - ) + test_logger.info(f"Collection '{test_collection_id}' already exists, deleting first...") + delete_poller = client.stac.begin_delete_collection(collection_id=test_collection_id, polling=True) delete_poller.result() test_logger.info(f"Deleted existing collection '{test_collection_id}'") - except Exception: - test_logger.info( - f"Collection '{test_collection_id}' does not exist, proceeding with creation" - ) + # Wait for deletion to fully propagate + for _ in range(12): + try: + client.stac.get_collection(collection_id=test_collection_id) + time.sleep(5) + except ResourceNotFoundError: + break + except ResourceNotFoundError: + test_logger.info(f"Collection '{test_collection_id}' does not exist, proceeding with creation") # Define collection extents spatial_extent = StacExtensionSpatialExtent(bounding_box=[[-180, -90, 180, 90]]) @@ -1050,13 +917,21 @@ def test_18_replace_partition_type(self, planetarycomputer_endpoint): "type": "Collection", } - # Create the collection using the correct API + # Create the collection, retrying if previous deletion hasn't fully propagated + from azure.core.exceptions import ResourceExistsError + test_logger.info("Creating collection using begin_create_collection") - create_poller = client.stac.begin_create_collection( - body=collection_data, polling=True - ) - create_poller.result() - test_logger.info("Temporary collection created") + for attempt in range(12): + try: + create_poller = client.stac.begin_create_collection(body=collection_data, polling=True) + create_poller.result() + test_logger.info("Temporary collection created") + break + except ResourceExistsError: + test_logger.info(f"Collection still being deleted, retrying in 5s (attempt {attempt + 1}/12)") + time.sleep(5) + else: + raise RuntimeError("Failed to create collection after 12 retries - previous deletion still pending") try: # Set partition type @@ -1065,9 +940,7 @@ def test_18_replace_partition_type(self, planetarycomputer_endpoint): test_logger.info( f"Calling: replace_partition_type(collection_id='{test_collection_id}', body={partition_type})" ) - client.stac.replace_partition_type( - collection_id=test_collection_id, body=partition_type - ) + client.stac.replace_partition_type(collection_id=test_collection_id, body=partition_type) # Verify the change updated_partition = client.stac.get_partition_type(test_collection_id) @@ -1079,9 +952,7 @@ def test_18_replace_partition_type(self, planetarycomputer_endpoint): # Clean up: delete the temporary collection test_logger.info(f"Deleting temporary collection: {test_collection_id}") try: - delete_poller = client.stac.begin_delete_collection( - collection_id=test_collection_id, polling=True - ) + delete_poller = client.stac.begin_delete_collection(collection_id=test_collection_id, polling=True) delete_poller.result() test_logger.info("Temporary collection deleted") except Exception as e: @@ -1091,9 +962,7 @@ def test_18_replace_partition_type(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy - def test_19_replace_tile_settings( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_19_replace_tile_settings(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test replacing tile settings for a collection. """ @@ -1114,9 +983,7 @@ def test_19_replace_tile_settings( test_logger.info( f"Calling: replace_tile_settings(collection_id='{planetarycomputer_collection_id}', body={tile_settings})" ) - response = client.stac.replace_tile_settings( - collection_id=planetarycomputer_collection_id, body=tile_settings - ) + response = client.stac.replace_tile_settings(collection_id=planetarycomputer_collection_id, body=tile_settings) test_logger.info(f"Response: {response}") assert response is not None @@ -1127,9 +994,7 @@ def test_19_replace_tile_settings( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_20_create_queryables( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_20_create_queryables(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating queryables for a collection. """ @@ -1146,13 +1011,9 @@ def test_20_create_queryables( # Check if queryable already exists and delete it try: - queryables = client.stac.get_collection_queryables( - collection_id=planetarycomputer_collection_id - ) + queryables = client.stac.get_collection_queryables(collection_id=planetarycomputer_collection_id) if "test:property" in queryables.get("properties", {}): - test_logger.info( - "Queryable 'test:property' already exists, deleting it first" - ) + test_logger.info("Queryable 'test:property' already exists, deleting it first") client.stac.delete_queryable( collection_id=planetarycomputer_collection_id, queryable_name="test:property", @@ -1175,34 +1036,24 @@ def test_20_create_queryables( test_logger.info( f"Calling: create_queryables(collection_id='{planetarycomputer_collection_id}', body=[queryable])" ) - response = client.stac.create_queryables( - collection_id=planetarycomputer_collection_id, body=[queryable] - ) + response = client.stac.create_queryables(collection_id=planetarycomputer_collection_id, body=[queryable]) test_logger.info(f"Response: {response}") assert response is not None # Response is a list of queryables - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" assert len(response) > 0, "Response should contain at least one queryable" # Verify our queryable was created - queryable_names = [ - q.get("name") if isinstance(q, MutableMapping) else q.name for q in response - ] - assert ( - "test:property" in queryable_names - ), "Created queryable 'test:property' should be in response" + queryable_names = [q.get("name") if isinstance(q, MutableMapping) else q.name for q in response] + assert "test:property" in queryable_names, "Created queryable 'test:property' should be in response" test_logger.info("Test PASSED\n") @PlanetaryComputerPreparer() @recorded_by_proxy - def test_21_replace_queryable( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_21_replace_queryable(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating or replacing a queryable. """ @@ -1242,9 +1093,7 @@ def test_21_replace_queryable( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_21a_delete_queryable( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_21a_delete_queryable(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test deleting a queryable. First creates a queryable specifically for deletion. @@ -1271,14 +1120,10 @@ def test_21a_delete_queryable( ) test_logger.info(f"Creating queryable for deletion: {queryable.name}") - client.stac.create_queryables( - collection_id=planetarycomputer_collection_id, body=[queryable] - ) + client.stac.create_queryables(collection_id=planetarycomputer_collection_id, body=[queryable]) # Verify it exists - queryables = client.stac.get_collection_queryables( - collection_id=planetarycomputer_collection_id - ) + queryables = client.stac.get_collection_queryables(collection_id=planetarycomputer_collection_id) assert "test:property_to_be_deleted" in queryables["properties"] test_logger.info("Queryable created successfully") @@ -1294,11 +1139,7 @@ def test_21a_delete_queryable( test_logger.info("Queryable deleted successfully") # Verify deletion - queryables_after = client.stac.get_collection_queryables( - collection_id=planetarycomputer_collection_id - ) - assert ( - "test:property_to_be_deleted" not in queryables_after["properties"] - ), "Queryable should have been deleted" + queryables_after = client.stac.get_collection_queryables(collection_id=planetarycomputer_collection_id) + assert "test:property_to_be_deleted" not in queryables_after["properties"], "Queryable should have been deleted" test_logger.info("Test PASSED\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection_async.py index 77011a186057..58d1055ba17b 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection_async.py @@ -17,6 +17,7 @@ from devtools_testutils import recorded_by_proxy, is_live from testpreparer_async import PlanetaryComputerProClientTestBaseAsync from testpreparer import PlanetaryComputerPreparer +from azure.core.exceptions import ResourceNotFoundError from azure.planetarycomputer.models import ( PartitionTypeScheme, ) @@ -65,14 +66,10 @@ async def test_01_list_collections(self, planetarycomputer_endpoint): # Validate response structure assert response is not None, "Response should not be None" - assert hasattr( - response, "collections" - ), "Response should have 'collections' attribute" + assert hasattr(response, "collections"), "Response should have 'collections' attribute" collections = response.collections - assert isinstance( - collections, list - ), f"Collections should be a list, got {type(collections)}" + assert isinstance(collections, list), f"Collections should be a list, got {type(collections)}" test_logger.info(f"Number of collections: {len(collections)}") @@ -112,14 +109,10 @@ async def test_02_get_conformance_class(self, planetarycomputer_endpoint): # Validate response structure assert response is not None, "Response should not be None" - assert hasattr( - response, "conforms_to" - ), "Response should have 'conforms_to' attribute" + assert hasattr(response, "conforms_to"), "Response should have 'conforms_to' attribute" conforms_to = response.conforms_to - assert isinstance( - conforms_to, list - ), f"conformsTo should be a list, got {type(conforms_to)}" + assert isinstance(conforms_to, list), f"conformsTo should be a list, got {type(conforms_to)}" assert len(conforms_to) > 0, "Should have at least one conformance class" test_logger.info(f"Number of conformance classes: {len(conforms_to)}") @@ -132,9 +125,7 @@ async def test_02_get_conformance_class(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_03_get_collection( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_03_get_collection(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting a specific STAC collection. @@ -150,12 +141,8 @@ async def test_03_get_collection( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_collection(collection_id='{planetarycomputer_collection_id}')" - ) - response = await client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_collection(collection_id='{planetarycomputer_collection_id}')") + response = await client.stac.get_collection(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Collection ID: {response.id}") @@ -164,12 +151,8 @@ async def test_03_get_collection( # Validate response structure assert response is not None, "Response should not be None" - assert ( - response.id == planetarycomputer_collection_id - ), "Collection ID should match requested ID" - assert ( - response.title is not None and len(response.title) > 0 - ), "Collection should have a title" + assert response.id == planetarycomputer_collection_id, "Collection ID should match requested ID" + assert response.title is not None and len(response.title) > 0, "Collection should have a title" assert response.description is not None, "Collection should have a description" assert response.extent is not None, "Collection should have extent" assert response.license is not None, "Collection should have license" @@ -180,9 +163,7 @@ async def test_03_get_collection( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_04_get_partition_type( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_04_get_partition_type(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting partition type for a collection. @@ -198,9 +179,7 @@ async def test_04_get_partition_type( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_partition_type(collection_id='{planetarycomputer_collection_id}')" - ) + test_logger.info(f"Calling: get_partition_type(collection_id='{planetarycomputer_collection_id}')") response = await client.stac.get_partition_type(planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") @@ -213,9 +192,7 @@ async def test_04_get_partition_type( # Validate scheme is a valid PartitionTypeScheme valid_schemes = [s.value for s in PartitionTypeScheme] - assert ( - response.scheme in valid_schemes - ), f"Partition scheme should be one of {valid_schemes}" + assert response.scheme in valid_schemes, f"Partition scheme should be one of {valid_schemes}" test_logger.info("Test PASSED\n") @@ -223,9 +200,7 @@ async def test_04_get_partition_type( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_05_list_render_options( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_05_list_render_options(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test listing render options for a collection. @@ -241,20 +216,14 @@ async def test_05_list_render_options( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: list_render_options(collection_id='{planetarycomputer_collection_id}')" - ) - response = await client.stac.list_render_options( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: list_render_options(collection_id='{planetarycomputer_collection_id}')") + response = await client.stac.list_render_options(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Number of render options: {len(response)}") # Validate response structure - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" if len(response) > 0: first_option = response[0] @@ -272,9 +241,7 @@ async def test_05_list_render_options( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_06_get_tile_settings( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_06_get_tile_settings(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting tile settings for a collection. @@ -290,12 +257,8 @@ async def test_06_get_tile_settings( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_tile_settings(collection_id='{planetarycomputer_collection_id}')" - ) - response = await client.stac.get_tile_settings( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_tile_settings(collection_id='{planetarycomputer_collection_id}')") + response = await client.stac.get_tile_settings(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") if hasattr(response, "as_dict"): @@ -319,9 +282,7 @@ async def test_06_get_tile_settings( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_07_list_mosaics( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_07_list_mosaics(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test listing mosaics for a collection. @@ -337,20 +298,14 @@ async def test_07_list_mosaics( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: list_mosaics(collection_id='{planetarycomputer_collection_id}')" - ) - response = await client.stac.list_mosaics( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: list_mosaics(collection_id='{planetarycomputer_collection_id}')") + response = await client.stac.list_mosaics(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Number of mosaics: {len(response)}") # Validate response structure - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" if len(response) > 0: first_mosaic = response[0] @@ -366,9 +321,7 @@ async def test_07_list_mosaics( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_08_get_collection_queryables( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_08_get_collection_queryables(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting queryables for a collection. @@ -384,17 +337,11 @@ async def test_08_get_collection_queryables( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_collection_queryables(collection_id='{planetarycomputer_collection_id}')" - ) - response = await client.stac.get_collection_queryables( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_collection_queryables(collection_id='{planetarycomputer_collection_id}')") + response = await client.stac.get_collection_queryables(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") - test_logger.info( - f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}" - ) + test_logger.info(f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}") # Validate response structure assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" @@ -433,9 +380,7 @@ async def test_09_list_queryables(self, planetarycomputer_endpoint): response = await client.stac.list_queryables() test_logger.info(f"Response type: {type(response)}") - test_logger.info( - f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}" - ) + test_logger.info(f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}") # Validate response structure assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" @@ -450,9 +395,7 @@ async def test_09_list_queryables(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_10_get_collection_configuration( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_10_get_collection_configuration(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting collection configuration. @@ -468,12 +411,8 @@ async def test_10_get_collection_configuration( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_collection_configuration(collection_id='{planetarycomputer_collection_id}')" - ) - response = await client.stac.get_collection_configuration( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_collection_configuration(collection_id='{planetarycomputer_collection_id}')") + response = await client.stac.get_collection_configuration(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") if hasattr(response, "as_dict"): @@ -489,9 +428,7 @@ async def test_10_get_collection_configuration( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_10a_create_thumbnail_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_10a_create_thumbnail_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating a thumbnail collection asset. This ensures the collection has a thumbnail for subsequent tests. @@ -509,22 +446,14 @@ async def test_10a_create_thumbnail_asset( # Delete the thumbnail asset if it already exists try: - test_logger.info( - "Checking if asset 'thumbnail' already exists and deleting if found..." - ) + test_logger.info("Checking if asset 'thumbnail' already exists and deleting if found...") await client.stac.delete_collection_asset( collection_id=planetarycomputer_collection_id, asset_id="thumbnail" ) test_logger.info("Deleted existing 'thumbnail'") except Exception as e: - if ( - "404" in str(e) - or "Not Found" in str(e) - or "not found" in str(e).lower() - ): - test_logger.info( - "Asset 'thumbnail' does not exist, proceeding with creation" - ) + if "404" in str(e) or "Not Found" in str(e) or "not found" in str(e).lower(): + test_logger.info("Asset 'thumbnail' does not exist, proceeding with creation") else: test_logger.warning(f"Error checking/deleting asset: {e}") @@ -538,8 +467,7 @@ async def test_10a_create_thumbnail_asset( # Minimal valid 16x9 RGB PNG image png_bytes = base64.b64decode( - "iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAIAAAC0SDtlAAAAEklEQVR4nGNg" - "aGAgDY1qGBQaAAlbSAENQjjgAAAAAElFTkSuQmCC" + "iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAIAAAC0SDtlAAAAEklEQVR4nGNg" "aGAgDY1qGBQaAAlbSAENQjjgAAAAAElFTkSuQmCC" ) file_content = BytesIO(png_bytes) @@ -557,9 +485,7 @@ async def test_10a_create_thumbnail_asset( assert response is not None # Verify the thumbnail asset now exists on the collection - collection = await client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = await client.stac.get_collection(collection_id=planetarycomputer_collection_id) assert "thumbnail" in collection.assets, "Collection should now have a thumbnail asset" test_logger.info("Test PASSED\n") @@ -568,9 +494,7 @@ async def test_10a_create_thumbnail_asset( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_11_get_collection_thumbnail( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_11_get_collection_thumbnail(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting collection thumbnail. @@ -587,23 +511,13 @@ async def test_11_get_collection_thumbnail( client = self.create_client(endpoint=planetarycomputer_endpoint) # First check if collection has thumbnail asset - collection = await client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = await client.stac.get_collection(collection_id=planetarycomputer_collection_id) - if ( - not hasattr(collection, "assets") - or collection.assets is None - or "thumbnail" not in collection.assets - ): + if not hasattr(collection, "assets") or collection.assets is None or "thumbnail" not in collection.assets: assert False, "Collection does not have a thumbnail asset" - test_logger.info( - f"Calling: get_collection_thumbnail(collection_id='{planetarycomputer_collection_id}')" - ) - response = await client.stac.get_collection_thumbnail( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_collection_thumbnail(collection_id='{planetarycomputer_collection_id}')") + response = await client.stac.get_collection_thumbnail(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") @@ -614,9 +528,7 @@ async def test_11_get_collection_thumbnail( # Validate image data assert len(thumbnail_bytes) > 0, "Thumbnail bytes should not be empty" - assert ( - len(thumbnail_bytes) > 50 - ), f"Thumbnail should be substantial, got only {len(thumbnail_bytes)} bytes" + assert len(thumbnail_bytes) > 50, f"Thumbnail should be substantial, got only {len(thumbnail_bytes)} bytes" # Check for common image format magic bytes # PNG: 89 50 4E 47 @@ -637,9 +549,7 @@ async def test_11_get_collection_thumbnail( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_12_create_render_option( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_12_create_render_option(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating a render option for a collection. """ @@ -657,9 +567,7 @@ async def test_12_create_render_option( collection_id=planetarycomputer_collection_id, render_option_id="test-natural-color", ) - test_logger.info( - "Render option 'test-natural-color' already exists, deleting it first" - ) + test_logger.info("Render option 'test-natural-color' already exists, deleting it first") await client.stac.delete_render_option( collection_id=planetarycomputer_collection_id, render_option_id="test-natural-color", @@ -694,9 +602,7 @@ async def test_12_create_render_option( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_13_get_render_option( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_13_get_render_option(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting a specific render option. """ @@ -725,9 +631,7 @@ async def test_13_get_render_option( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_14_replace_render_option( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_14_replace_render_option(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating or replacing a render option. """ @@ -768,9 +672,7 @@ async def test_14_replace_render_option( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_14a_delete_render_option( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_14a_delete_render_option(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test deleting a render option. First creates a render option specifically for deletion. @@ -793,9 +695,7 @@ async def test_14a_delete_render_option( ) test_logger.info(f"Creating render option for deletion: {render_option.id}") - await client.stac.create_render_option( - collection_id=planetarycomputer_collection_id, body=render_option - ) + await client.stac.create_render_option(collection_id=planetarycomputer_collection_id, body=render_option) # Verify it exists retrieved = await client.stac.get_render_option( @@ -825,11 +725,7 @@ async def test_14a_delete_render_option( assert False, "Render option should have been deleted" except Exception as e: test_logger.info(f"Confirmed deletion (404 expected): {e}") - assert ( - "404" in str(e) - or "Not Found" in str(e) - or "not found" in str(e).lower() - ) + assert "404" in str(e) or "Not Found" in str(e) or "not found" in str(e).lower() test_logger.info("Test PASSED\n") @@ -837,9 +733,7 @@ async def test_14a_delete_render_option( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_15_add_mosaic( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_15_add_mosaic(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test adding a mosaic to a collection. """ @@ -853,13 +747,9 @@ async def test_15_add_mosaic( # Check if mosaic already exists and delete it try: - await client.stac.get_mosaic( - collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1" - ) + await client.stac.get_mosaic(collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1") test_logger.info("Mosaic 'test-mosaic-1' already exists, deleting it first") - await client.stac.delete_mosaic( - collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1" - ) + await client.stac.delete_mosaic(collection_id=planetarycomputer_collection_id, mosaic_id="test-mosaic-1") test_logger.info("Existing mosaic deleted") except Exception as e: test_logger.info(f"Mosaic does not exist (expected): {e}") @@ -870,12 +760,8 @@ async def test_15_add_mosaic( cql=[], ) - test_logger.info( - f"Calling: add_mosaic(collection_id='{planetarycomputer_collection_id}', body={mosaic})" - ) - response = await client.stac.add_mosaic( - collection_id=planetarycomputer_collection_id, body=mosaic - ) + test_logger.info(f"Calling: add_mosaic(collection_id='{planetarycomputer_collection_id}', body={mosaic})") + response = await client.stac.add_mosaic(collection_id=planetarycomputer_collection_id, body=mosaic) test_logger.info(f"Response: {response}") assert response is not None @@ -888,9 +774,7 @@ async def test_15_add_mosaic( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_16_get_mosaic( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_16_get_mosaic(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting a specific mosaic. """ @@ -918,9 +802,7 @@ async def test_16_get_mosaic( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_17_replace_mosaic( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_17_replace_mosaic(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating or replacing a mosaic. """ @@ -959,9 +841,7 @@ async def test_17_replace_mosaic( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_17a_delete_mosaic( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_17a_delete_mosaic(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test deleting a mosaic. First creates a mosaic specifically for deletion. @@ -982,9 +862,7 @@ async def test_17a_delete_mosaic( ) test_logger.info(f"Creating mosaic for deletion: {mosaic.id}") - await client.stac.add_mosaic( - collection_id=planetarycomputer_collection_id, body=mosaic - ) + await client.stac.add_mosaic(collection_id=planetarycomputer_collection_id, body=mosaic) # Verify it exists retrieved = await client.stac.get_mosaic( @@ -1014,11 +892,7 @@ async def test_17a_delete_mosaic( assert False, "Mosaic should have been deleted" except Exception as e: test_logger.info(f"Confirmed deletion (404 expected): {e}") - assert ( - "404" in str(e) - or "Not Found" in str(e) - or "not found" in str(e).lower() - ) + assert "404" in str(e) or "Not Found" in str(e) or "not found" in str(e).lower() test_logger.info("Test PASSED\n") @@ -1050,22 +924,25 @@ async def test_18_replace_partition_type(self, planetarycomputer_endpoint): # Check if collection exists and delete it first try: - existing_collection = await client.stac.get_collection( - collection_id=test_collection_id - ) + existing_collection = await client.stac.get_collection(collection_id=test_collection_id) if existing_collection: - test_logger.info( - f"Collection '{test_collection_id}' already exists, deleting first..." - ) + test_logger.info(f"Collection '{test_collection_id}' already exists, deleting first...") delete_poller = await client.stac.begin_delete_collection( collection_id=test_collection_id, polling=True ) - delete_poller.result() + await delete_poller.result() test_logger.info(f"Deleted existing collection '{test_collection_id}'") - except Exception: - test_logger.info( - f"Collection '{test_collection_id}' does not exist, proceeding with creation" - ) + # Wait for deletion to fully propagate + import asyncio + + for _ in range(12): + try: + await client.stac.get_collection(collection_id=test_collection_id) + await asyncio.sleep(5) + except ResourceNotFoundError: + break + except ResourceNotFoundError: + test_logger.info(f"Collection '{test_collection_id}' does not exist, proceeding with creation") # Define collection extents spatial_extent = StacExtensionSpatialExtent(bounding_box=[[-180, -90, 180, 90]]) @@ -1092,13 +969,22 @@ async def test_18_replace_partition_type(self, planetarycomputer_endpoint): "type": "Collection", } - # Create the collection using the correct API + # Create the collection, retrying if previous deletion hasn't fully propagated + import asyncio + from azure.core.exceptions import ResourceExistsError + test_logger.info("Creating collection using begin_create_collection") - create_poller = await client.stac.begin_create_collection( - body=collection_data, polling=True - ) - await create_poller.result() - test_logger.info("Temporary collection created") + for attempt in range(12): + try: + create_poller = await client.stac.begin_create_collection(body=collection_data, polling=True) + await create_poller.result() + test_logger.info("Temporary collection created") + break + except ResourceExistsError: + test_logger.info(f"Collection still being deleted, retrying in 5s (attempt {attempt + 1}/12)") + await asyncio.sleep(5) + else: + raise RuntimeError("Failed to create collection after 12 retries - previous deletion still pending") try: # Set partition type @@ -1107,9 +993,7 @@ async def test_18_replace_partition_type(self, planetarycomputer_endpoint): test_logger.info( f"Calling: replace_partition_type(collection_id='{test_collection_id}', body={partition_type})" ) - await client.stac.replace_partition_type( - collection_id=test_collection_id, body=partition_type - ) + await client.stac.replace_partition_type(collection_id=test_collection_id, body=partition_type) # Verify the change updated_partition = await client.stac.get_partition_type(test_collection_id) @@ -1135,9 +1019,7 @@ async def test_18_replace_partition_type(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_19_replace_tile_settings( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_19_replace_tile_settings(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test replacing tile settings for a collection. """ @@ -1173,9 +1055,7 @@ async def test_19_replace_tile_settings( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_20_create_queryables( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_20_create_queryables(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating queryables for a collection. """ @@ -1192,13 +1072,9 @@ async def test_20_create_queryables( # Check if queryable already exists and delete it try: - queryables = await client.stac.get_collection_queryables( - collection_id=planetarycomputer_collection_id - ) + queryables = await client.stac.get_collection_queryables(collection_id=planetarycomputer_collection_id) if "test:property" in queryables.get("properties", {}): - test_logger.info( - "Queryable 'test:property' already exists, deleting it first" - ) + test_logger.info("Queryable 'test:property' already exists, deleting it first") await client.stac.delete_queryable( collection_id=planetarycomputer_collection_id, queryable_name="test:property", @@ -1221,26 +1097,18 @@ async def test_20_create_queryables( test_logger.info( f"Calling: create_queryables(collection_id='{planetarycomputer_collection_id}', body=[queryable])" ) - response = await client.stac.create_queryables( - collection_id=planetarycomputer_collection_id, body=[queryable] - ) + response = await client.stac.create_queryables(collection_id=planetarycomputer_collection_id, body=[queryable]) test_logger.info(f"Response: {response}") assert response is not None # Response is a list of queryables - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" assert len(response) > 0, "Response should contain at least one queryable" # Verify our queryable was created - queryable_names = [ - q.get("name") if isinstance(q, MutableMapping) else q.name for q in response - ] - assert ( - "test:property" in queryable_names - ), "Created queryable 'test:property' should be in response" + queryable_names = [q.get("name") if isinstance(q, MutableMapping) else q.name for q in response] + assert "test:property" in queryable_names, "Created queryable 'test:property' should be in response" test_logger.info("Test PASSED\n") @@ -1248,9 +1116,7 @@ async def test_20_create_queryables( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_21_replace_queryable( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_21_replace_queryable(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating or replacing a queryable. """ @@ -1292,9 +1158,7 @@ async def test_21_replace_queryable( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_21a_delete_queryable( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_21a_delete_queryable(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test deleting a queryable. First creates a queryable specifically for deletion. @@ -1321,14 +1185,10 @@ async def test_21a_delete_queryable( ) test_logger.info(f"Creating queryable for deletion: {queryable.name}") - await client.stac.create_queryables( - collection_id=planetarycomputer_collection_id, body=[queryable] - ) + await client.stac.create_queryables(collection_id=planetarycomputer_collection_id, body=[queryable]) # Verify it exists - queryables = await client.stac.get_collection_queryables( - collection_id=planetarycomputer_collection_id - ) + queryables = await client.stac.get_collection_queryables(collection_id=planetarycomputer_collection_id) assert "test:property_to_be_deleted" in queryables["properties"] test_logger.info("Queryable created successfully") @@ -1344,12 +1204,8 @@ async def test_21a_delete_queryable( test_logger.info("Queryable deleted successfully") # Verify deletion - queryables_after = await client.stac.get_collection_queryables( - collection_id=planetarycomputer_collection_id - ) - assert ( - "test:property_to_be_deleted" not in queryables_after["properties"] - ), "Queryable should have been deleted" + queryables_after = await client.stac.get_collection_queryables(collection_id=planetarycomputer_collection_id) + assert "test:property_to_be_deleted" not in queryables_after["properties"], "Queryable should have been deleted" test_logger.info("Test PASSED\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_01_ingestion_management.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_01_ingestion_management.py index 56e895dcb23d..f15f18244f88 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_01_ingestion_management.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_01_ingestion_management.py @@ -35,9 +35,7 @@ log_file = log_dir / "ingestion_test_results.log" file_handler = logging.FileHandler(log_file, mode="w") file_handler.setLevel(logging.INFO) -file_handler.setFormatter( - logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") -) +file_handler.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")) logger.addHandler(file_handler) @@ -64,12 +62,8 @@ def test_01_list_managed_identities(self, planetarycomputer_endpoint): logger.info(f" - Resource ID: {identity.resource_id}") # Assertions - assert ( - managed_identities is not None - ), "Managed identities list should not be None" - assert isinstance( - managed_identities, list - ), "Managed identities should be a list" + assert managed_identities is not None, "Managed identities list should not be None" + assert isinstance(managed_identities, list), "Managed identities should be a list" @PlanetaryComputerPreparer() @recorded_by_proxy @@ -107,15 +101,11 @@ def test_02_create_and_list_ingestion_sources(self, planetarycomputer_endpoint): logger.info(f" Deleted source: {source_id}") # Create connection info with managed identity - connection_info = ManagedIdentityConnection( - container_uri=container_uri, object_id=managed_identity_object_id - ) + connection_info = ManagedIdentityConnection(container_uri=container_uri, object_id=managed_identity_object_id) # Create ingestion source (id must be a valid GUID) source_id = str(uuid.uuid4()) - ingestion_source = ManagedIdentityIngestionSource( - id=source_id, connection_info=connection_info - ) + ingestion_source = ManagedIdentityIngestionSource(id=source_id, connection_info=connection_info) created_source = client.ingestion.create_source(body=ingestion_source) logger.info("Created ingestion source:") @@ -153,9 +143,7 @@ def test_02a_create_sas_token_ingestion_source(self, planetarycomputer_endpoint) ) logger.info(f"SAS Container URI: {sas_container_uri}") - logger.info( - f"SAS Token: {sas_token[:20]}..." - ) # Log only first 20 chars for security + logger.info(f"SAS Token: {sas_token[:20]}...") # Log only first 20 chars for security # Create connection info with SAS token sas_connection_info = SharedAccessSignatureTokenConnection( @@ -188,9 +176,7 @@ def test_02a_create_sas_token_ingestion_source(self, planetarycomputer_endpoint) @PlanetaryComputerPreparer() @recorded_by_proxy - def test_03_create_ingestion_definition( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_03_create_ingestion_definition(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test creating an ingestion definition.""" logger.info("\n" + "=" * 80) logger.info("TEST: Create Ingestion Definition") @@ -207,18 +193,39 @@ def test_03_create_ingestion_definition( logger.info(f"Collection ID: {planetarycomputer_collection_id}") logger.info(f"Source Catalog URL: {source_catalog_url}") - # Delete all existing ingestions first + # Delete all existing ingestions first, cancelling active runs logger.info("Deleting all existing ingestions...") - existing_ingestions = list( - client.ingestion.list(collection_id=planetarycomputer_collection_id) - ) + existing_ingestions = list(client.ingestion.list(collection_id=planetarycomputer_collection_id)) for ingestion in existing_ingestions: - client.ingestion.begin_delete( - collection_id=planetarycomputer_collection_id, - ingestion_id=ingestion.id, - polling=True, - ) - logger.info(f" Deleted existing ingestion: {ingestion.id}") + # Cancel any active runs before deleting + try: + runs = list( + client.ingestion.list_runs( + collection_id=planetarycomputer_collection_id, + ingestion_id=ingestion.id, + ) + ) + for run in runs: + run_status = run.status if hasattr(run, "status") else run.get("status", "") + if run_status in ("Running", "Pending", "Queued"): + logger.info(f" Cancelling active run: {run.id if hasattr(run, 'id') else run.get('id')}") + try: + client.ingestion.cancel_operation( + operation_id=run.id if hasattr(run, "id") else run.get("id"), + ) + except Exception as cancel_err: + logger.warning(f" Failed to cancel run: {cancel_err}") + except Exception as list_err: + logger.warning(f" Failed to list runs for ingestion {ingestion.id}: {list_err}") + try: + client.ingestion.begin_delete( + collection_id=planetarycomputer_collection_id, + ingestion_id=ingestion.id, + polling=True, + ) + logger.info(f" Deleted existing ingestion: {ingestion.id}") + except Exception as del_err: + logger.warning(f" Failed to delete ingestion {ingestion.id}: {del_err}") # Create ingestion definition ingestion_definition = IngestionDefinition( @@ -232,15 +239,9 @@ def test_03_create_ingestion_definition( logger.info("Ingestion definition created:") logger.info(f" - Import Type: {ingestion_definition.import_type}") logger.info(f" - Display Name: {ingestion_definition.display_name}") - logger.info( - f" - Source Catalog URL: {ingestion_definition.source_catalog_url}" - ) - logger.info( - f" - Keep Original Assets: {ingestion_definition.keep_original_assets}" - ) - logger.info( - f" - Skip Existing Items: {ingestion_definition.skip_existing_items}" - ) + logger.info(f" - Source Catalog URL: {ingestion_definition.source_catalog_url}") + logger.info(f" - Keep Original Assets: {ingestion_definition.keep_original_assets}") + logger.info(f" - Skip Existing Items: {ingestion_definition.skip_existing_items}") # Create the ingestion ingestion_response = client.ingestion.create( @@ -261,9 +262,7 @@ def test_03_create_ingestion_definition( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_04_update_ingestion_definition( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_04_update_ingestion_definition(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test updating an existing ingestion definition.""" logger.info("\n" + "=" * 80) logger.info("TEST: Update Ingestion Definition") @@ -317,18 +316,12 @@ def test_04_update_ingestion_definition( # Assertions assert updated_ingestion is not None, "Updated ingestion should not be None" - assert ( - updated_ingestion.id == ingestion_id - ), "Ingestion ID should remain the same" - assert ( - updated_ingestion.display_name == "Updated Ingestion Name" - ), "Display name should be updated" + assert updated_ingestion.id == ingestion_id, "Ingestion ID should remain the same" + assert updated_ingestion.display_name == "Updated Ingestion Name", "Display name should be updated" @PlanetaryComputerPreparer() @recorded_by_proxy - def test_05_create_ingestion_run( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_05_create_ingestion_run(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test creating an ingestion run.""" logger.info("\n" + "=" * 80) logger.info("TEST: Create Ingestion Run") @@ -379,9 +372,7 @@ def test_05_create_ingestion_run( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_06_get_ingestion_run_status( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_06_get_ingestion_run_status(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test getting the status of an ingestion run.""" logger.info("\n" + "=" * 80) logger.info("TEST: Get Ingestion Run Status") @@ -439,12 +430,8 @@ def test_06_get_ingestion_run_status( # Log status history if available if run.operation.status_history: - logger.info( - f" - Status History Entries: {len(run.operation.status_history)}" - ) - for i, status_item in enumerate( - run.operation.status_history[:5] - ): # Log first 5 + logger.info(f" - Status History Entries: {len(run.operation.status_history)}") + for i, status_item in enumerate(run.operation.status_history[:5]): # Log first 5 logger.info(f" Entry {i+1}:") if hasattr(status_item, "error_code") and status_item.error_code: logger.info(f" Error Code: {status_item.error_code}") @@ -478,15 +465,9 @@ def test_07_list_operations(self, planetarycomputer_endpoint): logger.info(f" - Type: {operation.type}") if hasattr(operation, "total_items") and operation.total_items is not None: logger.info(f" - Total Items: {operation.total_items}") - if ( - hasattr(operation, "total_successful_items") - and operation.total_successful_items is not None - ): + if hasattr(operation, "total_successful_items") and operation.total_successful_items is not None: logger.info(f" - Successful: {operation.total_successful_items}") - if ( - hasattr(operation, "total_failed_items") - and operation.total_failed_items is not None - ): + if hasattr(operation, "total_failed_items") and operation.total_failed_items is not None: logger.info(f" - Failed: {operation.total_failed_items}") # Assertions @@ -495,9 +476,7 @@ def test_07_list_operations(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy - def test_08_get_operation_by_id( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_08_get_operation_by_id(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test getting a specific operation by ID.""" logger.info("\n" + "=" * 80) logger.info("TEST: Get Operation by ID") @@ -564,9 +543,7 @@ def test_09_delete_ingestion_source(self, planetarycomputer_endpoint): # Get test configuration - must use real managed identity from the environment # Use a unique container URI to avoid conflicts test_container_id = str(uuid.uuid4()) - container_uri = ( - f"https://test.blob.core.windows.net/test-container-{test_container_id}" - ) + container_uri = f"https://test.blob.core.windows.net/test-container-{test_container_id}" # Get a valid managed identity object ID from the service managed_identities = list(client.ingestion.list_managed_identities()) @@ -579,14 +556,10 @@ def test_09_delete_ingestion_source(self, planetarycomputer_endpoint): logger.info(f"Using unique container URI: {container_uri}") # Create a source to delete - connection_info = ManagedIdentityConnection( - container_uri=container_uri, object_id=managed_identity_object_id - ) + connection_info = ManagedIdentityConnection(container_uri=container_uri, object_id=managed_identity_object_id) source_id = str(uuid.uuid4()) - ingestion_source = ManagedIdentityIngestionSource( - id=source_id, connection_info=connection_info - ) + ingestion_source = ManagedIdentityIngestionSource(id=source_id, connection_info=connection_info) created_source = client.ingestion.create_source(body=ingestion_source) source_id = created_source.id @@ -606,15 +579,11 @@ def test_09_delete_ingestion_source(self, planetarycomputer_endpoint): from devtools_testutils import is_live if is_live(): - assert ( - source_id not in source_ids - ), "Deleted source should not be in the list" + assert source_id not in source_ids, "Deleted source should not be in the list" @PlanetaryComputerPreparer() @recorded_by_proxy - def test_10_cancel_operation( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_10_cancel_operation(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test canceling an operation.""" logger.info("\n" + "=" * 80) logger.info("TEST: Cancel Operation") @@ -660,9 +629,7 @@ def test_10_cancel_operation( # Try to cancel the operation try: client.ingestion.cancel_operation(operation_id) - logger.info( - f"Successfully requested cancellation for operation: {operation_id}" - ) + logger.info(f"Successfully requested cancellation for operation: {operation_id}") cancel_succeeded = True except HttpResponseError as e: logger.info(f"Failed to cancel operation {operation_id}: {e.message}") @@ -677,7 +644,11 @@ def test_10_cancel_operation( @PlanetaryComputerPreparer() @recorded_by_proxy def test_11_cancel_all_operations(self, planetarycomputer_endpoint): - """Test canceling all operations.""" + """Test canceling all operations. + + WARNING: cancel_all_operations() cancels ALL pending/running operations + across the entire GeoCatalog instance, not scoped to a specific collection. + """ logger.info("\n" + "=" * 80) logger.info("TEST: Cancel All Operations") logger.info("=" * 80) @@ -721,18 +692,12 @@ def test_12_get_source(self, planetarycomputer_endpoint): # Create a source test_container_id = str(uuid.uuid4()) - container_uri = ( - f"https://test.blob.core.windows.net/test-container-{test_container_id}" - ) + container_uri = f"https://test.blob.core.windows.net/test-container-{test_container_id}" - connection_info = ManagedIdentityConnection( - container_uri=container_uri, object_id=managed_identity_object_id - ) + connection_info = ManagedIdentityConnection(container_uri=container_uri, object_id=managed_identity_object_id) source_id = str(uuid.uuid4()) - ingestion_source = ManagedIdentityIngestionSource( - id=source_id, connection_info=connection_info - ) + ingestion_source = ManagedIdentityIngestionSource(id=source_id, connection_info=connection_info) created_source = client.ingestion.create_source(body=ingestion_source) logger.info(f"Created source with ID: {created_source.id}") @@ -764,52 +729,38 @@ def test_13_replace_source(self, planetarycomputer_endpoint): # Generate test SAS token data test_container_id = str(uuid.uuid4()) - sas_container_uri = ( - f"https://test.blob.core.windows.net/test-container-{test_container_id}" - ) + sas_container_uri = f"https://test.blob.core.windows.net/test-container-{test_container_id}" # Generate a valid SAS token format with required fields start_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") - expiry_time = (datetime.now(timezone.utc) + timedelta(days=7)).strftime( - "%Y-%m-%dT%H:%M:%SZ" - ) + expiry_time = (datetime.now(timezone.utc) + timedelta(days=7)).strftime("%Y-%m-%dT%H:%M:%SZ") sas_token = f"sp=rl&st={start_time}&se={expiry_time}&sv=2023-01-03&sr=c&sig=InitialRandomSignature123456" # Step 1: Create initial source using create_source (like create_sas_token_ingestion_source in sample) - logger.info( - "Step 1: Creating initial SAS token ingestion source with create_source..." - ) + logger.info("Step 1: Creating initial SAS token ingestion source with create_source...") sas_connection_info = SharedAccessSignatureTokenConnection( container_uri=sas_container_uri, shared_access_signature_token=sas_token ) - sas_ingestion_source = SharedAccessSignatureTokenIngestionSource( - connection_info=sas_connection_info - ) + sas_ingestion_source = SharedAccessSignatureTokenIngestionSource(connection_info=sas_connection_info) created_source = client.ingestion.create_source(body=sas_ingestion_source) source_id = created_source.id logger.info(f"Created SAS token ingestion source: {source_id}") # Step 2: First call to create_or_replace_source - replaces the existing source with original token - logger.info( - f"Step 2: First call to create_or_replace_source with existing source ID: {source_id}" - ) + logger.info(f"Step 2: First call to create_or_replace_source with existing source ID: {source_id}") # Update the ingestion_source object with the actual ID sas_ingestion_source_for_replace = SharedAccessSignatureTokenIngestionSource( id=source_id, connection_info=sas_connection_info ) - first_result = client.ingestion.replace_source( - id=source_id, body=sas_ingestion_source_for_replace - ) + first_result = client.ingestion.replace_source(id=source_id, body=sas_ingestion_source_for_replace) logger.info(f"First call result: {first_result.id}") # Step 3: Second call to create_or_replace_source - replaces again with updated token - logger.info( - "Step 3: Second call to create_or_replace_source with updated SAS token" - ) + logger.info("Step 3: Second call to create_or_replace_source with updated SAS token") updated_token = f"sp=rl&st={start_time}&se={expiry_time}&sv=2023-01-03&sr=c&sig=UpdatedRandomSignature123456" updated_connection_info = SharedAccessSignatureTokenConnection( @@ -819,9 +770,7 @@ def test_13_replace_source(self, planetarycomputer_endpoint): id=source_id, connection_info=updated_connection_info ) - second_result = client.ingestion.replace_source( - id=source_id, body=updated_ingestion_source - ) + second_result = client.ingestion.replace_source(id=source_id, body=updated_ingestion_source) logger.info("Second create_or_replace result (replacement):") logger.info(f" - Response type: {type(second_result)}") @@ -832,9 +781,7 @@ def test_13_replace_source(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy - def test_14_lists_ingestions( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_14_lists_ingestions(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test listing ingestions for a collection.""" logger.info("\n" + "=" * 80) logger.info("TEST: Lists Ingestions") @@ -857,16 +804,12 @@ def test_14_lists_ingestions( skip_existing_items=True, ) - client.ingestion.create( - collection_id=planetarycomputer_collection_id, body=ingestion_definition - ) + client.ingestion.create(collection_id=planetarycomputer_collection_id, body=ingestion_definition) logger.info("Created ingestion") # List ingestions - ingestions = list( - client.ingestion.list(collection_id=planetarycomputer_collection_id) - ) + ingestions = list(client.ingestion.list(collection_id=planetarycomputer_collection_id)) logger.info(f"Found {len(ingestions)} ingestions") for i, ingestion in enumerate(ingestions[:5]): @@ -877,9 +820,7 @@ def test_14_lists_ingestions( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_15_get_ingestion( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_15_get_ingestion(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test getting a specific ingestion by ID.""" logger.info("\n" + "=" * 80) logger.info("TEST: Get Ingestion") @@ -927,9 +868,7 @@ def test_15_get_ingestion( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_16_list_runs( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_16_list_runs(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test listing runs for an ingestion.""" logger.info("\n" + "=" * 80) logger.info("TEST: List Runs") @@ -973,9 +912,7 @@ def test_16_list_runs( # List runs runs = list( - client.ingestion.list_runs( - collection_id=planetarycomputer_collection_id, ingestion_id=ingestion_id - ) + client.ingestion.list_runs(collection_id=planetarycomputer_collection_id, ingestion_id=ingestion_id) ) logger.info(f"Found {len(runs)} runs") @@ -987,9 +924,7 @@ def test_16_list_runs( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_17_get_operation( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_17_get_operation(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test getting a specific operation (duplicate of test_08 but for completeness).""" logger.info("\n" + "=" * 80) logger.info("TEST: Get Operation (Additional Coverage)") @@ -1016,10 +951,7 @@ def test_17_get_operation( logger.info(f" - Type: {operation.type}") if hasattr(operation, "total_items") and operation.total_items is not None: logger.info(f" - Total Items: {operation.total_items}") - if ( - hasattr(operation, "total_successful_items") - and operation.total_successful_items is not None - ): + if hasattr(operation, "total_successful_items") and operation.total_successful_items is not None: logger.info(f" - Successful Items: {operation.total_successful_items}") @PlanetaryComputerPreparer() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_01_ingestion_management_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_01_ingestion_management_async.py index c0954cc878ed..8982a86507b8 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_01_ingestion_management_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_01_ingestion_management_async.py @@ -37,15 +37,11 @@ log_file = log_dir / "ingestion_test_results.log" file_handler = logging.FileHandler(log_file, mode="w") file_handler.setLevel(logging.INFO) -file_handler.setFormatter( - logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") -) +file_handler.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")) logger.addHandler(file_handler) -class TestPlanetaryComputerIngestionManagementAsync( - PlanetaryComputerProClientTestBaseAsync -): +class TestPlanetaryComputerIngestionManagementAsync(PlanetaryComputerProClientTestBaseAsync): """Test class for Planetary Computer ingestion management operations.""" @PlanetaryComputerPreparer() @@ -68,9 +64,7 @@ async def test_01_list_managed_identities(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_02_create_and_list_ingestion_sources( - self, planetarycomputer_endpoint - ): + async def test_02_create_and_list_ingestion_sources(self, planetarycomputer_endpoint): """Test creating and listing ingestion sources.""" logger.info("\n" + "=" * 80) logger.info("TEST: Create and List Ingestion Sources") @@ -104,15 +98,11 @@ async def test_02_create_and_list_ingestion_sources( logger.info(f" Deleted source: {source_id}") # Create connection info with managed identity - connection_info = ManagedIdentityConnection( - container_uri=container_uri, object_id=managed_identity_object_id - ) + connection_info = ManagedIdentityConnection(container_uri=container_uri, object_id=managed_identity_object_id) # Create ingestion source (id must be a valid GUID) source_id = str(uuid.uuid4()) - ingestion_source = ManagedIdentityIngestionSource( - id=source_id, connection_info=connection_info - ) + ingestion_source = ManagedIdentityIngestionSource(id=source_id, connection_info=connection_info) created_source = await client.ingestion.create_source(body=ingestion_source) logger.info("Created ingestion source:") @@ -134,9 +124,7 @@ async def test_02_create_and_list_ingestion_sources( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_02a_create_sas_token_ingestion_source( - self, planetarycomputer_endpoint - ): + async def test_02a_create_sas_token_ingestion_source(self, planetarycomputer_endpoint): """Test creating a SAS token ingestion source.""" logger.info("\n" + "=" * 80) logger.info("TEST: Create SAS Token Ingestion Source") @@ -156,9 +144,7 @@ async def test_02a_create_sas_token_ingestion_source( ) logger.info(f"SAS Container URI: {sas_container_uri}") - logger.info( - f"SAS Token: {sas_token[:20]}..." - ) # Log only first 20 chars for security + logger.info(f"SAS Token: {sas_token[:20]}...") # Log only first 20 chars for security # Create connection info with SAS token sas_connection_info = SharedAccessSignatureTokenConnection( @@ -172,9 +158,7 @@ async def test_02a_create_sas_token_ingestion_source( ) # Register the SAS token source - created_sas_source = await client.ingestion.create_source( - body=sas_ingestion_source - ) + created_sas_source = await client.ingestion.create_source(body=sas_ingestion_source) logger.info("Created SAS token ingestion source:") logger.info(f" - ID: {created_sas_source.id}") @@ -195,9 +179,7 @@ async def test_02a_create_sas_token_ingestion_source( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_03_create_ingestion_definition( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_03_create_ingestion_definition(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test creating an ingestion definition.""" logger.info("\n" + "=" * 80) logger.info("TEST: Create Ingestion Definition") @@ -214,17 +196,35 @@ async def test_03_create_ingestion_definition( logger.info(f"Collection ID: {planetarycomputer_collection_id}") logger.info(f"Source Catalog URL: {source_catalog_url}") - # Delete all existing ingestions first + # Delete all existing ingestions first, cancelling active runs logger.info("Deleting all existing ingestions...") - async for ingestion in client.ingestion.list( - collection_id=planetarycomputer_collection_id - ): - await client.ingestion.begin_delete( - collection_id=planetarycomputer_collection_id, - ingestion_id=ingestion.id, - polling=True, - ) - logger.info(f" Deleted existing ingestion: {ingestion.id}") + async for ingestion in client.ingestion.list(collection_id=planetarycomputer_collection_id): + # Cancel any active runs before deleting + try: + async for run in client.ingestion.list_runs( + collection_id=planetarycomputer_collection_id, + ingestion_id=ingestion.id, + ): + run_status = run.status if hasattr(run, "status") else run.get("status", "") + if run_status in ("Running", "Pending", "Queued"): + logger.info(f" Cancelling active run: {run.id if hasattr(run, 'id') else run.get('id')}") + try: + await client.ingestion.cancel_operation( + operation_id=run.id if hasattr(run, "id") else run.get("id"), + ) + except Exception as cancel_err: + logger.warning(f" Failed to cancel run: {cancel_err}") + except Exception as list_err: + logger.warning(f" Failed to list runs for ingestion {ingestion.id}: {list_err}") + try: + await client.ingestion.begin_delete( + collection_id=planetarycomputer_collection_id, + ingestion_id=ingestion.id, + polling=True, + ) + logger.info(f" Deleted existing ingestion: {ingestion.id}") + except Exception as del_err: + logger.warning(f" Failed to delete ingestion {ingestion.id}: {del_err}") # Create ingestion definition ingestion_definition = IngestionDefinition( @@ -238,15 +238,9 @@ async def test_03_create_ingestion_definition( logger.info("Ingestion definition created:") logger.info(f" - Import Type: {ingestion_definition.import_type}") logger.info(f" - Display Name: {ingestion_definition.display_name}") - logger.info( - f" - Source Catalog URL: {ingestion_definition.source_catalog_url}" - ) - logger.info( - f" - Keep Original Assets: {ingestion_definition.keep_original_assets}" - ) - logger.info( - f" - Skip Existing Items: {ingestion_definition.skip_existing_items}" - ) + logger.info(f" - Source Catalog URL: {ingestion_definition.source_catalog_url}") + logger.info(f" - Keep Original Assets: {ingestion_definition.keep_original_assets}") + logger.info(f" - Skip Existing Items: {ingestion_definition.skip_existing_items}") # Create the ingestion ingestion_response = await client.ingestion.create( @@ -269,9 +263,7 @@ async def test_03_create_ingestion_definition( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_04_update_ingestion_definition( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_04_update_ingestion_definition(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test updating an existing ingestion definition.""" logger.info("\n" + "=" * 80) logger.info("TEST: Update Ingestion Definition") @@ -325,20 +317,14 @@ async def test_04_update_ingestion_definition( # Assertions assert updated_ingestion is not None, "Updated ingestion should not be None" - assert ( - updated_ingestion.id == ingestion_id - ), "Ingestion ID should remain the same" - assert ( - updated_ingestion.display_name == "Updated Ingestion Name" - ), "Display name should be updated" + assert updated_ingestion.id == ingestion_id, "Ingestion ID should remain the same" + assert updated_ingestion.display_name == "Updated Ingestion Name", "Display name should be updated" await self.close_client() @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_05_create_ingestion_run( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_05_create_ingestion_run(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test creating an ingestion run.""" logger.info("\n" + "=" * 80) logger.info("TEST: Create Ingestion Run") @@ -391,9 +377,7 @@ async def test_05_create_ingestion_run( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_06_get_ingestion_run_status( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_06_get_ingestion_run_status(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test getting the status of an ingestion run.""" logger.info("\n" + "=" * 80) logger.info("TEST: Get Ingestion Run Status") @@ -451,12 +435,8 @@ async def test_06_get_ingestion_run_status( # Log status history if available if run.operation.status_history: - logger.info( - f" - Status History Entries: {len(run.operation.status_history)}" - ) - for i, status_item in enumerate( - run.operation.status_history[:5] - ): # Log first 5 + logger.info(f" - Status History Entries: {len(run.operation.status_history)}") + for i, status_item in enumerate(run.operation.status_history[:5]): # Log first 5 logger.info(f" Entry {i+1}:") if hasattr(status_item, "error_code") and status_item.error_code: logger.info(f" Error Code: {status_item.error_code}") @@ -489,24 +469,16 @@ async def test_07_list_operations(self, planetarycomputer_endpoint): logger.info(f" - Type: {operation.type}") if hasattr(operation, "total_items") and operation.total_items is not None: logger.info(f" - Total Items: {operation.total_items}") - if ( - hasattr(operation, "total_successful_items") - and operation.total_successful_items is not None - ): + if hasattr(operation, "total_successful_items") and operation.total_successful_items is not None: logger.info(f" - Successful: {operation.total_successful_items}") - if ( - hasattr(operation, "total_failed_items") - and operation.total_failed_items is not None - ): + if hasattr(operation, "total_failed_items") and operation.total_failed_items is not None: logger.info(f" - Failed: {operation.total_failed_items}") await self.close_client() @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_08_get_operation_by_id( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_08_get_operation_by_id(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test getting a specific operation by ID.""" logger.info("\n" + "=" * 80) logger.info("TEST: Get Operation by ID") @@ -575,9 +547,7 @@ async def test_09_delete_ingestion_source(self, planetarycomputer_endpoint): # Get test configuration - must use real managed identity from the environment # Use a unique container URI to avoid conflicts test_container_id = str(uuid.uuid4()) - container_uri = ( - f"https://test.blob.core.windows.net/test-container-{test_container_id}" - ) + container_uri = f"https://test.blob.core.windows.net/test-container-{test_container_id}" # Get a valid managed identity object ID from the service managed_identity_object_id = None @@ -592,14 +562,10 @@ async def test_09_delete_ingestion_source(self, planetarycomputer_endpoint): logger.info(f"Using unique container URI: {container_uri}") # Create a source to delete - connection_info = ManagedIdentityConnection( - container_uri=container_uri, object_id=managed_identity_object_id - ) + connection_info = ManagedIdentityConnection(container_uri=container_uri, object_id=managed_identity_object_id) source_id = str(uuid.uuid4()) - ingestion_source = ManagedIdentityIngestionSource( - id=source_id, connection_info=connection_info - ) + ingestion_source = ManagedIdentityIngestionSource(id=source_id, connection_info=connection_info) created_source = await client.ingestion.create_source(body=ingestion_source) source_id = created_source.id @@ -618,17 +584,13 @@ async def test_09_delete_ingestion_source(self, planetarycomputer_endpoint): from devtools_testutils import is_live if is_live(): - assert ( - source_id not in source_ids - ), "Deleted source should not be in the list" + assert source_id not in source_ids, "Deleted source should not be in the list" await self.close_client() @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_10_cancel_operation( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_10_cancel_operation(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test canceling an operation.""" logger.info("\n" + "=" * 80) logger.info("TEST: Cancel Operation") @@ -674,9 +636,7 @@ async def test_10_cancel_operation( # Try to cancel the operation try: await client.ingestion.cancel_operation(operation_id) - logger.info( - f"Successfully requested cancellation for operation: {operation_id}" - ) + logger.info(f"Successfully requested cancellation for operation: {operation_id}") cancel_succeeded = True except HttpResponseError as e: logger.info(f"Failed to cancel operation {operation_id}: {e.message}") @@ -693,7 +653,11 @@ async def test_10_cancel_operation( @PlanetaryComputerPreparer() @recorded_by_proxy_async async def test_11_cancel_all_operations(self, planetarycomputer_endpoint): - """Test canceling all operations.""" + """Test canceling all operations. + + WARNING: cancel_all_operations() cancels ALL pending/running operations + across the entire GeoCatalog instance, not scoped to a specific collection. + """ logger.info("\n" + "=" * 80) logger.info("TEST: Cancel All Operations") logger.info("=" * 80) @@ -741,18 +705,12 @@ async def test_12_get_source(self, planetarycomputer_endpoint): # Create a source test_container_id = str(uuid.uuid4()) - container_uri = ( - f"https://test.blob.core.windows.net/test-container-{test_container_id}" - ) + container_uri = f"https://test.blob.core.windows.net/test-container-{test_container_id}" - connection_info = ManagedIdentityConnection( - container_uri=container_uri, object_id=managed_identity_object_id - ) + connection_info = ManagedIdentityConnection(container_uri=container_uri, object_id=managed_identity_object_id) source_id = str(uuid.uuid4()) - ingestion_source = ManagedIdentityIngestionSource( - id=source_id, connection_info=connection_info - ) + ingestion_source = ManagedIdentityIngestionSource(id=source_id, connection_info=connection_info) created_source = await client.ingestion.create_source(body=ingestion_source) logger.info(f"Created source with ID: {created_source.id}") @@ -786,52 +744,38 @@ async def test_13_replace_source(self, planetarycomputer_endpoint): # Generate test SAS token data test_container_id = str(uuid.uuid4()) - sas_container_uri = ( - f"https://test.blob.core.windows.net/test-container-{test_container_id}" - ) + sas_container_uri = f"https://test.blob.core.windows.net/test-container-{test_container_id}" # Generate a valid SAS token format with required fields start_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") - expiry_time = (datetime.now(timezone.utc) + timedelta(days=7)).strftime( - "%Y-%m-%dT%H:%M:%SZ" - ) + expiry_time = (datetime.now(timezone.utc) + timedelta(days=7)).strftime("%Y-%m-%dT%H:%M:%SZ") sas_token = f"sp=rl&st={start_time}&se={expiry_time}&sv=2023-01-03&sr=c&sig=InitialRandomSignature123456" # Step 1: Create initial source using create_source (like create_sas_token_ingestion_source in sample) - logger.info( - "Step 1: Creating initial SAS token ingestion source with create_source..." - ) + logger.info("Step 1: Creating initial SAS token ingestion source with create_source...") sas_connection_info = SharedAccessSignatureTokenConnection( container_uri=sas_container_uri, shared_access_signature_token=sas_token ) - sas_ingestion_source = SharedAccessSignatureTokenIngestionSource( - connection_info=sas_connection_info - ) + sas_ingestion_source = SharedAccessSignatureTokenIngestionSource(connection_info=sas_connection_info) created_source = await client.ingestion.create_source(body=sas_ingestion_source) source_id = created_source.id logger.info(f"Created SAS token ingestion source: {source_id}") # Step 2: First call to create_or_replace_source - replaces the existing source with original token - logger.info( - f"Step 2: First call to create_or_replace_source with existing source ID: {source_id}" - ) + logger.info(f"Step 2: First call to create_or_replace_source with existing source ID: {source_id}") # Update the ingestion_source object with the actual ID sas_ingestion_source_for_replace = SharedAccessSignatureTokenIngestionSource( id=source_id, connection_info=sas_connection_info ) - first_result = await client.ingestion.replace_source( - id=source_id, body=sas_ingestion_source_for_replace - ) + first_result = await client.ingestion.replace_source(id=source_id, body=sas_ingestion_source_for_replace) logger.info(f"First call result: {first_result.id}") # Step 3: Second call to create_or_replace_source - replaces again with updated token - logger.info( - "Step 3: Second call to create_or_replace_source with updated SAS token" - ) + logger.info("Step 3: Second call to create_or_replace_source with updated SAS token") updated_token = f"sp=rl&st={start_time}&se={expiry_time}&sv=2023-01-03&sr=c&sig=UpdatedRandomSignature123456" updated_connection_info = SharedAccessSignatureTokenConnection( @@ -841,9 +785,7 @@ async def test_13_replace_source(self, planetarycomputer_endpoint): id=source_id, connection_info=updated_connection_info ) - second_result = await client.ingestion.replace_source( - id=source_id, body=updated_ingestion_source - ) + second_result = await client.ingestion.replace_source(id=source_id, body=updated_ingestion_source) logger.info("Second create_or_replace result (replacement):") logger.info(f" - Response type: {type(second_result)}") @@ -856,9 +798,7 @@ async def test_13_replace_source(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_14_lists_ingestions( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_14_lists_ingestions(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test listing ingestions for a collection.""" logger.info("\n" + "=" * 80) logger.info("TEST: Lists Ingestions") @@ -881,16 +821,12 @@ async def test_14_lists_ingestions( skip_existing_items=True, ) - await client.ingestion.create( - collection_id=planetarycomputer_collection_id, body=ingestion_definition - ) + await client.ingestion.create(collection_id=planetarycomputer_collection_id, body=ingestion_definition) logger.info("Created ingestion") # List ingestions - async for ingestion in client.ingestion.list( - collection_id=planetarycomputer_collection_id - ): + async for ingestion in client.ingestion.list(collection_id=planetarycomputer_collection_id): logger.info(f" Ingestion:") logger.info(f" - ID: {ingestion.id}") logger.info(f" - Display Name: {ingestion.display_name}") @@ -900,9 +836,7 @@ async def test_14_lists_ingestions( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_15_get_ingestion( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_15_get_ingestion(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test getting a specific ingestion by ID.""" logger.info("\n" + "=" * 80) logger.info("TEST: Get Ingestion") @@ -952,9 +886,7 @@ async def test_15_get_ingestion( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_16_list_runs( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_16_list_runs(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test listing runs for an ingestion.""" logger.info("\n" + "=" * 80) logger.info("TEST: List Runs") @@ -1009,9 +941,7 @@ async def test_16_list_runs( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_17_get_operation( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_17_get_operation(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test getting a specific operation (duplicate of test_08 but for completeness).""" logger.info("\n" + "=" * 80) logger.info("TEST: Get Operation (Additional Coverage)") @@ -1040,19 +970,14 @@ async def test_17_get_operation( logger.info(f" - Type: {operation.type}") if hasattr(operation, "total_items") and operation.total_items is not None: logger.info(f" - Total Items: {operation.total_items}") - if ( - hasattr(operation, "total_successful_items") - and operation.total_successful_items is not None - ): + if hasattr(operation, "total_successful_items") and operation.total_successful_items is not None: logger.info(f" - Successful Items: {operation.total_successful_items}") await self.close_client() @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_18_cancel_all_operations_additional( - self, planetarycomputer_endpoint - ): + async def test_18_cancel_all_operations_additional(self, planetarycomputer_endpoint): """Test cancel_all_operations (duplicate of test_11 but for completeness).""" logger.info("\n" + "=" * 80) logger.info("TEST: Cancel All Operations (Additional Coverage)") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification.py index 7b521f0c5470..0da04fde6043 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification.py @@ -37,9 +37,7 @@ log_file = log_dir / "stac_specification_test_results.log" file_handler = logging.FileHandler(log_file, mode="w") file_handler.setLevel(logging.INFO) -file_formatter = logging.Formatter( - "%(asctime)s - %(name)s - %(levelname)s - %(message)s" -) +file_formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") file_handler.setFormatter(file_formatter) logger.addHandler(file_handler) @@ -60,12 +58,8 @@ def test_01_get_conformance_class(self, planetarycomputer_endpoint): # Validate conformance response assert conformance is not None, "Conformance should not be None" - assert hasattr( - conformance, "conforms_to" - ), "Conformance should have conforms_to property" - assert ( - len(conformance.conforms_to) > 0 - ), "Conformance should have at least one URI" + assert hasattr(conformance, "conforms_to"), "Conformance should have conforms_to property" + assert len(conformance.conforms_to) > 0, "Conformance should have at least one URI" # Based on log: Retrieved 15 conformance classes assert ( @@ -114,15 +108,11 @@ def test_03_list_collections(self, planetarycomputer_endpoint, planetarycomputer # Validate collections response assert collections is not None, "Collections should not be None" - assert hasattr( - collections, "collections" - ), "Response should have collections property" + assert hasattr(collections, "collections"), "Response should have collections property" assert len(collections.collections) > 0, "Should have at least one collection" # Based on log: Retrieved 10 collections - assert ( - len(collections.collections) >= 5 - ), f"Expected at least 5 collections, got {len(collections.collections)}" + assert len(collections.collections) >= 5, f"Expected at least 5 collections, got {len(collections.collections)}" logger.info(f"Retrieved {len(collections.collections)} collections") @@ -145,16 +135,12 @@ def test_03_list_collections(self, planetarycomputer_endpoint, planetarycomputer # Validate collection structure first_collection = collections.collections[0] assert hasattr(first_collection, "id"), "Collection should have id" - assert ( - first_collection.id is not None and len(first_collection.id) > 0 - ), "Collection ID should not be empty" + assert first_collection.id is not None and len(first_collection.id) > 0, "Collection ID should not be empty" assert hasattr(first_collection, "extent"), "Collection should have extent" # Validate that the collection is in the list collection_ids = [c.id for c in collections.collections] - assert ( - collection_id in collection_ids - ), f"{collection_id} collection should be present" + assert collection_id in collection_ids, f"{collection_id} collection should be present" @PlanetaryComputerPreparer() @recorded_by_proxy @@ -177,9 +163,7 @@ def test_04_get_collection(self, planetarycomputer_endpoint, planetarycomputer_c # Validate title is present assert hasattr(collection, "title"), "Collection should have title" - assert ( - collection.title is not None and len(collection.title) > 0 - ), "Collection title should not be empty" + assert collection.title is not None and len(collection.title) > 0, "Collection title should not be empty" logger.info(f"Retrieved collection: {collection.id}") if hasattr(collection, "title") and collection.title: @@ -197,25 +181,17 @@ def test_04_get_collection(self, planetarycomputer_endpoint, planetarycomputer_c logger.info(" Extent:") if hasattr(collection.extent, "spatial") and collection.extent.spatial: # Log available attributes instead of assuming bbox exists - spatial_attrs = [ - attr - for attr in dir(collection.extent.spatial) - if not attr.startswith("_") - ] + spatial_attrs = [attr for attr in dir(collection.extent.spatial) if not attr.startswith("_")] logger.info(f" Spatial attributes: {spatial_attrs}") # Try to access bbox if it exists if hasattr(collection.extent.spatial, "bbox"): logger.info(f" Spatial bbox: {collection.extent.spatial.bbox}") if hasattr(collection.extent, "temporal") and collection.extent.temporal: - logger.info( - f" Temporal interval: {collection.extent.temporal.interval}" - ) + logger.info(f" Temporal interval: {collection.extent.temporal.interval}") # Validate links assert hasattr(collection, "links"), "Collection should have links" - assert ( - collection.links is not None and len(collection.links) > 0 - ), "Collection should have at least one link" + assert collection.links is not None and len(collection.links) > 0, "Collection should have at least one link" if hasattr(collection, "links") and collection.links: logger.info(f" Links count: {len(collection.links)}") @@ -256,11 +232,7 @@ def test_05_search_items_with_spatial_filter(self, planetarycomputer_endpoint, p ], }, date_time="2021-01-01T00:00:00Z/2022-12-31T00:00:00Z", - sort_by=[ - StacSortExtension( - field="datetime", direction=StacSearchSortingDirection.DESC - ) - ], + sort_by=[StacSortExtension(field="datetime", direction=StacSearchSortingDirection.DESC)], limit=50, ) @@ -296,9 +268,7 @@ def test_05_search_items_with_spatial_filter(self, planetarycomputer_endpoint, p first_item = search_response.features[0] assert hasattr(first_item, "id"), "Item should have id" assert hasattr(first_item, "collection"), "Item should have collection" - assert ( - first_item.collection == collection_id - ), "Item collection should match search collection" + assert first_item.collection == collection_id, "Item collection should match search collection" @PlanetaryComputerPreparer() @recorded_by_proxy @@ -310,22 +280,16 @@ def test_06_get_item_collection(self, planetarycomputer_endpoint, planetarycompu client = self.create_client(endpoint=planetarycomputer_endpoint) collection_id = planetarycomputer_collection_id - items_response = client.stac.get_item_collection( - collection_id=collection_id, limit=10 - ) + items_response = client.stac.get_item_collection(collection_id=collection_id, limit=10) # Validate response assert items_response is not None, "Items response should not be None" assert hasattr(items_response, "features"), "Response should have features" # Based on log: Retrieved 10 items with 4 asset types each - assert ( - len(items_response.features) >= 5 - ), f"Expected at least 5 items, got {len(items_response.features)}" + assert len(items_response.features) >= 5, f"Expected at least 5 items, got {len(items_response.features)}" - logger.info( - f"Retrieved {len(items_response.features)} items from collection {collection_id}" - ) + logger.info(f"Retrieved {len(items_response.features)} items from collection {collection_id}") # Log first few items for i, item in enumerate(items_response.features[:5]): @@ -341,15 +305,11 @@ def test_06_get_item_collection(self, planetarycomputer_endpoint, planetarycompu first_item = items_response.features[0] assert hasattr(first_item, "assets"), "Item should have assets" asset_keys = list(first_item.assets.keys()) - assert ( - len(asset_keys) >= 2 - ), f"Expected at least 2 assets, got {len(asset_keys)}" + assert len(asset_keys) >= 2, f"Expected at least 2 assets, got {len(asset_keys)}" # Check for common assets common_assets = ["image", "tilejson", "thumbnail", "rendered_preview"] found_assets = [asset for asset in common_assets if asset in asset_keys] - assert ( - len(found_assets) >= 1 - ), f"Expected at least one common asset type, found: {found_assets}" + assert len(found_assets) >= 1, f"Expected at least one common asset type, found: {found_assets}" @PlanetaryComputerPreparer() @recorded_by_proxy @@ -373,18 +333,14 @@ def test_07_get_collection_queryables(self, planetarycomputer_endpoint, planetar properties = queryables["properties"] # Based on log: Found 4 queryable properties (id, datetime, geometry, eo:cloud_cover) - assert ( - len(properties) >= 3 - ), f"Expected at least 3 queryable properties, got {len(properties)}" + assert len(properties) >= 3, f"Expected at least 3 queryable properties, got {len(properties)}" logger.info(f"Found {len(properties)} queryable properties") # Validate common STAC queryables are present common_queryables = ["id", "datetime", "geometry"] for queryable in common_queryables: - assert ( - queryable in properties - ), f"Expected queryable '{queryable}' not found" + assert queryable in properties, f"Expected queryable '{queryable}' not found" # Log first 15 queryable properties for i, (prop_name, prop_info) in enumerate(list(properties.items())[:15]): @@ -441,9 +397,7 @@ def test_08_search_items_with_temporal_filter(self, planetarycomputer_endpoint, # Properties is a dictionary properties = item.properties if isinstance(properties, dict): - assert ( - "datetime" in properties - ), "Item should have datetime property in dict" + assert "datetime" in properties, "Item should have datetime property in dict" logger.info(f" Datetime: {properties['datetime']}") elif hasattr(properties, "__getitem__"): # It's a dict-like object @@ -451,9 +405,7 @@ def test_08_search_items_with_temporal_filter(self, planetarycomputer_endpoint, logger.info(f" Datetime: {properties['datetime']}") else: # It's an object with attributes - assert hasattr( - properties, "datetime" - ), "Item should have datetime attribute" + assert hasattr(properties, "datetime"), "Item should have datetime attribute" logger.info(f" Datetime: {properties.datetime}") @PlanetaryComputerPreparer() @@ -470,29 +422,21 @@ def test_09_search_items_with_sorting(self, planetarycomputer_endpoint, planetar # Search with descending sort by datetime search_params_desc = StacSearchParameters( collections=[collection_id], - sort_by=[ - StacSortExtension( - field="datetime", direction=StacSearchSortingDirection.DESC - ) - ], + sort_by=[StacSortExtension(field="datetime", direction=StacSearchSortingDirection.DESC)], limit=5, ) search_response_desc = client.stac.search(body=search_params_desc) assert search_response_desc is not None, "Search response should not be None" - assert hasattr( - search_response_desc, "features" - ), "Response should have features" + assert hasattr(search_response_desc, "features"), "Response should have features" # Based on log: DESC sorting returned 5 items assert ( len(search_response_desc.features) >= 3 ), f"Expected at least 3 items in DESC sort, got {len(search_response_desc.features)}" - logger.info( - f"Search with DESC sorting returned {len(search_response_desc.features)} items" - ) + logger.info(f"Search with DESC sorting returned {len(search_response_desc.features)} items") # Log sorted results for i, item in enumerate(search_response_desc.features): @@ -504,29 +448,21 @@ def test_09_search_items_with_sorting(self, planetarycomputer_endpoint, planetar # Search with ascending sort search_params_asc = StacSearchParameters( collections=[collection_id], - sort_by=[ - StacSortExtension( - field="datetime", direction=StacSearchSortingDirection.ASC - ) - ], + sort_by=[StacSortExtension(field="datetime", direction=StacSearchSortingDirection.ASC)], limit=5, ) search_response_asc = client.stac.search(body=search_params_asc) assert search_response_asc is not None, "ASC search response should not be None" - assert hasattr( - search_response_asc, "features" - ), "ASC response should have features" + assert hasattr(search_response_asc, "features"), "ASC response should have features" # Based on log: ASC sorting returned 5 items assert ( len(search_response_asc.features) >= 3 ), f"Expected at least 3 items in ASC sort, got {len(search_response_asc.features)}" - logger.info( - f"\nSearch with ASC sorting returned {len(search_response_asc.features)} items" - ) + logger.info(f"\nSearch with ASC sorting returned {len(search_response_asc.features)} items") for i, item in enumerate(search_response_asc.features): logger.info(f"Item {i+1}: {item.id}") @@ -601,9 +537,7 @@ def test_10_create_stac_item(self, planetarycomputer_endpoint, planetarycomputer "title": "RGBIR COG tile", } }, - "stac_extensions": [ - "https://stac-extensions.github.io/projection/v1.0.0/schema.json" - ], + "stac_extensions": ["https://stac-extensions.github.io/projection/v1.0.0/schema.json"], } ) @@ -611,9 +545,7 @@ def test_10_create_stac_item(self, planetarycomputer_endpoint, planetarycomputer # Check if item already exists and delete if necessary try: - items_response = client.stac.get_item_collection( - collection_id=collection_id - ) + items_response = client.stac.get_item_collection(collection_id=collection_id) if any(item.id == item_id for item in items_response.features): logger.info(f"Item {item_id} already exists. Deleting it first...") delete_poller = client.stac.begin_delete_item( @@ -626,33 +558,23 @@ def test_10_create_stac_item(self, planetarycomputer_endpoint, planetarycomputer # Create the item try: - create_poller = client.stac.begin_create_item( - collection_id=collection_id, body=stac_item, polling=True - ) + create_poller = client.stac.begin_create_item(collection_id=collection_id, body=stac_item, polling=True) create_result = create_poller.result() logger.info(f"Successfully created item {item_id}") logger.info(f"Create operation result: {create_result}") # Verify the item was created - created_item = client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + created_item = client.stac.get_item(collection_id=collection_id, item_id=item_id) assert created_item is not None, "Created item should be retrievable" assert created_item.id == item_id, "Created item ID should match" # Validate structure of created item - assert hasattr( - created_item, "geometry" - ), "Created item should have geometry" - assert hasattr( - created_item, "properties" - ), "Created item should have properties" + assert hasattr(created_item, "geometry"), "Created item should have geometry" + assert hasattr(created_item, "properties"), "Created item should have properties" assert hasattr(created_item, "assets"), "Created item should have assets" # Based on log: item has image asset - assert ( - "image" in created_item.assets - ), "Created item should have image asset" + assert "image" in created_item.assets, "Created item should have image asset" logger.info(f"Verified item creation: {created_item.id}") logger.info(f"Created item has {len(created_item.assets)} assets") @@ -676,15 +598,11 @@ def test_11_update_stac_item(self, planetarycomputer_endpoint, planetarycomputer try: # Get existing item first - stac_item = client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + stac_item = client.stac.get_item(collection_id=collection_id, item_id=item_id) logger.info(f"Retrieved item for update: {item_id}") # Update properties - use the item as-is and modify it - stac_item_dict = ( - stac_item.as_dict() if hasattr(stac_item, "as_dict") else stac_item - ) + stac_item_dict = stac_item.as_dict() if hasattr(stac_item, "as_dict") else stac_item if "properties" not in stac_item_dict: stac_item_dict["properties"] = {} @@ -707,9 +625,7 @@ def test_11_update_stac_item(self, planetarycomputer_endpoint, planetarycomputer logger.info(f"Update operation result: {update_result}") # Verify the update - updated_item = client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + updated_item = client.stac.get_item(collection_id=collection_id, item_id=item_id) logger.info(f"Verified item update: {updated_item.id}") # Based on log: Update actually failed due to PublicAccessRestricted @@ -719,12 +635,8 @@ def test_11_update_stac_item(self, planetarycomputer_endpoint, planetarycomputer logger.error(f"Failed to update item: {str(e)}") # Based on log: Update fails with "PublicAccessRestricted: Public access is not permitted on this storage account" # This is expected in the test environment - logger.info( - "Item update may not be supported in this environment or item doesn't exist" - ) - logger.info( - "This is expected if public access is restricted on the storage account" - ) + logger.info("Item update may not be supported in this environment or item doesn't exist") + logger.info("This is expected if public access is restricted on the storage account") @PlanetaryComputerPreparer() @recorded_by_proxy @@ -738,9 +650,7 @@ def test_12_get_item(self, planetarycomputer_endpoint, planetarycomputer_collect collection_id = planetarycomputer_collection_id # First, get an item ID from the collection - items_response = client.stac.get_item_collection( - collection_id=collection_id, limit=1 - ) + items_response = client.stac.get_item_collection(collection_id=collection_id, limit=1) if len(items_response.features) > 0: item_id = items_response.features[0].id @@ -760,9 +670,7 @@ def test_12_get_item(self, planetarycomputer_endpoint, planetarycomputer_collect assert hasattr(item, "assets"), "Item should have assets" # Based on log: items have 4 asset types (image, tilejson, thumbnail, rendered_preview) - assert ( - len(item.assets) >= 2 - ), f"Expected at least 2 assets, got {len(item.assets)}" + assert len(item.assets) >= 2, f"Expected at least 2 assets, got {len(item.assets)}" logger.info(f"Retrieved item: {item.id}") logger.info(f" Collection: {item.collection}") @@ -788,151 +696,77 @@ def test_12_get_item(self, planetarycomputer_endpoint, planetarycomputer_collect @PlanetaryComputerPreparer() @recorded_by_proxy def test_13_replace_stac_item(self, planetarycomputer_endpoint, planetarycomputer_collection_id): - """Test creating or replacing a STAC item (idempotent operation). + """Test replacing an existing STAC item. - This demonstrates using begin_create_or_replace_item which is idempotent: - - First ensures item exists by creating it with begin_create_item - - Then demonstrates replace using begin_create_or_replace_item - - Multiple calls with the same data produce the same result + After creation, the service copies assets into managed storage and rewrites hrefs. + For replace to work, we must rewrite asset hrefs back to the original public source + URLs, since the service re-ingests all assets during replace. """ logger.info("=" * 80) - logger.info("TEST: Create or Replace STAC Item (Idempotent)") + logger.info("TEST: Replace STAC Item") logger.info("=" * 80) client = self.create_client(endpoint=planetarycomputer_endpoint) collection_id = planetarycomputer_collection_id - item_id = "ga_m_3308421_se_16_060_20211114_replace_test" + item_id = "ga_m_3308421_se_16_060_20211114_test" - # Create sample STAC item - stac_item = StacItem( - { - "stac_version": "1.0.0", - "type": "Feature", - "id": item_id, - "collection": collection_id, - "bbox": [-84.44157, 33.621853, -84.370894, 33.690654], - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [-84.372943, 33.621853], - [-84.370894, 33.689211], - [-84.439575, 33.690654], - [-84.44157, 33.623293], - [-84.372943, 33.621853], - ] - ], - }, - "properties": { - "gsd": 0.6, - "datetime": "2021-11-14T16:00:00Z", - "naip:year": "2021", - "proj:bbox": [737334.0, 3723324.0, 743706.0, 3730800.0], - "proj:epsg": 26916, - "naip:state": "ga", - "proj:shape": [12460, 10620], - "proj:transform": [ - 0.6, - 0.0, - 737334.0, - 0.0, - -0.6, - 3730800.0, - 0.0, - 0.0, - 1.0, - ], - "platform": "Imagery Original", - }, - "links": [ - { - "rel": "collection", - "type": "application/json", - "href": f"https://planetarycomputer.microsoft.com/api/stac/v1/collections/{collection_id}", - } - ], - "assets": { - "image": { - "href": "https://naipeuwest.blob.core.windows.net/naip/v002/ga/2021/ga_060cm_2021/33084/m_3308421_se_16_060_20211114.tif", - "type": "image/tiff; application=geotiff; profile=cloud-optimized", - "roles": ["data"], - "title": "RGBIR COG tile", - } - }, - "stac_extensions": [ - "https://stac-extensions.github.io/projection/v1.0.0/schema.json" - ], + # Original public source URL used when the item was created in test_10 + original_image_href = "https://naipeuwest.blob.core.windows.net/naip/v002/ga/2021/ga_060cm_2021/33084/m_3308421_se_16_060_20211114.tif" + + # Get the full item + stac_item = client.stac.get_item(collection_id=collection_id, item_id=item_id) + assert stac_item is not None, "Item should be retrievable" + logger.info(f"Using test item for replace test: {item_id}") + + # Build the replacement item dict + stac_item_dict = stac_item.as_dict() if hasattr(stac_item, "as_dict") else dict(stac_item) + original_platform = stac_item_dict.get("properties", {}).get("platform", None) + stac_item_dict["properties"]["platform"] = "Imagery Updated via Replace Test" + + # Rewrite asset hrefs back to original public source URLs + # The service re-ingests assets during replace, so hrefs must be accessible + stac_item_dict["assets"] = { + "image": { + "href": original_image_href, + "type": "image/tiff; application=geotiff; profile=cloud-optimized", + "roles": ["data"], + "title": "RGBIR COG tile", } - ) - - logger.info(f"Creating initial STAC item: {item_id}") - - # Delete the item if it already exists to ensure idempotency - try: - client.stac.get_item(collection_id=collection_id, item_id=item_id) - logger.info(f"Item {item_id} already exists, deleting it first...") - delete_poller = client.stac.begin_delete_item( - collection_id=collection_id, item_id=item_id, polling=True - ) - delete_poller.result() - logger.info(f"Deleted existing item {item_id}") - except ResourceNotFoundError: - logger.info(f"Item {item_id} does not exist, proceeding with creation") + } - # Step 1: Create the item using begin_create_item - create_poller = client.stac.begin_create_item( - collection_id=collection_id, body=stac_item, polling=True - ) - create_poller.result() - logger.info(f"Created item {item_id}") - - # Verify creation - created_item = client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) - assert created_item is not None, "Created item should be retrievable" - assert created_item.id == item_id, "Created item ID should match" - logger.info(f"Verified item {created_item.id}") - - # Step 2: Now demonstrate create_or_replace (replace since item exists) - logger.info(f"Replacing item {item_id} using create_or_replace...") - stac_item.properties["platform"] = "Imagery Updated" - stac_item.properties["processing_level"] = "L2" + updated_stac_item = StacItem(stac_item_dict) - replace_poller = client.stac.begin_create_or_replace_item( - collection_id=collection_id, item_id=item_id, body=stac_item, polling=True + # Replace the item + logger.info(f"Replacing item {item_id} using begin_replace_item...") + replace_poller = client.stac.begin_replace_item( + collection_id=collection_id, item_id=item_id, body=updated_stac_item, polling=True ) replace_poller.result() - logger.info(f"Replaced item {item_id} using create_or_replace") + logger.info(f"Replaced item {item_id}") # Verify replacement - replaced_item = client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + replaced_item = client.stac.get_item(collection_id=collection_id, item_id=item_id) assert replaced_item is not None, "Replaced item should be retrievable" assert replaced_item.id == item_id, "Replaced item ID should match" - # Verify the updated properties - if hasattr(replaced_item, "properties") and replaced_item.properties: - platform = replaced_item.properties.get("platform", "N/A") - processing_level = replaced_item.properties.get("processing_level", "N/A") - logger.info( - f"Verified replaced item, platform: {platform}, processing_level: {processing_level}" - ) + # Verify the updated property + platform = replaced_item.properties.get("platform", "N/A") + logger.info(f"Verified replaced item, platform: {platform}") + assert platform == "Imagery Updated via Replace Test", f"Expected updated platform, got '{platform}'" - # Assert the properties were updated - assert ( - platform == "Imagery Updated" - ), f"Expected platform 'Imagery Updated', got '{platform}'" - assert ( - processing_level == "L2" - ), f"Expected processing_level 'L2', got '{processing_level}'" + # Restore original value (also with original hrefs) + if original_platform is not None: + stac_item_dict["properties"]["platform"] = original_platform else: - logger.warning("Replaced item has no properties to verify") - - logger.info( - f"Successfully verified create_or_replace operation for item {item_id}" + stac_item_dict["properties"].pop("platform", None) + restore_item = StacItem(stac_item_dict) + restore_poller = client.stac.begin_replace_item( + collection_id=collection_id, item_id=item_id, body=restore_item, polling=True ) + restore_poller.result() + logger.info(f"Restored original item {item_id}") + + logger.info(f"Successfully verified replace operation for item {item_id}") @PlanetaryComputerPreparer() @recorded_by_proxy @@ -1005,9 +839,7 @@ def test_14_delete_stac_item(self, planetarycomputer_endpoint, planetarycomputer "title": "RGBIR COG tile", } }, - "stac_extensions": [ - "https://stac-extensions.github.io/projection/v1.0.0/schema.json" - ], + "stac_extensions": ["https://stac-extensions.github.io/projection/v1.0.0/schema.json"], } ) @@ -1015,27 +847,21 @@ def test_14_delete_stac_item(self, planetarycomputer_endpoint, planetarycomputer try: # First, create an item to delete - create_poller = client.stac.begin_create_item( - collection_id=collection_id, body=stac_item, polling=True - ) + create_poller = client.stac.begin_create_item(collection_id=collection_id, body=stac_item, polling=True) create_poller.result() logger.info(f"Created item {item_id}") except ResourceExistsError: logger.info(f"Item {item_id} already exists, will proceed to delete it") # Verify the item exists - existing_item = client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + existing_item = client.stac.get_item(collection_id=collection_id, item_id=item_id) assert existing_item is not None, "Item should exist before deletion" assert existing_item.id == item_id, "Item ID should match" logger.info(f"Verified item {item_id} exists") # Delete the item logger.info(f"Deleting item {item_id}...") - delete_poller = client.stac.begin_delete_item( - collection_id=collection_id, item_id=item_id, polling=True - ) + delete_poller = client.stac.begin_delete_item(collection_id=collection_id, item_id=item_id, polling=True) delete_poller.result() logger.info(f"Delete operation completed for item {item_id}") @@ -1043,9 +869,7 @@ def test_14_delete_stac_item(self, planetarycomputer_endpoint, planetarycomputer logger.info(f"Verifying item {item_id} was deleted...") try: client.stac.get_item(collection_id=collection_id, item_id=item_id) - logger.warning( - f"Item {item_id} still exists after deletion (may take time to propagate)" - ) + logger.warning(f"Item {item_id} still exists after deletion (may take time to propagate)") # In some cases, deletion may take time to propagate, so we don't fail the test except ResourceNotFoundError: logger.info(f"Verified item {item_id} was successfully deleted") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification_async.py index d962d1912e81..ea183a7500ff 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification_async.py @@ -35,16 +35,12 @@ log_file = log_dir / "stac_specification_test_results.log" file_handler = logging.FileHandler(log_file, mode="w") file_handler.setLevel(logging.INFO) -file_formatter = logging.Formatter( - "%(asctime)s - %(name)s - %(levelname)s - %(message)s" -) +file_formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") file_handler.setFormatter(file_formatter) logger.addHandler(file_handler) -class TestPlanetaryComputerStacSpecificationAsync( - PlanetaryComputerProClientTestBaseAsync -): +class TestPlanetaryComputerStacSpecificationAsync(PlanetaryComputerProClientTestBaseAsync): """Test class for STAC API specification operations.""" @PlanetaryComputerPreparer() @@ -60,12 +56,8 @@ async def test_01_get_conformance_class(self, planetarycomputer_endpoint): # Validate conformance response assert conformance is not None, "Conformance should not be None" - assert hasattr( - conformance, "conforms_to" - ), "Conformance should have conforms_to property" - assert ( - len(conformance.conforms_to) > 0 - ), "Conformance should have at least one URI" + assert hasattr(conformance, "conforms_to"), "Conformance should have conforms_to property" + assert len(conformance.conforms_to) > 0, "Conformance should have at least one URI" # Based on log: Retrieved 15 conformance classes assert ( @@ -116,15 +108,11 @@ async def test_03_list_collections(self, planetarycomputer_endpoint, planetaryco # Validate collections response assert collections is not None, "Collections should not be None" - assert hasattr( - collections, "collections" - ), "Response should have collections property" + assert hasattr(collections, "collections"), "Response should have collections property" assert len(collections.collections) > 0, "Should have at least one collection" # Based on log: Retrieved 10 collections - assert ( - len(collections.collections) >= 5 - ), f"Expected at least 5 collections, got {len(collections.collections)}" + assert len(collections.collections) >= 5, f"Expected at least 5 collections, got {len(collections.collections)}" logger.info(f"Retrieved {len(collections.collections)} collections") @@ -147,16 +135,12 @@ async def test_03_list_collections(self, planetarycomputer_endpoint, planetaryco # Validate collection structure first_collection = collections.collections[0] assert hasattr(first_collection, "id"), "Collection should have id" - assert ( - first_collection.id is not None and len(first_collection.id) > 0 - ), "Collection ID should not be empty" + assert first_collection.id is not None and len(first_collection.id) > 0, "Collection ID should not be empty" assert hasattr(first_collection, "extent"), "Collection should have extent" # Validate that the collection is in the list collection_ids = [c.id for c in collections.collections] - assert ( - collection_id in collection_ids - ), f"{collection_id} collection should be present" + assert collection_id in collection_ids, f"{collection_id} collection should be present" await self.close_client() @@ -181,9 +165,7 @@ async def test_04_get_collection(self, planetarycomputer_endpoint, planetarycomp # Validate title is present assert hasattr(collection, "title"), "Collection should have title" - assert ( - collection.title is not None and len(collection.title) > 0 - ), "Collection title should not be empty" + assert collection.title is not None and len(collection.title) > 0, "Collection title should not be empty" logger.info(f"Retrieved collection: {collection.id}") if hasattr(collection, "title") and collection.title: @@ -201,25 +183,17 @@ async def test_04_get_collection(self, planetarycomputer_endpoint, planetarycomp logger.info(" Extent:") if hasattr(collection.extent, "spatial") and collection.extent.spatial: # Log available attributes instead of assuming bbox exists - spatial_attrs = [ - attr - for attr in dir(collection.extent.spatial) - if not attr.startswith("_") - ] + spatial_attrs = [attr for attr in dir(collection.extent.spatial) if not attr.startswith("_")] logger.info(f" Spatial attributes: {spatial_attrs}") # Try to access bbox if it exists if hasattr(collection.extent.spatial, "bbox"): logger.info(f" Spatial bbox: {collection.extent.spatial.bbox}") if hasattr(collection.extent, "temporal") and collection.extent.temporal: - logger.info( - f" Temporal interval: {collection.extent.temporal.interval}" - ) + logger.info(f" Temporal interval: {collection.extent.temporal.interval}") # Validate links assert hasattr(collection, "links"), "Collection should have links" - assert ( - collection.links is not None and len(collection.links) > 0 - ), "Collection should have at least one link" + assert collection.links is not None and len(collection.links) > 0, "Collection should have at least one link" if hasattr(collection, "links") and collection.links: logger.info(f" Links count: {len(collection.links)}") @@ -264,11 +238,7 @@ async def test_05_search_items_with_spatial_filter( ], }, date_time="2021-01-01T00:00:00Z/2022-12-31T00:00:00Z", - sort_by=[ - StacSortExtension( - field="datetime", direction=StacSearchSortingDirection.DESC - ) - ], + sort_by=[StacSortExtension(field="datetime", direction=StacSearchSortingDirection.DESC)], limit=50, ) @@ -304,9 +274,7 @@ async def test_05_search_items_with_spatial_filter( first_item = search_response.features[0] assert hasattr(first_item, "id"), "Item should have id" assert hasattr(first_item, "collection"), "Item should have collection" - assert ( - first_item.collection == collection_id - ), "Item collection should match search collection" + assert first_item.collection == collection_id, "Item collection should match search collection" await self.close_client() @@ -320,22 +288,16 @@ async def test_06_get_item_collection(self, planetarycomputer_endpoint, planetar client = self.create_client(endpoint=planetarycomputer_endpoint) collection_id = planetarycomputer_collection_id - items_response = await client.stac.get_item_collection( - collection_id=collection_id, limit=10 - ) + items_response = await client.stac.get_item_collection(collection_id=collection_id, limit=10) # Validate response assert items_response is not None, "Items response should not be None" assert hasattr(items_response, "features"), "Response should have features" # Based on log: Retrieved 10 items with 4 asset types each - assert ( - len(items_response.features) >= 5 - ), f"Expected at least 5 items, got {len(items_response.features)}" + assert len(items_response.features) >= 5, f"Expected at least 5 items, got {len(items_response.features)}" - logger.info( - f"Retrieved {len(items_response.features)} items from collection {collection_id}" - ) + logger.info(f"Retrieved {len(items_response.features)} items from collection {collection_id}") # Log first few items for i, item in enumerate(items_response.features[:5]): @@ -351,15 +313,11 @@ async def test_06_get_item_collection(self, planetarycomputer_endpoint, planetar first_item = items_response.features[0] assert hasattr(first_item, "assets"), "Item should have assets" asset_keys = list(first_item.assets.keys()) - assert ( - len(asset_keys) >= 2 - ), f"Expected at least 2 assets, got {len(asset_keys)}" + assert len(asset_keys) >= 2, f"Expected at least 2 assets, got {len(asset_keys)}" # Check for common assets common_assets = ["image", "tilejson", "thumbnail", "rendered_preview"] found_assets = [asset for asset in common_assets if asset in asset_keys] - assert ( - len(found_assets) >= 1 - ), f"Expected at least one common asset type, found: {found_assets}" + assert len(found_assets) >= 1, f"Expected at least one common asset type, found: {found_assets}" await self.close_client() @@ -373,9 +331,7 @@ async def test_07_get_collection_queryables(self, planetarycomputer_endpoint, pl client = self.create_client(endpoint=planetarycomputer_endpoint) collection_id = planetarycomputer_collection_id - queryables = await client.stac.get_collection_queryables( - collection_id=collection_id - ) + queryables = await client.stac.get_collection_queryables(collection_id=collection_id) # Validate queryables assert queryables is not None, "Queryables should not be None" @@ -387,18 +343,14 @@ async def test_07_get_collection_queryables(self, planetarycomputer_endpoint, pl properties = queryables["properties"] # Based on log: Found 4 queryable properties (id, datetime, geometry, eo:cloud_cover) - assert ( - len(properties) >= 3 - ), f"Expected at least 3 queryable properties, got {len(properties)}" + assert len(properties) >= 3, f"Expected at least 3 queryable properties, got {len(properties)}" logger.info(f"Found {len(properties)} queryable properties") # Validate common STAC queryables are present common_queryables = ["id", "datetime", "geometry"] for queryable in common_queryables: - assert ( - queryable in properties - ), f"Expected queryable '{queryable}' not found" + assert queryable in properties, f"Expected queryable '{queryable}' not found" # Log first 15 queryable properties for i, (prop_name, prop_info) in enumerate(list(properties.items())[:15]): @@ -459,9 +411,7 @@ async def test_08_search_items_with_temporal_filter( # Properties is a dictionary properties = item.properties if isinstance(properties, dict): - assert ( - "datetime" in properties - ), "Item should have datetime property in dict" + assert "datetime" in properties, "Item should have datetime property in dict" logger.info(f" Datetime: {properties['datetime']}") elif hasattr(properties, "__getitem__"): # It's a dict-like object @@ -469,9 +419,7 @@ async def test_08_search_items_with_temporal_filter( logger.info(f" Datetime: {properties['datetime']}") else: # It's an object with attributes - assert hasattr( - properties, "datetime" - ), "Item should have datetime attribute" + assert hasattr(properties, "datetime"), "Item should have datetime attribute" logger.info(f" Datetime: {properties.datetime}") await self.close_client() @@ -490,29 +438,21 @@ async def test_09_search_items_with_sorting(self, planetarycomputer_endpoint, pl # Search with descending sort by datetime search_params_desc = StacSearchParameters( collections=[collection_id], - sort_by=[ - StacSortExtension( - field="datetime", direction=StacSearchSortingDirection.DESC - ) - ], + sort_by=[StacSortExtension(field="datetime", direction=StacSearchSortingDirection.DESC)], limit=5, ) search_response_desc = await client.stac.search(body=search_params_desc) assert search_response_desc is not None, "Search response should not be None" - assert hasattr( - search_response_desc, "features" - ), "Response should have features" + assert hasattr(search_response_desc, "features"), "Response should have features" # Based on log: DESC sorting returned 5 items assert ( len(search_response_desc.features) >= 3 ), f"Expected at least 3 items in DESC sort, got {len(search_response_desc.features)}" - logger.info( - f"Search with DESC sorting returned {len(search_response_desc.features)} items" - ) + logger.info(f"Search with DESC sorting returned {len(search_response_desc.features)} items") # Log sorted results for i, item in enumerate(search_response_desc.features): @@ -524,29 +464,21 @@ async def test_09_search_items_with_sorting(self, planetarycomputer_endpoint, pl # Search with ascending sort search_params_asc = StacSearchParameters( collections=[collection_id], - sort_by=[ - StacSortExtension( - field="datetime", direction=StacSearchSortingDirection.ASC - ) - ], + sort_by=[StacSortExtension(field="datetime", direction=StacSearchSortingDirection.ASC)], limit=5, ) search_response_asc = await client.stac.search(body=search_params_asc) assert search_response_asc is not None, "ASC search response should not be None" - assert hasattr( - search_response_asc, "features" - ), "ASC response should have features" + assert hasattr(search_response_asc, "features"), "ASC response should have features" # Based on log: ASC sorting returned 5 items assert ( len(search_response_asc.features) >= 3 ), f"Expected at least 3 items in ASC sort, got {len(search_response_asc.features)}" - logger.info( - f"\nSearch with ASC sorting returned {len(search_response_asc.features)} items" - ) + logger.info(f"\nSearch with ASC sorting returned {len(search_response_asc.features)} items") for i, item in enumerate(search_response_asc.features): logger.info(f"Item {i+1}: {item.id}") @@ -623,9 +555,7 @@ async def test_10_create_stac_item(self, planetarycomputer_endpoint, planetaryco "title": "RGBIR COG tile", } }, - "stac_extensions": [ - "https://stac-extensions.github.io/projection/v1.0.0/schema.json" - ], + "stac_extensions": ["https://stac-extensions.github.io/projection/v1.0.0/schema.json"], } ) @@ -633,9 +563,7 @@ async def test_10_create_stac_item(self, planetarycomputer_endpoint, planetaryco # Check if item already exists and delete if necessary try: - items_response = await client.stac.get_item_collection( - collection_id=collection_id - ) + items_response = await client.stac.get_item_collection(collection_id=collection_id) if any(item.id == item_id for item in items_response.features): logger.info(f"Item {item_id} already exists. Deleting it first...") delete_poller = await client.stac.begin_delete_item( @@ -656,25 +584,17 @@ async def test_10_create_stac_item(self, planetarycomputer_endpoint, planetaryco logger.info(f"Create operation result: {create_result}") # Verify the item was created - created_item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + created_item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) assert created_item is not None, "Created item should be retrievable" assert created_item.id == item_id, "Created item ID should match" # Validate structure of created item - assert hasattr( - created_item, "geometry" - ), "Created item should have geometry" - assert hasattr( - created_item, "properties" - ), "Created item should have properties" + assert hasattr(created_item, "geometry"), "Created item should have geometry" + assert hasattr(created_item, "properties"), "Created item should have properties" assert hasattr(created_item, "assets"), "Created item should have assets" # Based on log: item has image asset - assert ( - "image" in created_item.assets - ), "Created item should have image asset" + assert "image" in created_item.assets, "Created item should have image asset" logger.info(f"Verified item creation: {created_item.id}") logger.info(f"Created item has {len(created_item.assets)} assets") @@ -700,15 +620,11 @@ async def test_11_update_stac_item(self, planetarycomputer_endpoint, planetaryco try: # Get existing item first - stac_item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + stac_item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) logger.info(f"Retrieved item for update: {item_id}") # Update properties - use the item as-is and modify it - stac_item_dict = ( - stac_item.as_dict() if hasattr(stac_item, "as_dict") else stac_item - ) + stac_item_dict = stac_item.as_dict() if hasattr(stac_item, "as_dict") else stac_item if "properties" not in stac_item_dict: stac_item_dict["properties"] = {} @@ -731,9 +647,7 @@ async def test_11_update_stac_item(self, planetarycomputer_endpoint, planetaryco logger.info(f"Update operation result: {update_result}") # Verify the update - updated_item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + updated_item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) logger.info(f"Verified item update: {updated_item.id}") # Based on log: Update actually failed due to PublicAccessRestricted @@ -743,12 +657,8 @@ async def test_11_update_stac_item(self, planetarycomputer_endpoint, planetaryco logger.error(f"Failed to update item: {str(e)}") # Based on log: Update fails with "PublicAccessRestricted: Public access is not permitted on this storage account" # This is expected in the test environment - logger.info( - "Item update may not be supported in this environment or item doesn't exist" - ) - logger.info( - "This is expected if public access is restricted on the storage account" - ) + logger.info("Item update may not be supported in this environment or item doesn't exist") + logger.info("This is expected if public access is restricted on the storage account") await self.close_client() @@ -764,18 +674,14 @@ async def test_12_get_item(self, planetarycomputer_endpoint, planetarycomputer_c collection_id = planetarycomputer_collection_id # First, get an item ID from the collection - items_response = await client.stac.get_item_collection( - collection_id=collection_id, limit=1 - ) + items_response = await client.stac.get_item_collection(collection_id=collection_id, limit=1) if len(items_response.features) > 0: item_id = items_response.features[0].id logger.info(f"Getting item: {item_id}") # Get the specific item - item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) # Validate item assert item is not None, "Item should not be None" @@ -788,9 +694,7 @@ async def test_12_get_item(self, planetarycomputer_endpoint, planetarycomputer_c assert hasattr(item, "assets"), "Item should have assets" # Based on log: items have 4 asset types (image, tilejson, thumbnail, rendered_preview) - assert ( - len(item.assets) >= 2 - ), f"Expected at least 2 assets, got {len(item.assets)}" + assert len(item.assets) >= 2, f"Expected at least 2 assets, got {len(item.assets)}" logger.info(f"Retrieved item: {item.id}") logger.info(f" Collection: {item.collection}") @@ -818,151 +722,77 @@ async def test_12_get_item(self, planetarycomputer_endpoint, planetarycomputer_c @PlanetaryComputerPreparer() @recorded_by_proxy_async async def test_13_replace_stac_item(self, planetarycomputer_endpoint, planetarycomputer_collection_id): - """Test creating or replacing a STAC item (idempotent operation). + """Test replacing an existing STAC item. - This demonstrates using begin_create_or_replace_item which is idempotent: - - First ensures item exists by creating it with begin_create_item - - Then demonstrates replace using begin_create_or_replace_item - - Multiple calls with the same data produce the same result + After creation, the service copies assets into managed storage and rewrites hrefs. + For replace to work, we must rewrite asset hrefs back to the original public source + URLs, since the service re-ingests all assets during replace. """ logger.info("=" * 80) - logger.info("TEST: Create or Replace STAC Item (Idempotent)") + logger.info("TEST: Replace STAC Item") logger.info("=" * 80) client = self.create_client(endpoint=planetarycomputer_endpoint) collection_id = planetarycomputer_collection_id - item_id = "ga_m_3308421_se_16_060_20211114_replace_test" + item_id = "ga_m_3308421_se_16_060_20211114_test" - # Create sample STAC item - stac_item = StacItem( - { - "stac_version": "1.0.0", - "type": "Feature", - "id": item_id, - "collection": collection_id, - "bbox": [-84.44157, 33.621853, -84.370894, 33.690654], - "geometry": { - "type": "Polygon", - "coordinates": [ - [ - [-84.372943, 33.621853], - [-84.370894, 33.689211], - [-84.439575, 33.690654], - [-84.44157, 33.623293], - [-84.372943, 33.621853], - ] - ], - }, - "properties": { - "gsd": 0.6, - "datetime": "2021-11-14T16:00:00Z", - "naip:year": "2021", - "proj:bbox": [737334.0, 3723324.0, 743706.0, 3730800.0], - "proj:epsg": 26916, - "naip:state": "ga", - "proj:shape": [12460, 10620], - "proj:transform": [ - 0.6, - 0.0, - 737334.0, - 0.0, - -0.6, - 3730800.0, - 0.0, - 0.0, - 1.0, - ], - "platform": "Imagery Original", - }, - "links": [ - { - "rel": "collection", - "type": "application/json", - "href": f"https://planetarycomputer.microsoft.com/api/stac/v1/collections/{collection_id}", - } - ], - "assets": { - "image": { - "href": "https://naipeuwest.blob.core.windows.net/naip/v002/ga/2021/ga_060cm_2021/33084/m_3308421_se_16_060_20211114.tif", - "type": "image/tiff; application=geotiff; profile=cloud-optimized", - "roles": ["data"], - "title": "RGBIR COG tile", - } - }, - "stac_extensions": [ - "https://stac-extensions.github.io/projection/v1.0.0/schema.json" - ], + # Original public source URL used when the item was created in test_10 + original_image_href = "https://naipeuwest.blob.core.windows.net/naip/v002/ga/2021/ga_060cm_2021/33084/m_3308421_se_16_060_20211114.tif" + + # Get the full item + stac_item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) + assert stac_item is not None, "Item should be retrievable" + logger.info(f"Using test item for replace test: {item_id}") + + # Build the replacement item dict + stac_item_dict = stac_item.as_dict() if hasattr(stac_item, "as_dict") else dict(stac_item) + original_platform = stac_item_dict.get("properties", {}).get("platform", None) + stac_item_dict["properties"]["platform"] = "Imagery Updated via Replace Test" + + # Rewrite asset hrefs back to original public source URLs + # The service re-ingests assets during replace, so hrefs must be accessible + stac_item_dict["assets"] = { + "image": { + "href": original_image_href, + "type": "image/tiff; application=geotiff; profile=cloud-optimized", + "roles": ["data"], + "title": "RGBIR COG tile", } - ) - - logger.info(f"Creating initial STAC item: {item_id}") - - # Delete the item if it already exists to ensure idempotency - try: - await client.stac.get_item(collection_id=collection_id, item_id=item_id) - logger.info(f"Item {item_id} already exists, deleting it first...") - delete_poller = await client.stac.begin_delete_item( - collection_id=collection_id, item_id=item_id, polling=True - ) - await delete_poller.result() - logger.info(f"Deleted existing item {item_id}") - except ResourceNotFoundError: - logger.info(f"Item {item_id} does not exist, proceeding with creation") + } - # Step 1: Create the item using begin_create_item - create_poller = await client.stac.begin_create_item( - collection_id=collection_id, body=stac_item, polling=True - ) - await create_poller.result() - logger.info(f"Created item {item_id}") - - # Verify creation - created_item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) - assert created_item is not None, "Created item should be retrievable" - assert created_item.id == item_id, "Created item ID should match" - logger.info(f"Verified item {created_item.id}") - - # Step 2: Now demonstrate create_or_replace (replace since item exists) - logger.info(f"Replacing item {item_id} using create_or_replace...") - stac_item.properties["platform"] = "Imagery Updated" - stac_item.properties["processing_level"] = "L2" + updated_stac_item = StacItem(stac_item_dict) - replace_poller = await client.stac.begin_create_or_replace_item( - collection_id=collection_id, item_id=item_id, body=stac_item, polling=True + # Replace the item + logger.info(f"Replacing item {item_id} using begin_replace_item...") + replace_poller = await client.stac.begin_replace_item( + collection_id=collection_id, item_id=item_id, body=updated_stac_item, polling=True ) await replace_poller.result() - logger.info(f"Replaced item {item_id} using create_or_replace") + logger.info(f"Replaced item {item_id}") # Verify replacement - replaced_item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + replaced_item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) assert replaced_item is not None, "Replaced item should be retrievable" assert replaced_item.id == item_id, "Replaced item ID should match" - # Verify the updated properties - if hasattr(replaced_item, "properties") and replaced_item.properties: - platform = replaced_item.properties.get("platform", "N/A") - processing_level = replaced_item.properties.get("processing_level", "N/A") - logger.info( - f"Verified replaced item, platform: {platform}, processing_level: {processing_level}" - ) + # Verify the updated property + platform = replaced_item.properties.get("platform", "N/A") + logger.info(f"Verified replaced item, platform: {platform}") + assert platform == "Imagery Updated via Replace Test", f"Expected updated platform, got '{platform}'" - # Assert the properties were updated - assert ( - platform == "Imagery Updated" - ), f"Expected platform 'Imagery Updated', got '{platform}'" - assert ( - processing_level == "L2" - ), f"Expected processing_level 'L2', got '{processing_level}'" + # Restore original value (also with original hrefs) + if original_platform is not None: + stac_item_dict["properties"]["platform"] = original_platform else: - logger.warning("Replaced item has no properties to verify") - - logger.info( - f"Successfully verified create_or_replace operation for item {item_id}" + stac_item_dict["properties"].pop("platform", None) + restore_item = StacItem(stac_item_dict) + restore_poller = await client.stac.begin_replace_item( + collection_id=collection_id, item_id=item_id, body=restore_item, polling=True ) + await replace_poller.result() + logger.info(f"Restored original item {item_id}") + + logger.info(f"Successfully verified replace operation for item {item_id}") await self.close_client() @@ -1037,9 +867,7 @@ async def test_14_delete_stac_item(self, planetarycomputer_endpoint, planetaryco "title": "RGBIR COG tile", } }, - "stac_extensions": [ - "https://stac-extensions.github.io/projection/v1.0.0/schema.json" - ], + "stac_extensions": ["https://stac-extensions.github.io/projection/v1.0.0/schema.json"], } ) @@ -1056,18 +884,14 @@ async def test_14_delete_stac_item(self, planetarycomputer_endpoint, planetaryco logger.info(f"Item {item_id} already exists, will proceed to delete it") # Verify the item exists - existing_item = await client.stac.get_item( - collection_id=collection_id, item_id=item_id - ) + existing_item = await client.stac.get_item(collection_id=collection_id, item_id=item_id) assert existing_item is not None, "Item should exist before deletion" assert existing_item.id == item_id, "Item ID should match" logger.info(f"Verified item {item_id} exists") # Delete the item logger.info(f"Deleting item {item_id}...") - delete_poller = await client.stac.begin_delete_item( - collection_id=collection_id, item_id=item_id, polling=True - ) + delete_poller = await client.stac.begin_delete_item(collection_id=collection_id, item_id=item_id, polling=True) await delete_poller.result() logger.info(f"Delete operation completed for item {item_id}") @@ -1075,9 +899,7 @@ async def test_14_delete_stac_item(self, planetarycomputer_endpoint, planetaryco logger.info(f"Verifying item {item_id} was deleted...") try: await client.stac.get_item(collection_id=collection_id, item_id=item_id) - logger.warning( - f"Item {item_id} still exists after deletion (may take time to propagate)" - ) + logger.warning(f"Item {item_id} still exists after deletion (may take time to propagate)") # In some cases, deletion may take time to propagate, so we don't fail the test except ResourceNotFoundError: logger.info(f"Verified item {item_id} was successfully deleted") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_03_sas.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_03_sas.py index a360d6f72431..cd46fb591f87 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_03_sas.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_03_sas.py @@ -8,6 +8,7 @@ """ import logging from pathlib import Path +import pytest from urllib.request import urlopen from datetime import datetime, timedelta, timezone import re @@ -40,9 +41,7 @@ class TestPlanetaryComputerSas(PlanetaryComputerProClientTestBase): @PlanetaryComputerPreparer() @recorded_by_proxy - def test_01_get_token_with_default_duration( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_01_get_token_with_default_duration(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test generating a SAS token with default duration.""" test_logger.info("=" * 80) test_logger.info("TEST: test_01_get_token_with_default_duration") @@ -52,12 +51,8 @@ def test_01_get_token_with_default_duration( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_token(collection_id={planetarycomputer_collection_id})" - ) - response = client.shared_access_signature.get_token( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_token(collection_id={planetarycomputer_collection_id})") + response = client.sas.get_token(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") @@ -73,9 +68,7 @@ def test_01_get_token_with_default_duration( # Verify token format - in playback mode, entire token is sanitized to "Sanitized" if is_live(): # In live mode, verify SAS token format with regex - sas_token_pattern = ( - r"st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" - ) + sas_token_pattern = r"st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" assert re.search( sas_token_pattern, response.token ), "Token should match SAS token format (st, se, sp, sv, sr, sig)" @@ -85,31 +78,23 @@ def test_01_get_token_with_default_duration( assert len(response.token) > 0, "Token should not be empty" # Verify expires_on is a datetime in the future - assert isinstance( - response.expires_on, datetime - ), "expires_on should be a datetime object" + assert isinstance(response.expires_on, datetime), "expires_on should be a datetime object" if is_live(): - assert response.expires_on > datetime.now( - timezone.utc - ), "Token expiry should be in the future" + assert response.expires_on > datetime.now(timezone.utc), "Token expiry should be in the future" # Verify default duration is approximately 24 hours (allow 5 minute tolerance for clock skew) if is_live(): now = datetime.now(timezone.utc) expected_expiry = now + timedelta(hours=24) time_diff = abs((response.expires_on - expected_expiry).total_seconds()) - assert ( - time_diff < 300 - ), f"Expiry should be ~24 hours from now (diff: {time_diff}s)" + assert time_diff < 300, f"Expiry should be ~24 hours from now (diff: {time_diff}s)" test_logger.info("Test PASSED\n") @PlanetaryComputerPreparer() @recorded_by_proxy - def test_02_get_token_with_custom_duration( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_02_get_token_with_custom_duration(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test generating a SAS token with custom duration.""" test_logger.info("=" * 80) test_logger.info("TEST: test_02_get_token_with_custom_duration") @@ -120,12 +105,8 @@ def test_02_get_token_with_custom_duration( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_token(collection_id={planetarycomputer_collection_id}, duration_in_minutes=60)" - ) - response = client.shared_access_signature.get_token( - collection_id=planetarycomputer_collection_id, duration_in_minutes=60 - ) + test_logger.info(f"Calling: get_token(collection_id={planetarycomputer_collection_id}, duration_in_minutes=60)") + response = client.sas.get_token(collection_id=planetarycomputer_collection_id, duration_in_minutes=60) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") @@ -141,9 +122,7 @@ def test_02_get_token_with_custom_duration( # Verify token format - in playback mode, entire token is sanitized to "Sanitized" if is_live(): # In live mode, verify SAS token format with regex - sas_token_pattern = ( - r"st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" - ) + sas_token_pattern = r"st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" assert re.search( sas_token_pattern, response.token ), "Token should match SAS token format (st, se, sp, sv, sr, sig)" @@ -153,31 +132,23 @@ def test_02_get_token_with_custom_duration( assert len(response.token) > 0, "Token should not be empty" # Verify expires_on is a datetime in the future - assert isinstance( - response.expires_on, datetime - ), "expires_on should be a datetime object" + assert isinstance(response.expires_on, datetime), "expires_on should be a datetime object" if is_live(): - assert response.expires_on > datetime.now( - timezone.utc - ), "Token expiry should be in the future" + assert response.expires_on > datetime.now(timezone.utc), "Token expiry should be in the future" # Verify custom duration is approximately 60 minutes (allow 5 minute tolerance for clock skew) if is_live(): now = datetime.now(timezone.utc) expected_expiry = now + timedelta(minutes=60) time_diff = abs((response.expires_on - expected_expiry).total_seconds()) - assert ( - time_diff < 300 - ), f"Expiry should be ~60 minutes from now (diff: {time_diff}s)" + assert time_diff < 300, f"Expiry should be ~60 minutes from now (diff: {time_diff}s)" test_logger.info("Test PASSED\n") @PlanetaryComputerPreparer() @recorded_by_proxy - def test_03_get_sign_with_collection_thumbnail( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_03_get_sign_with_collection_thumbnail(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test signing an asset HREF using collection thumbnail.""" test_logger.info("=" * 80) test_logger.info("TEST: test_03_get_sign_with_collection_thumbnail") @@ -188,9 +159,7 @@ def test_03_get_sign_with_collection_thumbnail( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Getting collection...") - collection = client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = client.stac.get_collection(collection_id=planetarycomputer_collection_id) assert collection is not None assert collection.assets is not None @@ -201,7 +170,7 @@ def test_03_get_sign_with_collection_thumbnail( assert original_href is not None test_logger.info(f"Calling: get_sign(href={original_href})") - response = client.shared_access_signature.get_sign(href=original_href) + response = client.sas.get_sign(href=original_href) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") @@ -221,51 +190,37 @@ def test_03_get_sign_with_collection_thumbnail( test_logger.info(f"Has sig param: {'sig=' in signed_href.lower()}") # Verify signed HREF is different and contains SAS parameters - assert ( - signed_href != original_href - ), "Signed HREF should differ from original HREF" + assert signed_href != original_href, "Signed HREF should differ from original HREF" # Verify SAS parameters in HREF - skip regex in playback due to sanitization variations if is_live(): # In live mode, verify SAS HREF format with regex - sas_href_pattern = ( - r"\?.*st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" - ) + sas_href_pattern = r"\?.*st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" assert re.search( sas_href_pattern, signed_href ), "Signed HREF should contain SAS parameters (st, se, sp, sv, sr, sig)" else: # In playback mode, just verify basic SAS structure exists assert "?" in signed_href, "Signed HREF should have query parameters" - assert ( - "sig=" in signed_href.lower() - ), "Signed HREF should contain signature parameter" + assert "sig=" in signed_href.lower(), "Signed HREF should contain signature parameter" # Verify expires_on is a datetime in the future (if present) if response.expires_on is not None: - assert isinstance( - response.expires_on, datetime - ), "expires_on should be a datetime object" + assert isinstance(response.expires_on, datetime), "expires_on should be a datetime object" if is_live(): - assert response.expires_on > datetime.now( - timezone.utc - ), "Token expiry should be in the future" + assert response.expires_on > datetime.now(timezone.utc), "Token expiry should be in the future" # Verify the signed HREF starts with the original base URL (strip query params first) original_base = original_href.split("?")[0] signed_base = signed_href.split("?")[0] - assert ( - signed_base == original_base - ), "Signed HREF should have the same base URL as original" + assert signed_base == original_base, "Signed HREF should have the same base URL as original" test_logger.info("Test PASSED\n") @PlanetaryComputerPreparer() @recorded_by_proxy - def test_04_signed_href_can_download_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_04_signed_href_can_download_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test that a signed HREF can be used to download an asset. """ @@ -277,16 +232,20 @@ def test_04_signed_href_can_download_asset( client = self.create_client(endpoint=planetarycomputer_endpoint) + # Revoke any cached delegation keys to ensure a fresh key is used. + # This is necessary when an ingestion source has been renewed, as the + # server may cache a stale delegation key from the previous source. + test_logger.info("Revoking cached delegation keys...") + client.sas.revoke_token() + test_logger.info("Getting collection...") - collection = client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = client.stac.get_collection(collection_id=planetarycomputer_collection_id) assert "thumbnail" in collection.assets, "Collection does not have a thumbnail asset" thumbnail_href = collection.assets["thumbnail"].href test_logger.info(f"Thumbnail HREF: {thumbnail_href}") test_logger.info(f"Calling: get_sign(href={thumbnail_href})") - sign_response = client.shared_access_signature.get_sign(href=thumbnail_href) + sign_response = client.sas.get_sign(href=thumbnail_href) signed_href = sign_response.href test_logger.info(f"Signed HREF: {signed_href}") @@ -307,15 +266,11 @@ def test_04_signed_href_can_download_asset( test_logger.info(f"Content-Type: {content_type}") # Verify successful download - assert ( - download_response.status == 200 - ), f"Expected 200, got {download_response.status}" + assert download_response.status == 200, f"Expected 200, got {download_response.status}" assert len(content) > 0, "Downloaded content should not be empty" # Verify it's actually binary image data by checking PNG magic bytes - assert ( - content[:4] == b"\x89PNG" - ), "Downloaded content should be a PNG image" + assert content[:4] == b"\x89PNG", "Downloaded content should be a PNG image" break except Exception as e: if attempt < max_retries - 1: @@ -330,9 +285,7 @@ def test_04_signed_href_can_download_asset( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_05_revoke_token( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_05_revoke_token(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test revoking a SAS token. This test runs LAST to avoid breaking other tests.""" test_logger.info("=" * 80) test_logger.info("TEST: test_05_revoke_token") @@ -342,11 +295,23 @@ def test_05_revoke_token( client = self.create_client(endpoint=planetarycomputer_endpoint) - # Generate a SAS token first + # Generate a SAS token first, with retry for transient PPE 503 errors + import time + test_logger.info("Step 1: Generating SAS token...") - token_response = client.shared_access_signature.get_token( - collection_id=planetarycomputer_collection_id, duration_in_minutes=60 - ) + max_retries = 3 + for attempt in range(max_retries): + try: + token_response = client.sas.get_token( + collection_id=planetarycomputer_collection_id, duration_in_minutes=60 + ) + break + except Exception as e: + if attempt < max_retries - 1: + test_logger.info(f"Attempt {attempt + 1} failed: {e}, retrying in 10s...") + time.sleep(10) + else: + raise test_logger.info(f"Token generated: {token_response.token[:50]}...") assert token_response is not None, "Token response should not be None" @@ -354,9 +319,18 @@ def test_05_revoke_token( token_response, SharedAccessSignatureToken ), f"Response should be SharedAccessSignatureToken, got {type(token_response)}" - # Revoke the token + # Revoke the token, with retry for transient PPE 503 errors test_logger.info("Step 2: Revoking token...") - client.shared_access_signature.revoke_token() + for attempt in range(max_retries): + try: + client.sas.revoke_token() + break + except Exception as e: + if attempt < max_retries - 1: + test_logger.info(f"Attempt {attempt + 1} failed: {e}, retrying in 10s...") + time.sleep(10) + else: + raise test_logger.info("Token revoked successfully (no exception thrown)") test_logger.info("Test PASSED\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_03_sas_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_03_sas_async.py index 846d61991b89..5ac1ba384d18 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_03_sas_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_03_sas_async.py @@ -8,6 +8,7 @@ """ import logging from pathlib import Path +import pytest from urllib.request import urlopen from datetime import datetime, timedelta, timezone import re @@ -54,12 +55,8 @@ async def test_01_get_token_with_default_duration( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_token(collection_id={planetarycomputer_collection_id})" - ) - response = await client.shared_access_signature.get_token( - collection_id=planetarycomputer_collection_id - ) + test_logger.info(f"Calling: get_token(collection_id={planetarycomputer_collection_id})") + response = await client.sas.get_token(collection_id=planetarycomputer_collection_id) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") @@ -75,9 +72,7 @@ async def test_01_get_token_with_default_duration( # Verify token format - in playback mode, entire token is sanitized to "Sanitized" if is_live(): # In live mode, verify SAS token format with regex - sas_token_pattern = ( - r"st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" - ) + sas_token_pattern = r"st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" assert re.search( sas_token_pattern, response.token ), "Token should match SAS token format (st, se, sp, sv, sr, sig)" @@ -87,23 +82,17 @@ async def test_01_get_token_with_default_duration( assert len(response.token) > 0, "Token should not be empty" # Verify expires_on is a datetime in the future - assert isinstance( - response.expires_on, datetime - ), "expires_on should be a datetime object" + assert isinstance(response.expires_on, datetime), "expires_on should be a datetime object" if is_live(): - assert response.expires_on > datetime.now( - timezone.utc - ), "Token expiry should be in the future" + assert response.expires_on > datetime.now(timezone.utc), "Token expiry should be in the future" # Verify default duration is approximately 24 hours (allow 5 minute tolerance for clock skew) if is_live(): now = datetime.now(timezone.utc) expected_expiry = now + timedelta(hours=24) time_diff = abs((response.expires_on - expected_expiry).total_seconds()) - assert ( - time_diff < 300 - ), f"Expiry should be ~24 hours from now (diff: {time_diff}s)" + assert time_diff < 300, f"Expiry should be ~24 hours from now (diff: {time_diff}s)" test_logger.info("Test PASSED\n") @@ -111,9 +100,7 @@ async def test_01_get_token_with_default_duration( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_02_get_token_with_custom_duration( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_02_get_token_with_custom_duration(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test generating a SAS token with custom duration.""" test_logger.info("=" * 80) test_logger.info("TEST: test_02_get_token_with_custom_duration") @@ -124,12 +111,8 @@ async def test_02_get_token_with_custom_duration( client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_token(collection_id={planetarycomputer_collection_id}, duration_in_minutes=60)" - ) - response = await client.shared_access_signature.get_token( - collection_id=planetarycomputer_collection_id, duration_in_minutes=60 - ) + test_logger.info(f"Calling: get_token(collection_id={planetarycomputer_collection_id}, duration_in_minutes=60)") + response = await client.sas.get_token(collection_id=planetarycomputer_collection_id, duration_in_minutes=60) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") @@ -145,9 +128,7 @@ async def test_02_get_token_with_custom_duration( # Verify token format - in playback mode, entire token is sanitized to "Sanitized" if is_live(): # In live mode, verify SAS token format with regex - sas_token_pattern = ( - r"st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" - ) + sas_token_pattern = r"st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" assert re.search( sas_token_pattern, response.token ), "Token should match SAS token format (st, se, sp, sv, sr, sig)" @@ -157,23 +138,17 @@ async def test_02_get_token_with_custom_duration( assert len(response.token) > 0, "Token should not be empty" # Verify expires_on is a datetime in the future - assert isinstance( - response.expires_on, datetime - ), "expires_on should be a datetime object" + assert isinstance(response.expires_on, datetime), "expires_on should be a datetime object" if is_live(): - assert response.expires_on > datetime.now( - timezone.utc - ), "Token expiry should be in the future" + assert response.expires_on > datetime.now(timezone.utc), "Token expiry should be in the future" # Verify custom duration is approximately 60 minutes (allow 5 minute tolerance for clock skew) if is_live(): now = datetime.now(timezone.utc) expected_expiry = now + timedelta(minutes=60) time_diff = abs((response.expires_on - expected_expiry).total_seconds()) - assert ( - time_diff < 300 - ), f"Expiry should be ~60 minutes from now (diff: {time_diff}s)" + assert time_diff < 300, f"Expiry should be ~60 minutes from now (diff: {time_diff}s)" test_logger.info("Test PASSED\n") @@ -194,9 +169,7 @@ async def test_03_get_sign_with_collection_thumbnail( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Getting collection...") - collection = await client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = await client.stac.get_collection(collection_id=planetarycomputer_collection_id) assert collection is not None assert collection.assets is not None @@ -207,7 +180,7 @@ async def test_03_get_sign_with_collection_thumbnail( assert original_href is not None test_logger.info(f"Calling: get_sign(href={original_href})") - response = await client.shared_access_signature.get_sign(href=original_href) + response = await client.sas.get_sign(href=original_href) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") @@ -227,43 +200,31 @@ async def test_03_get_sign_with_collection_thumbnail( test_logger.info(f"Has sig param: {'sig=' in signed_href.lower()}") # Verify signed HREF is different and contains SAS parameters - assert ( - signed_href != original_href - ), "Signed HREF should differ from original HREF" + assert signed_href != original_href, "Signed HREF should differ from original HREF" # Verify SAS parameters in HREF - skip regex in playback due to sanitization variations if is_live(): # In live mode, verify SAS HREF format with regex - sas_href_pattern = ( - r"\?.*st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" - ) + sas_href_pattern = r"\?.*st=[^&]+&se=[^&]+&sp=[^&]+&sv=[^&]+&sr=[^&]+&.*sig=[^&]+" assert re.search( sas_href_pattern, signed_href ), "Signed HREF should contain SAS parameters (st, se, sp, sv, sr, sig)" else: # In playback mode, just verify basic SAS structure exists assert "?" in signed_href, "Signed HREF should have query parameters" - assert ( - "sig=" in signed_href.lower() - ), "Signed HREF should contain signature parameter" + assert "sig=" in signed_href.lower(), "Signed HREF should contain signature parameter" # Verify expires_on is a datetime in the future (if present) if response.expires_on is not None: - assert isinstance( - response.expires_on, datetime - ), "expires_on should be a datetime object" + assert isinstance(response.expires_on, datetime), "expires_on should be a datetime object" if is_live(): - assert response.expires_on > datetime.now( - timezone.utc - ), "Token expiry should be in the future" + assert response.expires_on > datetime.now(timezone.utc), "Token expiry should be in the future" # Verify the signed HREF starts with the original base URL (strip query params first) original_base = original_href.split("?")[0] signed_base = signed_href.split("?")[0] - assert ( - signed_base == original_base - ), "Signed HREF should have the same base URL as original" + assert signed_base == original_base, "Signed HREF should have the same base URL as original" test_logger.info("Test PASSED\n") @@ -271,9 +232,7 @@ async def test_03_get_sign_with_collection_thumbnail( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_04_signed_href_can_download_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_04_signed_href_can_download_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test that a signed HREF can be used to download an asset. """ @@ -285,18 +244,20 @@ async def test_04_signed_href_can_download_asset( client = self.create_client(endpoint=planetarycomputer_endpoint) + # Revoke any cached delegation keys to ensure a fresh key is used. + # This is necessary when an ingestion source has been renewed, as the + # server may cache a stale delegation key from the previous source. + test_logger.info("Revoking cached delegation keys...") + await client.sas.revoke_token() + test_logger.info("Getting collection...") - collection = await client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = await client.stac.get_collection(collection_id=planetarycomputer_collection_id) assert "thumbnail" in collection.assets, "Collection does not have a thumbnail asset" thumbnail_href = collection.assets["thumbnail"].href test_logger.info(f"Thumbnail HREF: {thumbnail_href}") test_logger.info(f"Calling: get_sign(href={thumbnail_href})") - sign_response = await client.shared_access_signature.get_sign( - href=thumbnail_href - ) + sign_response = await client.sas.get_sign(href=thumbnail_href) signed_href = sign_response.href test_logger.info(f"Signed HREF: {signed_href}") @@ -317,15 +278,11 @@ async def test_04_signed_href_can_download_asset( test_logger.info(f"Content-Type: {content_type}") # Verify successful download - assert ( - download_response.status == 200 - ), f"Expected 200, got {download_response.status}" + assert download_response.status == 200, f"Expected 200, got {download_response.status}" assert len(content) > 0, "Downloaded content should not be empty" # Verify it's actually binary image data by checking PNG magic bytes - assert ( - content[:4] == b"\x89PNG" - ), "Downloaded content should be a PNG image" + assert content[:4] == b"\x89PNG", "Downloaded content should be a PNG image" break except Exception as e: if attempt < max_retries - 1: @@ -342,9 +299,7 @@ async def test_04_signed_href_can_download_asset( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_05_revoke_token( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_05_revoke_token(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """Test revoking a SAS token. This test runs LAST to avoid breaking other tests.""" test_logger.info("=" * 80) test_logger.info("TEST: test_05_revoke_token") @@ -354,11 +309,23 @@ async def test_05_revoke_token( client = self.create_client(endpoint=planetarycomputer_endpoint) - # Generate a SAS token first + # Generate a SAS token first, with retry for transient PPE 503 errors + import time + test_logger.info("Step 1: Generating SAS token...") - token_response = await client.shared_access_signature.get_token( - collection_id=planetarycomputer_collection_id, duration_in_minutes=60 - ) + max_retries = 3 + for attempt in range(max_retries): + try: + token_response = await client.sas.get_token( + collection_id=planetarycomputer_collection_id, duration_in_minutes=60 + ) + break + except Exception as e: + if attempt < max_retries - 1: + test_logger.info(f"Attempt {attempt + 1} failed: {e}, retrying in 10s...") + time.sleep(10) + else: + raise test_logger.info(f"Token generated: {token_response.token[:50]}...") assert token_response is not None, "Token response should not be None" @@ -366,9 +333,18 @@ async def test_05_revoke_token( token_response, SharedAccessSignatureToken ), f"Response should be SharedAccessSignatureToken, got {type(token_response)}" - # Revoke the token + # Revoke the token, with retry for transient PPE 503 errors test_logger.info("Step 2: Revoking token...") - await client.shared_access_signature.revoke_token() + for attempt in range(max_retries): + try: + await client.sas.revoke_token() + break + except Exception as e: + if attempt < max_retries - 1: + test_logger.info(f"Attempt {attempt + 1} failed: {e}, retrying in 10s...") + time.sleep(10) + else: + raise test_logger.info("Token revoked successfully (no exception thrown)") test_logger.info("Test PASSED\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_04_stac_item_tiler.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_04_stac_item_tiler.py index cca89f2bce67..d84e4c9adf87 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_04_stac_item_tiler.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_04_stac_item_tiler.py @@ -58,27 +58,19 @@ def test_01_get_tile_matrix_definitions(self, planetarycomputer_endpoint): client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - "Calling: get_tile_matrix_definitions(tile_matrix_set_id='WebMercatorQuad')" - ) - response = client.data.get_tile_matrix_definitions( - tile_matrix_set_id="WebMercatorQuad" - ) + test_logger.info("Calling: get_tile_matrix_definitions(tile_matrix_set_id='WebMercatorQuad')") + response = client.data.get_tile_matrix_definitions(tile_matrix_set_id="WebMercatorQuad") test_logger.info(f"Response type: {type(response)}") if hasattr(response, "as_dict"): response_dict = response.as_dict() test_logger.info(f"Response keys: {list(response_dict.keys())}") - test_logger.info( - f"Number of tile matrices: {len(response_dict.get('tileMatrices', []))}" - ) + test_logger.info(f"Number of tile matrices: {len(response_dict.get('tileMatrices', []))}") # Assert basic structure assert response is not None, "Response should not be None" assert hasattr(response, "id"), "Response should have id attribute" - assert ( - response.id is not None and len(response.id) > 0 - ), f"ID should not be empty, got {response.id}" + assert response.id is not None and len(response.id) > 0, f"ID should not be empty, got {response.id}" # Note: In playback mode, ID may be "Sanitized" due to test proxy sanitization assert hasattr(response, "tile_matrices"), "Response should have tile_matrices" assert len(response.tile_matrices) > 0, "Should have at least one tile matrix" @@ -86,13 +78,9 @@ def test_01_get_tile_matrix_definitions(self, planetarycomputer_endpoint): # Validate tile matrix structure first_matrix = response.tile_matrices[0] assert hasattr(first_matrix, "id"), "Tile matrix should have id" - assert hasattr( - first_matrix, "scale_denominator" - ), "Tile matrix should have scale_denominator" + assert hasattr(first_matrix, "scale_denominator"), "Tile matrix should have scale_denominator" assert hasattr(first_matrix, "tile_width"), "Tile matrix should have tile_width" - assert hasattr( - first_matrix, "tile_height" - ), "Tile matrix should have tile_height" + assert hasattr(first_matrix, "tile_height"), "Tile matrix should have tile_height" assert first_matrix.tile_width == 256, "Standard tile width should be 256" assert first_matrix.tile_height == 256, "Standard tile height should be 256" @@ -123,9 +111,7 @@ def test_02_list_tile_matrices(self, planetarycomputer_endpoint): test_logger.info(f"Number of tile matrices: {len(response)}") # Assert response is a list - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" assert len(response) > 0, "Should have at least one tile matrix" # Check for expected tile matrix sets @@ -134,9 +120,7 @@ def test_02_list_tile_matrices(self, planetarycomputer_endpoint): # All items should be strings for item in response: - assert isinstance( - item, str - ), f"Each item should be a string, got {type(item)}" + assert isinstance(item, str), f"Each item should be a string, got {type(item)}" test_logger.info("Test PASSED\n") @@ -167,28 +151,22 @@ def test_03_list_available_assets( test_logger.info( f"Calling: list_available_assets(collection_id='{planetarycomputer_collection_id}', item_id='{planetarycomputer_item_id}')" ) - response = client.data.list_available_assets( + response = client.data.list_item_available_assets( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, ) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") - test_logger.info( - f"Number of assets: {len(response) if isinstance(response, list) else 'N/A'}" - ) + test_logger.info(f"Number of assets: {len(response) if isinstance(response, list) else 'N/A'}") # Assert response is a list - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" assert len(response) > 0, "Should have at least one asset" # All items should be strings for asset in response: - assert isinstance( - asset, str - ), f"Each asset should be a string, got {type(asset)}" + assert isinstance(asset, str), f"Each asset should be a string, got {type(asset)}" assert len(asset) > 0, "Asset name should not be empty" test_logger.info("Test PASSED\n") @@ -220,7 +198,7 @@ def test_04_get_bounds( test_logger.info( f"Calling: list_bounds(collection_id='{planetarycomputer_collection_id}', item_id='{planetarycomputer_item_id}')" ) - response = client.data.get_bounds( + response = client.data.get_item_bounds( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, ) @@ -237,16 +215,12 @@ def test_04_get_bounds( # Assert bounds is a list with 4 coordinates assert isinstance(bounds, list), f"Bounds should be a list, got {type(bounds)}" - assert ( - len(bounds) == 4 - ), f"Bounds should have 4 coordinates [minx, miny, maxx, maxy], got {len(bounds)}" + assert len(bounds) == 4, f"Bounds should have 4 coordinates [minx, miny, maxx, maxy], got {len(bounds)}" # Validate coordinate structure: [minx, miny, maxx, maxy] minx, miny, maxx, maxy = bounds for coord in bounds: - assert isinstance( - coord, (int, float) - ), f"Each coordinate should be numeric, got {type(coord)}" + assert isinstance(coord, (int, float)), f"Each coordinate should be numeric, got {type(coord)}" # Validate bounds logic assert minx < maxx, f"minx ({minx}) should be less than maxx ({maxx})" @@ -281,14 +255,14 @@ def test_05_get_preview( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Calling: get_preview(...)") - response = client.data.get_preview( + response = client.data.get_item_preview( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, format=TilerImageFormat.PNG, width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) test_logger.info(f"Response type: {type(response)}") @@ -301,12 +275,8 @@ def test_05_get_preview( # Verify PNG magic bytes png_magic = b"\x89PNG\r\n\x1a\n" assert len(image_bytes) > 0, "Image bytes should not be empty" - assert ( - len(image_bytes) > 100 - ), f"Image should be substantial, got only {len(image_bytes)} bytes" - assert ( - image_bytes[:8] == png_magic - ), "Response should be a valid PNG image (magic bytes mismatch)" + assert len(image_bytes) > 100, f"Image should be substantial, got only {len(image_bytes)} bytes" + assert image_bytes[:8] == png_magic, "Response should be a valid PNG image (magic bytes mismatch)" # Parse and validate the PNG image try: @@ -318,13 +288,9 @@ def test_05_get_preview( test_logger.info(f"PIL Image mode: {image.mode}") # Validate image properties - assert ( - image.format == "PNG" - ), f"Image format should be PNG, got {image.format}" + assert image.format == "PNG", f"Image format should be PNG, got {image.format}" width, height = image.size - assert ( - width > 0 and height > 0 - ), f"Image should have non-zero dimensions, got {width}x{height}" + assert width > 0 and height > 0, f"Image should have non-zero dimensions, got {width}x{height}" # Note: Actual dimensions may differ slightly from requested due to aspect ratio preservation except ImportError: @@ -357,7 +323,7 @@ def test_06_get_info_geo_json( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Calling: get_info_geo_json(...)") - response = client.data.get_info_geo_json( + response = client.data.get_item_info_geo_json( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, assets=["image"], @@ -401,7 +367,7 @@ def test_07_list_statistics( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Calling: list_statistics(...)") - response = client.data.list_statistics( + response = client.data.list_item_statistics( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, assets=["image"], @@ -443,7 +409,7 @@ def test_08_get_wmts_capabilities( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Calling: get_wmts_capabilities(...)") - response = client.data.get_wmts_capabilities( + response = client.data.get_item_wmts_capabilities( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, tile_matrix_set_id="WebMercatorQuad", @@ -452,7 +418,7 @@ def test_08_get_wmts_capabilities( min_zoom=7, max_zoom=14, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) test_logger.info(f"Response type: {type(response)}") @@ -468,15 +434,9 @@ def test_08_get_wmts_capabilities( # Validate XML structure assert len(xml_bytes) > 0, "XML bytes should not be empty" # Note: WMTS Capabilities XML may not have 0 - ), f"ID should not be empty, got {response.id}" + assert response.id is not None and len(response.id) > 0, f"ID should not be empty, got {response.id}" # Note: In playback mode, ID may be "Sanitized" due to test proxy sanitization assert hasattr(response, "tile_matrices"), "Response should have tile_matrices" assert len(response.tile_matrices) > 0, "Should have at least one tile matrix" @@ -88,13 +80,9 @@ async def test_01_get_tile_matrix_definitions(self, planetarycomputer_endpoint): # Validate tile matrix structure first_matrix = response.tile_matrices[0] assert hasattr(first_matrix, "id"), "Tile matrix should have id" - assert hasattr( - first_matrix, "scale_denominator" - ), "Tile matrix should have scale_denominator" + assert hasattr(first_matrix, "scale_denominator"), "Tile matrix should have scale_denominator" assert hasattr(first_matrix, "tile_width"), "Tile matrix should have tile_width" - assert hasattr( - first_matrix, "tile_height" - ), "Tile matrix should have tile_height" + assert hasattr(first_matrix, "tile_height"), "Tile matrix should have tile_height" assert first_matrix.tile_width == 256, "Standard tile width should be 256" assert first_matrix.tile_height == 256, "Standard tile height should be 256" @@ -127,9 +115,7 @@ async def test_02_list_tile_matrices(self, planetarycomputer_endpoint): test_logger.info(f"Number of tile matrices: {len(response)}") # Assert response is a list - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" assert len(response) > 0, "Should have at least one tile matrix" # Check for expected tile matrix sets @@ -138,9 +124,7 @@ async def test_02_list_tile_matrices(self, planetarycomputer_endpoint): # All items should be strings for item in response: - assert isinstance( - item, str - ), f"Each item should be a string, got {type(item)}" + assert isinstance(item, str), f"Each item should be a string, got {type(item)}" test_logger.info("Test PASSED\n") @@ -173,28 +157,22 @@ async def test_03_list_available_assets( test_logger.info( f"Calling: list_available_assets(collection_id='{planetarycomputer_collection_id}', item_id='{planetarycomputer_item_id}')" ) - response = await client.data.list_available_assets( + response = await client.data.list_item_available_assets( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, ) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") - test_logger.info( - f"Number of assets: {len(response) if isinstance(response, list) else 'N/A'}" - ) + test_logger.info(f"Number of assets: {len(response) if isinstance(response, list) else 'N/A'}") # Assert response is a list - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" assert len(response) > 0, "Should have at least one asset" # All items should be strings for asset in response: - assert isinstance( - asset, str - ), f"Each asset should be a string, got {type(asset)}" + assert isinstance(asset, str), f"Each asset should be a string, got {type(asset)}" assert len(asset) > 0, "Asset name should not be empty" test_logger.info("Test PASSED\n") @@ -228,7 +206,7 @@ async def test_04_get_bounds( test_logger.info( f"Calling: list_bounds(collection_id='{planetarycomputer_collection_id}', item_id='{planetarycomputer_item_id}')" ) - response = await client.data.get_bounds( + response = await client.data.get_item_bounds( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, ) @@ -245,16 +223,12 @@ async def test_04_get_bounds( # Assert bounds is a list with 4 coordinates assert isinstance(bounds, list), f"Bounds should be a list, got {type(bounds)}" - assert ( - len(bounds) == 4 - ), f"Bounds should have 4 coordinates [minx, miny, maxx, maxy], got {len(bounds)}" + assert len(bounds) == 4, f"Bounds should have 4 coordinates [minx, miny, maxx, maxy], got {len(bounds)}" # Validate coordinate structure: [minx, miny, maxx, maxy] minx, miny, maxx, maxy = bounds for coord in bounds: - assert isinstance( - coord, (int, float) - ), f"Each coordinate should be numeric, got {type(coord)}" + assert isinstance(coord, (int, float)), f"Each coordinate should be numeric, got {type(coord)}" # Validate bounds logic assert minx < maxx, f"minx ({minx}) should be less than maxx ({maxx})" @@ -291,14 +265,14 @@ async def test_05_get_preview( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Calling: get_preview(...)") - response = await client.data.get_preview( + response = await client.data.get_item_preview( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, format=TilerImageFormat.PNG, width=512, height=512, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) test_logger.info(f"Response type: {type(response)}") @@ -311,12 +285,8 @@ async def test_05_get_preview( # Verify PNG magic bytes png_magic = b"\x89PNG\r\n\x1a\n" assert len(image_bytes) > 0, "Image bytes should not be empty" - assert ( - len(image_bytes) > 100 - ), f"Image should be substantial, got only {len(image_bytes)} bytes" - assert ( - image_bytes[:8] == png_magic - ), "Response should be a valid PNG image (magic bytes mismatch)" + assert len(image_bytes) > 100, f"Image should be substantial, got only {len(image_bytes)} bytes" + assert image_bytes[:8] == png_magic, "Response should be a valid PNG image (magic bytes mismatch)" # Parse and validate the PNG image try: @@ -328,13 +298,9 @@ async def test_05_get_preview( test_logger.info(f"PIL Image mode: {image.mode}") # Validate image properties - assert ( - image.format == "PNG" - ), f"Image format should be PNG, got {image.format}" + assert image.format == "PNG", f"Image format should be PNG, got {image.format}" width, height = image.size - assert ( - width > 0 and height > 0 - ), f"Image should have non-zero dimensions, got {width}x{height}" + assert width > 0 and height > 0, f"Image should have non-zero dimensions, got {width}x{height}" # Note: Actual dimensions may differ slightly from requested due to aspect ratio preservation except ImportError: @@ -369,7 +335,7 @@ async def test_06_get_info_geo_json( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Calling: get_info_geo_json(...)") - response = await client.data.get_info_geo_json( + response = await client.data.get_item_info_geo_json( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, assets=["image"], @@ -415,7 +381,7 @@ async def test_07_list_statistics( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Calling: list_statistics(...)") - response = await client.data.list_statistics( + response = await client.data.list_item_statistics( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, assets=["image"], @@ -459,7 +425,7 @@ async def test_08_get_wmts_capabilities( client = self.create_client(endpoint=planetarycomputer_endpoint) test_logger.info("Calling: get_wmts_capabilities(...)") - response = await client.data.get_wmts_capabilities( + response = await client.data.get_item_wmts_capabilities( collection_id=planetarycomputer_collection_id, item_id=planetarycomputer_item_id, tile_matrix_set_id="WebMercatorQuad", @@ -468,7 +434,7 @@ async def test_08_get_wmts_capabilities( min_zoom=7, max_zoom=14, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) test_logger.info(f"Response type: {type(response)}") @@ -484,15 +450,9 @@ async def test_08_get_wmts_capabilities( # Validate XML structure assert len(xml_bytes) > 0, "XML bytes should not be empty" # Note: WMTS Capabilities XML may not have 0, "Search ID should not be empty" test_logger.info(f"Search ID: {search_id}") @@ -113,9 +104,7 @@ def test_01_register_mosaics_search( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_02_get_mosaics_search_info( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_02_get_mosaics_search_info(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting mosaics search info. @@ -154,18 +143,14 @@ def test_02_get_mosaics_search_info( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) register_response = client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Registered search ID: {search_id}") test_logger.info(f"Calling: get_mosaics_search_info(search_id='{search_id}')") - response = client.data.get_mosaics_search_info(search_id=search_id) + response = client.data.get_searches_info(search_id=search_id) test_logger.info(f"Response type: {type(response)}") if hasattr(response, "as_dict"): @@ -182,9 +167,7 @@ def test_02_get_mosaics_search_info( assert hasattr(search, "hash"), "Search should have 'hash' attribute" search_hash = search.hash - assert isinstance( - search_hash, str - ), f"Search hash should be a string, got {type(search_hash)}" + assert isinstance(search_hash, str), f"Search hash should be a string, got {type(search_hash)}" assert len(search_hash) > 0, "Search hash should not be empty" test_logger.info(f"Search hash: {search_hash}") @@ -192,9 +175,7 @@ def test_02_get_mosaics_search_info( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_03_get_mosaics_tile_json( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_03_get_mosaics_tile_json(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting mosaics tile JSON. @@ -233,25 +214,21 @@ def test_03_get_mosaics_tile_json( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) register_response = client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Using search ID: {search_id}") test_logger.info("Calling: get_mosaics_tile_json(...)") - response = client.data.get_mosaics_tile_json( + response = client.data.get_searches_tile_json( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], tile_scale=1, min_zoom=9, - collection=planetarycomputer_collection_id, + collection_id=planetarycomputer_collection_id, tile_format="png", ) @@ -278,9 +255,7 @@ def test_03_get_mosaics_tile_json( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_04_get_mosaics_tile( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_04_get_mosaics_tile(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting a specific mosaic tile. @@ -320,18 +295,14 @@ def test_04_get_mosaics_tile( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) register_response = client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Using search ID: {search_id}") test_logger.info("Calling: get_mosaics_tile(...)") - response = client.data.get_mosaics_tile( + response = client.data.get_searches_tile_by_scale_and_format( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", z=13, @@ -340,7 +311,7 @@ def test_04_get_mosaics_tile( scale=1, format="png", assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], collection=planetarycomputer_collection_id, ) @@ -354,12 +325,8 @@ def test_04_get_mosaics_tile( # Verify PNG magic bytes png_magic = b"\x89PNG\r\n\x1a\n" assert len(image_bytes) > 0, "Image bytes should not be empty" - assert ( - len(image_bytes) > 100 - ), f"Image should be substantial, got only {len(image_bytes)} bytes" - assert ( - image_bytes[:8] == png_magic - ), "Response should be a valid PNG image (magic bytes mismatch)" + assert len(image_bytes) > 100, f"Image should be substantial, got only {len(image_bytes)} bytes" + assert image_bytes[:8] == png_magic, "Response should be a valid PNG image (magic bytes mismatch)" # Parse and validate the PNG image try: @@ -371,13 +338,9 @@ def test_04_get_mosaics_tile( test_logger.info(f"PIL Image mode: {image.mode}") # Validate image properties - assert ( - image.format == "PNG" - ), f"Image format should be PNG, got {image.format}" + assert image.format == "PNG", f"Image format should be PNG, got {image.format}" width, height = image.size - assert ( - width > 0 and height > 0 - ), f"Image should have non-zero dimensions, got {width}x{height}" + assert width > 0 and height > 0, f"Image should have non-zero dimensions, got {width}x{height}" except ImportError: test_logger.warning("PIL not available, skipping detailed image validation") @@ -386,9 +349,7 @@ def test_04_get_mosaics_tile( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_05_get_mosaics_wmts_capabilities( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_05_get_mosaics_wmts_capabilities(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting WMTS capabilities XML for mosaics. @@ -427,18 +388,14 @@ def test_05_get_mosaics_wmts_capabilities( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) register_response = client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Using search ID: {search_id}") test_logger.info("Calling: get_mosaics_wmts_capabilities(...)") - response = client.data.get_mosaics_wmts_capabilities( + response = client.data.get_searches_wmts_capabilities( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", tile_format=TilerImageFormat.PNG, @@ -446,7 +403,7 @@ def test_05_get_mosaics_wmts_capabilities( min_zoom=7, max_zoom=13, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) test_logger.info(f"Response type: {type(response)}") @@ -462,23 +419,15 @@ def test_05_get_mosaics_wmts_capabilities( # Validate XML structure assert len(xml_bytes) > 0, "XML bytes should not be empty" # Note: WMTS Capabilities XML may not have 0: @@ -562,20 +501,12 @@ def test_06_get_mosaics_assets_for_point( assert first_asset is not None, "First asset should not be None" # StacAsset behaves like a dict - access via key - asset_dict = ( - first_asset.as_dict() - if hasattr(first_asset, "as_dict") - else first_asset - ) - assert ( - "id" in asset_dict - ), f"Asset should have 'id' key, got keys: {list(asset_dict.keys())}" + asset_dict = first_asset.as_dict() if hasattr(first_asset, "as_dict") else first_asset + assert "id" in asset_dict, f"Asset should have 'id' key, got keys: {list(asset_dict.keys())}" asset_id = asset_dict["id"] test_logger.info(f"First asset ID: {asset_id}") - assert isinstance( - asset_id, str - ), f"Asset ID should be a string, got {type(asset_id)}" + assert isinstance(asset_id, str), f"Asset ID should be a string, got {type(asset_id)}" assert len(asset_id) > 0, "Asset ID should not be empty" else: test_logger.info("No assets returned for this point") @@ -584,9 +515,7 @@ def test_06_get_mosaics_assets_for_point( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_07_get_mosaics_assets_for_tile( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_07_get_mosaics_assets_for_tile(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting mosaic assets for a specific tile. @@ -626,18 +555,14 @@ def test_07_get_mosaics_assets_for_tile( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) register_response = client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Using search ID: {search_id}") test_logger.info("Calling: get_mosaics_assets_for_tile(...)") - response = client.data.get_mosaics_assets_for_tile( + response = client.data.get_searches_assets_for_tile( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", z=13, @@ -660,190 +585,166 @@ def test_07_get_mosaics_assets_for_tile( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_08_create_static_image( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): - """ - Test creating a static image from a mosaic search. - - Expected response: - - Object with image ID that can be used to retrieve the image - """ + def test_08_get_searches_point(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting point data from a mosaic search.""" test_logger.info("=" * 80) - test_logger.info("TEST: test_08_create_static_image") + test_logger.info("TEST: test_08_get_searches_point") test_logger.info("=" * 80) - test_logger.info(f"Input - endpoint: {planetarycomputer_endpoint}") - test_logger.info(f"Input - collection_id: {planetarycomputer_collection_id}") - - from azure.planetarycomputer.models import ( - ImageParameters, - Polygon, - ) client = self.create_client(endpoint=planetarycomputer_endpoint) - # Define geometry for the static image - geometry = Polygon( - coordinates=[ - [ - [-84.45378097481053, 33.6567321707079], - [-84.39805886744838, 33.6567321707079], - [-84.39805886744838, 33.61945681366625], - [-84.45378097481053, 33.61945681366625], - [-84.45378097481053, 33.6567321707079], - ] - ] - ) - - test_logger.info(f"Geometry: {geometry}") - - # Create CQL2-JSON filter - cql_filter = { - "op": "and", - "args": [ - { - "op": "=", - "args": [ - {"property": "collection"}, - planetarycomputer_collection_id, - ], - }, - { - "op": "anyinteracts", - "args": [ - {"property": "datetime"}, - {"interval": ["2023-01-01T00:00:00Z", "2023-12-31T00:00:00Z"]}, - ], - }, - ], + register_search_request = { + "collections": [planetarycomputer_collection_id], + "filter-lang": "cql2-json", + "filter": { + "op": "anyinteracts", + "args": [ + {"property": "datetime"}, + {"interval": ["2021-01-01T00:00:00Z", "2022-12-31T00:00:00Z"]}, + ], + }, } + register_response = client.data.register_mosaics_search(register_search_request) + search_id = register_response.search_id - # Create image request - image_request = ImageParameters( - cql=cql_filter, - zoom=13, - geometry=geometry, - render_parameters=f"assets=image&asset_bidx=image|1,2,3&collection={planetarycomputer_collection_id}", - columns=1080, - rows=1080, - image_size="1080x1080", - show_branding=False, + # Note: assets or expression is required for point queries (returns 400 without one) + response = client.data.get_searches_point( + search_id=search_id, + longitude=-84.3860, + latitude=33.6760, + assets=["image"], ) - test_logger.info( - f"Image request: columns={image_request.columns}, rows={image_request.rows}, zoom={image_request.zoom}" - ) + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_09_get_searches_bbox_crop(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting a bbox crop from a mosaic search.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_09_get_searches_bbox_crop") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info("Calling: create_static_image(...)") - response = client.data.create_static_image( - collection_id=planetarycomputer_collection_id, body=image_request + register_search_request = { + "collections": [planetarycomputer_collection_id], + "filter-lang": "cql2-json", + "filter": { + "op": "anyinteracts", + "args": [ + {"property": "datetime"}, + {"interval": ["2021-01-01T00:00:00Z", "2022-12-31T00:00:00Z"]}, + ], + }, + } + register_response = client.data.register_mosaics_search(register_search_request) + search_id = register_response.search_id + + response = client.data.get_searches_bbox_crop( + search_id=search_id, + minx=-84.3900, + miny=33.6800, + maxx=-84.3850, + maxy=33.6850, + format="png", + assets=["image"], + asset_band_indices=["image|1,2,3"], ) - test_logger.info(f"Response type: {type(response)}") - test_logger.info(f"Response: {response}") + image_bytes = b"".join(response) + test_logger.info(f"Image size: {len(image_bytes)} bytes") + assert len(image_bytes) > 0 - # Log response details based on type - if hasattr(response, "as_dict"): - response_dict = response.as_dict() - test_logger.info(f"Response dict keys: {list(response_dict.keys())}") - test_logger.info(f"Response dict: {response_dict}") + test_logger.info("Test PASSED\n") @PlanetaryComputerPreparer() @recorded_by_proxy - def test_09_get_static_image( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): - """ - Test retrieving a static image by ID. - - Expected response: - - Binary image data (streaming generator) - - Valid PNG format with magic bytes - """ + def test_10_crop_searches_feature_geo_json(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test cropping a mosaic search by GeoJSON feature.""" test_logger.info("=" * 80) - test_logger.info("TEST: test_09_get_static_image") + test_logger.info("TEST: test_10_crop_searches_feature_geo_json") test_logger.info("=" * 80) - test_logger.info(f"Input - endpoint: {planetarycomputer_endpoint}") - test_logger.info(f"Input - collection_id: {planetarycomputer_collection_id}") - from azure.planetarycomputer.models import ( - ImageParameters, - Polygon, - ) + from azure.planetarycomputer.models import Feature, FeatureType, Polygon client = self.create_client(endpoint=planetarycomputer_endpoint) - # First create a static image to get an ID - geometry = Polygon( - coordinates=[ - [ - [-84.45378097481053, 33.6567321707079], - [-84.39805886744838, 33.6567321707079], - [-84.39805886744838, 33.61945681366625], - [-84.45378097481053, 33.61945681366625], - [-84.45378097481053, 33.6567321707079], - ] - ] - ) - - cql_filter = { - "op": "and", - "args": [ - { - "op": "=", - "args": [ - {"property": "collection"}, - planetarycomputer_collection_id, - ], - }, - { - "op": "anyinteracts", - "args": [ - {"property": "datetime"}, - {"interval": ["2023-01-01T00:00:00Z", "2023-12-31T00:00:00Z"]}, - ], - }, - ], + register_search_request = { + "collections": [planetarycomputer_collection_id], + "filter-lang": "cql2-json", + "filter": { + "op": "anyinteracts", + "args": [ + {"property": "datetime"}, + {"interval": ["2021-01-01T00:00:00Z", "2022-12-31T00:00:00Z"]}, + ], + }, } + register_response = client.data.register_mosaics_search(register_search_request) + search_id = register_response.search_id - image_request = ImageParameters( - cql=cql_filter, - zoom=13, - geometry=geometry, - render_parameters=f"assets=image&asset_bidx=image|1,2,3&collection={planetarycomputer_collection_id}", - columns=1080, - rows=1080, - image_size="1080x1080", - show_branding=False, + geojson_feature = Feature( + type=FeatureType.FEATURE, + geometry=Polygon( + coordinates=[ + [ + [-84.3930, 33.6798], + [-84.3670, 33.6798], + [-84.3670, 33.7058], + [-84.3930, 33.7058], + [-84.3930, 33.6798], + ] + ] + ), + properties={}, ) - create_response = client.data.create_static_image( - collection_id=planetarycomputer_collection_id, body=image_request + response = client.data.crop_searches_feature_geo_json( + search_id=search_id, + body=geojson_feature, + assets=["image"], + asset_band_indices=["image|1,2,3"], ) - url = create_response.url + image_bytes = b"".join(response) + test_logger.info(f"Image size: {len(image_bytes)} bytes") + assert len(image_bytes) > 0 - # Extract image ID from URL - split by '?' to remove query params, then get last path segment - image_id = url.split("?")[0].split("/")[-1] + test_logger.info("Test PASSED\n") - test_logger.info(f"Created image with ID: {image_id}") - test_logger.info(f"Image URL: {url}") + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_11_list_searches_tilesets(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test listing tilesets for a mosaic search.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_11_list_searches_tilesets") + test_logger.info("=" * 80) - # Assert that we got a valid image ID - assert ( - image_id is not None and len(image_id) > 0 - ), f"Failed to get image ID from create_static_image response: {create_response}" + client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_static_image(collection_id='{planetarycomputer_collection_id}', id='{image_id}')" - ) - image_data = client.data.get_static_image( - collection_id=planetarycomputer_collection_id, id=image_id + register_search_request = { + "collections": [planetarycomputer_collection_id], + "filter-lang": "cql2-json", + "filter": { + "op": "anyinteracts", + "args": [ + {"property": "datetime"}, + {"interval": ["2021-01-01T00:00:00Z", "2022-12-31T00:00:00Z"]}, + ], + }, + } + register_response = client.data.register_mosaics_search(register_search_request) + search_id = register_response.search_id + + response = client.data.list_searches_tilesets( + search_id=search_id, ) - test_logger.info(f"Image data type: {type(image_data)}") + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" - # Collect the streaming response into bytes - image_bytes = b"".join(image_data) - test_logger.info(f"Image size: {len(image_bytes)} bytes") - test_logger.info(f"First 16 bytes (hex): {image_bytes[:16].hex()}") + test_logger.info("Test PASSED\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_05_mosaics_tiler_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_05_mosaics_tiler_async.py index d508d397071f..3fe91a94f97c 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_05_mosaics_tiler_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_05_mosaics_tiler_async.py @@ -9,6 +9,7 @@ import io import logging from pathlib import Path +import pytest from devtools_testutils.aio import recorded_by_proxy_async from devtools_testutils import recorded_by_proxy from testpreparer_async import PlanetaryComputerProClientTestBaseAsync @@ -43,9 +44,7 @@ class TestPlanetaryComputerMosaicsTilerAsync(PlanetaryComputerProClientTestBaseA @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_01_register_mosaics_search( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_01_register_mosaics_search(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test registering a mosaics search. @@ -84,11 +83,7 @@ async def test_01_register_mosaics_search( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) test_logger.info(f"Search request: {register_search_request}") @@ -100,14 +95,10 @@ async def test_01_register_mosaics_search( # Validate response structure assert response is not None, "Response should not be None" - assert hasattr( - response, "search_id" - ), "Response should have 'search_id' attribute" + assert hasattr(response, "search_id"), "Response should have 'search_id' attribute" search_id = response.search_id - assert isinstance( - search_id, str - ), f"Search ID should be a string, got {type(search_id)}" + assert isinstance(search_id, str), f"Search ID should be a string, got {type(search_id)}" assert len(search_id) > 0, "Search ID should not be empty" test_logger.info(f"Search ID: {search_id}") @@ -117,9 +108,7 @@ async def test_01_register_mosaics_search( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_02_get_mosaics_search_info( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_02_get_mosaics_search_info(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting mosaics search info. @@ -158,20 +147,14 @@ async def test_02_get_mosaics_search_info( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], - ) - register_response = await client.data.register_mosaics_search( - register_search_request + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) + register_response = await client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Registered search ID: {search_id}") test_logger.info(f"Calling: get_mosaics_search_info(search_id='{search_id}')") - response = await client.data.get_mosaics_search_info(search_id=search_id) + response = await client.data.get_searches_info(search_id=search_id) test_logger.info(f"Response type: {type(response)}") if hasattr(response, "as_dict"): @@ -188,9 +171,7 @@ async def test_02_get_mosaics_search_info( assert hasattr(search, "hash"), "Search should have 'hash' attribute" search_hash = search.hash - assert isinstance( - search_hash, str - ), f"Search hash should be a string, got {type(search_hash)}" + assert isinstance(search_hash, str), f"Search hash should be a string, got {type(search_hash)}" assert len(search_hash) > 0, "Search hash should not be empty" test_logger.info(f"Search hash: {search_hash}") @@ -200,9 +181,7 @@ async def test_02_get_mosaics_search_info( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_03_get_mosaics_tile_json( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_03_get_mosaics_tile_json(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting mosaics tile JSON. @@ -241,27 +220,21 @@ async def test_03_get_mosaics_tile_json( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], - ) - register_response = await client.data.register_mosaics_search( - register_search_request + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) + register_response = await client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Using search ID: {search_id}") test_logger.info("Calling: get_mosaics_tile_json(...)") - response = await client.data.get_mosaics_tile_json( + response = await client.data.get_searches_tile_json( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], tile_scale=1, min_zoom=9, - collection=planetarycomputer_collection_id, + collection_id=planetarycomputer_collection_id, tile_format="png", ) @@ -290,9 +263,7 @@ async def test_03_get_mosaics_tile_json( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_04_get_mosaics_tile( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_04_get_mosaics_tile(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting a specific mosaic tile. @@ -332,20 +303,14 @@ async def test_04_get_mosaics_tile( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], - ) - register_response = await client.data.register_mosaics_search( - register_search_request + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) + register_response = await client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Using search ID: {search_id}") test_logger.info("Calling: get_mosaics_tile(...)") - response = await client.data.get_mosaics_tile( + response = await client.data.get_searches_tile_by_scale_and_format( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", z=13, @@ -354,7 +319,7 @@ async def test_04_get_mosaics_tile( scale=1, format="png", assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], collection=planetarycomputer_collection_id, ) @@ -368,12 +333,8 @@ async def test_04_get_mosaics_tile( # Verify PNG magic bytes png_magic = b"\x89PNG\r\n\x1a\n" assert len(image_bytes) > 0, "Image bytes should not be empty" - assert ( - len(image_bytes) > 100 - ), f"Image should be substantial, got only {len(image_bytes)} bytes" - assert ( - image_bytes[:8] == png_magic - ), "Response should be a valid PNG image (magic bytes mismatch)" + assert len(image_bytes) > 100, f"Image should be substantial, got only {len(image_bytes)} bytes" + assert image_bytes[:8] == png_magic, "Response should be a valid PNG image (magic bytes mismatch)" # Parse and validate the PNG image try: @@ -385,13 +346,9 @@ async def test_04_get_mosaics_tile( test_logger.info(f"PIL Image mode: {image.mode}") # Validate image properties - assert ( - image.format == "PNG" - ), f"Image format should be PNG, got {image.format}" + assert image.format == "PNG", f"Image format should be PNG, got {image.format}" width, height = image.size - assert ( - width > 0 and height > 0 - ), f"Image should have non-zero dimensions, got {width}x{height}" + assert width > 0 and height > 0, f"Image should have non-zero dimensions, got {width}x{height}" except ImportError: test_logger.warning("PIL not available, skipping detailed image validation") @@ -402,9 +359,7 @@ async def test_04_get_mosaics_tile( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_05_get_mosaics_wmts_capabilities( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_05_get_mosaics_wmts_capabilities(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting WMTS capabilities XML for mosaics. @@ -443,20 +398,14 @@ async def test_05_get_mosaics_wmts_capabilities( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], - ) - register_response = await client.data.register_mosaics_search( - register_search_request + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) + register_response = await client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Using search ID: {search_id}") test_logger.info("Calling: get_mosaics_wmts_capabilities(...)") - response = await client.data.get_mosaics_wmts_capabilities( + response = await client.data.get_searches_wmts_capabilities( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", tile_format=TilerImageFormat.PNG, @@ -464,7 +413,7 @@ async def test_05_get_mosaics_wmts_capabilities( min_zoom=7, max_zoom=13, assets=["image"], - asset_band_indices="image|1,2,3", + asset_band_indices=["image|1,2,3"], ) test_logger.info(f"Response type: {type(response)}") @@ -480,15 +429,9 @@ async def test_05_get_mosaics_wmts_capabilities( # Validate XML structure assert len(xml_bytes) > 0, "XML bytes should not be empty" # Note: WMTS Capabilities XML may not have 0: @@ -584,20 +513,12 @@ async def test_06_get_mosaics_assets_for_point( assert first_asset is not None, "First asset should not be None" # StacAsset behaves like a dict - access via key - asset_dict = ( - first_asset.as_dict() - if hasattr(first_asset, "as_dict") - else first_asset - ) - assert ( - "id" in asset_dict - ), f"Asset should have 'id' key, got keys: {list(asset_dict.keys())}" + asset_dict = first_asset.as_dict() if hasattr(first_asset, "as_dict") else first_asset + assert "id" in asset_dict, f"Asset should have 'id' key, got keys: {list(asset_dict.keys())}" asset_id = asset_dict["id"] test_logger.info(f"First asset ID: {asset_id}") - assert isinstance( - asset_id, str - ), f"Asset ID should be a string, got {type(asset_id)}" + assert isinstance(asset_id, str), f"Asset ID should be a string, got {type(asset_id)}" assert len(asset_id) > 0, "Asset ID should not be empty" else: test_logger.info("No assets returned for this point") @@ -608,9 +529,7 @@ async def test_06_get_mosaics_assets_for_point( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_07_get_mosaics_assets_for_tile( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_07_get_mosaics_assets_for_tile(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test getting mosaic assets for a specific tile. @@ -650,20 +569,14 @@ async def test_07_get_mosaics_assets_for_tile( ], }, filter_lang=FilterLanguage.CQL2_JSON, - sort_by=[ - StacSortExtension( - direction=StacSearchSortingDirection.DESC, field="datetime" - ) - ], - ) - register_response = await client.data.register_mosaics_search( - register_search_request + sort_by=[StacSortExtension(direction=StacSearchSortingDirection.DESC, field="datetime")], ) + register_response = await client.data.register_mosaics_search(register_search_request) search_id = register_response.search_id test_logger.info(f"Using search ID: {search_id}") test_logger.info("Calling: get_mosaics_assets_for_tile(...)") - response = await client.data.get_mosaics_assets_for_tile( + response = await client.data.get_searches_assets_for_tile( search_id=search_id, tile_matrix_set_id="WebMercatorQuad", z=13, @@ -688,194 +601,170 @@ async def test_07_get_mosaics_assets_for_tile( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_08_create_static_image( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): - """ - Test creating a static image from a mosaic search. - - Expected response: - - Object with image ID that can be used to retrieve the image - """ + async def test_08_get_searches_point(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting point data from a mosaic search.""" test_logger.info("=" * 80) - test_logger.info("TEST: test_08_create_static_image") + test_logger.info("TEST: test_08_get_searches_point") test_logger.info("=" * 80) - test_logger.info(f"Input - endpoint: {planetarycomputer_endpoint}") - test_logger.info(f"Input - collection_id: {planetarycomputer_collection_id}") - - from azure.planetarycomputer.models import ( - ImageParameters, - Polygon, - ) client = self.create_client(endpoint=planetarycomputer_endpoint) - # Define geometry for the static image - geometry = Polygon( - coordinates=[ - [ - [-84.45378097481053, 33.6567321707079], - [-84.39805886744838, 33.6567321707079], - [-84.39805886744838, 33.61945681366625], - [-84.45378097481053, 33.61945681366625], - [-84.45378097481053, 33.6567321707079], - ] - ] - ) - - test_logger.info(f"Geometry: {geometry}") - - # Create CQL2-JSON filter - cql_filter = { - "op": "and", - "args": [ - { - "op": "=", - "args": [ - {"property": "collection"}, - planetarycomputer_collection_id, - ], - }, - { - "op": "anyinteracts", - "args": [ - {"property": "datetime"}, - {"interval": ["2023-01-01T00:00:00Z", "2023-12-31T00:00:00Z"]}, - ], - }, - ], + register_search_request = { + "collections": [planetarycomputer_collection_id], + "filter-lang": "cql2-json", + "filter": { + "op": "anyinteracts", + "args": [ + {"property": "datetime"}, + {"interval": ["2021-01-01T00:00:00Z", "2022-12-31T00:00:00Z"]}, + ], + }, } + register_response = await client.data.register_mosaics_search(register_search_request) + search_id = register_response.search_id - # Create image request - image_request = ImageParameters( - cql=cql_filter, - zoom=13, - geometry=geometry, - render_parameters=f"assets=image&asset_bidx=image|1,2,3&collection={planetarycomputer_collection_id}", - columns=1080, - rows=1080, - image_size="1080x1080", - show_branding=False, + # Note: assets or expression is required for point queries (returns 400 without one) + response = await client.data.get_searches_point( + search_id=search_id, + longitude=-84.3860, + latitude=33.6760, + assets=["image"], ) - test_logger.info( - f"Image request: columns={image_request.columns}, rows={image_request.rows}, zoom={image_request.zoom}" - ) + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" - test_logger.info("Calling: create_static_image(...)") - response = await client.data.create_static_image( - collection_id=planetarycomputer_collection_id, body=image_request - ) + test_logger.info("Test PASSED\n") + await self.close_client() - test_logger.info(f"Response type: {type(response)}") - test_logger.info(f"Response: {response}") + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_09_get_searches_bbox_crop(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting a bbox crop from a mosaic search.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_09_get_searches_bbox_crop") + test_logger.info("=" * 80) - # Log response details based on type - if hasattr(response, "as_dict"): - response_dict = response.as_dict() - test_logger.info(f"Response dict keys: {list(response_dict.keys())}") - test_logger.info(f"Response dict: {response_dict}") + client = self.create_client(endpoint=planetarycomputer_endpoint) + + register_search_request = { + "collections": [planetarycomputer_collection_id], + "filter-lang": "cql2-json", + "filter": { + "op": "anyinteracts", + "args": [ + {"property": "datetime"}, + {"interval": ["2021-01-01T00:00:00Z", "2022-12-31T00:00:00Z"]}, + ], + }, + } + register_response = await client.data.register_mosaics_search(register_search_request) + search_id = register_response.search_id + response = await client.data.get_searches_bbox_crop( + search_id=search_id, + minx=-84.3900, + miny=33.6800, + maxx=-84.3850, + maxy=33.6850, + format="png", + assets=["image"], + asset_band_indices=["image|1,2,3"], + ) + + image_bytes = b"".join([chunk async for chunk in response]) + test_logger.info(f"Image size: {len(image_bytes)} bytes") + assert len(image_bytes) > 0 + + test_logger.info("Test PASSED\n") await self.close_client() @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_09_get_static_image( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): - """ - Test retrieving a static image by ID. - - Expected response: - - Binary image data (streaming generator) - - Valid PNG format with magic bytes - """ + async def test_10_crop_searches_feature_geo_json(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test cropping a mosaic search by GeoJSON feature.""" test_logger.info("=" * 80) - test_logger.info("TEST: test_09_get_static_image") + test_logger.info("TEST: test_10_crop_searches_feature_geo_json") test_logger.info("=" * 80) - test_logger.info(f"Input - endpoint: {planetarycomputer_endpoint}") - test_logger.info(f"Input - collection_id: {planetarycomputer_collection_id}") - from azure.planetarycomputer.models import ( - ImageParameters, - Polygon, - ) + from azure.planetarycomputer.models import Feature, FeatureType, Polygon client = self.create_client(endpoint=planetarycomputer_endpoint) - # First create a static image to get an ID - geometry = Polygon( - coordinates=[ - [ - [-84.45378097481053, 33.6567321707079], - [-84.39805886744838, 33.6567321707079], - [-84.39805886744838, 33.61945681366625], - [-84.45378097481053, 33.61945681366625], - [-84.45378097481053, 33.6567321707079], - ] - ] - ) - - cql_filter = { - "op": "and", - "args": [ - { - "op": "=", - "args": [ - {"property": "collection"}, - planetarycomputer_collection_id, - ], - }, - { - "op": "anyinteracts", - "args": [ - {"property": "datetime"}, - {"interval": ["2023-01-01T00:00:00Z", "2023-12-31T00:00:00Z"]}, - ], - }, - ], + register_search_request = { + "collections": [planetarycomputer_collection_id], + "filter-lang": "cql2-json", + "filter": { + "op": "anyinteracts", + "args": [ + {"property": "datetime"}, + {"interval": ["2021-01-01T00:00:00Z", "2022-12-31T00:00:00Z"]}, + ], + }, } + register_response = await client.data.register_mosaics_search(register_search_request) + search_id = register_response.search_id - image_request = ImageParameters( - cql=cql_filter, - zoom=13, - geometry=geometry, - render_parameters=f"assets=image&asset_bidx=image|1,2,3&collection={planetarycomputer_collection_id}", - columns=1080, - rows=1080, - image_size="1080x1080", - show_branding=False, + geojson_feature = Feature( + type=FeatureType.FEATURE, + geometry=Polygon( + coordinates=[ + [ + [-84.3930, 33.6798], + [-84.3670, 33.6798], + [-84.3670, 33.7058], + [-84.3930, 33.7058], + [-84.3930, 33.6798], + ] + ] + ), + properties={}, ) - create_response = await client.data.create_static_image( - collection_id=planetarycomputer_collection_id, body=image_request + response = await client.data.crop_searches_feature_geo_json( + search_id=search_id, + body=geojson_feature, + assets=["image"], + asset_band_indices=["image|1,2,3"], ) - url = create_response.url + image_bytes = b"".join([chunk async for chunk in response]) + test_logger.info(f"Image size: {len(image_bytes)} bytes") + assert len(image_bytes) > 0 - # Extract image ID from URL - split by '?' to remove query params, then get last path segment - image_id = url.split("?")[0].split("/")[-1] + test_logger.info("Test PASSED\n") + await self.close_client() - test_logger.info(f"Created image with ID: {image_id}") - test_logger.info(f"Image URL: {url}") + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_11_list_searches_tilesets(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test listing tilesets for a mosaic search.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_11_list_searches_tilesets") + test_logger.info("=" * 80) - # Assert that we got a valid image ID - assert ( - image_id is not None and len(image_id) > 0 - ), f"Failed to get image ID from create_static_image response: {create_response}" + client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_static_image(collection_id='{planetarycomputer_collection_id}', id='{image_id}')" - ) - image_data = await client.data.get_static_image( - collection_id=planetarycomputer_collection_id, id=image_id - ) + register_search_request = { + "collections": [planetarycomputer_collection_id], + "filter-lang": "cql2-json", + "filter": { + "op": "anyinteracts", + "args": [ + {"property": "datetime"}, + {"interval": ["2021-01-01T00:00:00Z", "2022-12-31T00:00:00Z"]}, + ], + }, + } + register_response = await client.data.register_mosaics_search(register_search_request) + search_id = register_response.search_id - test_logger.info(f"Image data type: {type(image_data)}") + response = await client.data.list_searches_tilesets( + search_id=search_id, + ) - # Collect the streaming response into bytes - image_bytes = b"".join([chunk async for chunk in image_data]) - test_logger.info(f"Image size: {len(image_bytes)} bytes") - test_logger.info(f"First 16 bytes (hex): {image_bytes[:16].hex()}") + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + test_logger.info("Test PASSED\n") await self.close_client() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends.py index f658b36aafac..23db948d993b 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends.py @@ -53,9 +53,7 @@ def test_01_get_class_map_legend(self, planetarycomputer_endpoint): client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_class_map_legend(classmap_name={ColorMapNames.MTBS_SEVERITY})" - ) + test_logger.info(f"Calling: get_class_map_legend(classmap_name={ColorMapNames.MTBS_SEVERITY})") response = client.data.get_class_map_legend( classmap_name=ColorMapNames.MTBS_SEVERITY, ) @@ -70,26 +68,18 @@ def test_01_get_class_map_legend(self, planetarycomputer_endpoint): # Assert MTBS Severity classes are present (0-6) expected_classes = ["0", "1", "2", "3", "4", "5", "6"] for class_value in expected_classes: - assert ( - class_value in response - ), f"Class '{class_value}' should be in response" + assert class_value in response, f"Class '{class_value}' should be in response" # Validate color structure for each class for class_value, color in response.items(): # Each color should be a list/array of 4 RGBA values - assert isinstance( - color, (list, tuple) - ), f"Color for class '{class_value}' should be a list/tuple" - assert ( - len(color) == 4 - ), f"Color for class '{class_value}' should have 4 RGBA values, got {len(color)}" + assert isinstance(color, (list, tuple)), f"Color for class '{class_value}' should be a list/tuple" + assert len(color) == 4, f"Color for class '{class_value}' should have 4 RGBA values, got {len(color)}" # Each RGBA component should be an integer 0-255 for i, component in enumerate(color): component_name = ["R", "G", "B", "A"][i] - assert isinstance( - component, int - ), f"{component_name} for class '{class_value}' should be int" + assert isinstance(component, int), f"{component_name} for class '{class_value}' should be int" assert ( 0 <= component <= 255 ), f"{component_name} for class '{class_value}' should be 0-255, got {component}" @@ -99,9 +89,7 @@ def test_01_get_class_map_legend(self, planetarycomputer_endpoint): assert response["0"] == [0, 0, 0, 0], "Class 0 should be transparent black" # Class 4: Red (high severity) - assert ( - response["4"][0] == 255 - ), "Class 4 (high severity) should have high red component" + assert response["4"][0] == 255, "Class 4 (high severity) should have high red component" test_logger.info("Test PASSED\n") @@ -124,46 +112,30 @@ def test_02_get_interval_legend(self, planetarycomputer_endpoint): client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_interval_legend(classmap_name={ColorMapNames.MODIS64_A1})" - ) - response = client.data.get_interval_legend( - classmap_name=ColorMapNames.MODIS64_A1 - ) + test_logger.info(f"Calling: get_interval_legend(classmap_name={ColorMapNames.MODIS64_A1})") + response = client.data.get_interval_legend(classmap_name=ColorMapNames.MODIS64_A1) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") # Assert response is a list - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" assert len(response) > 0, "Response should not be empty" # Validate each interval structure for idx, interval in enumerate(response): # Each interval should be a list with 2 elements: [range, color] assert isinstance(interval, list), f"Interval {idx} should be a list" - assert ( - len(interval) == 2 - ), f"Interval {idx} should have 2 elements: [[min, max], [R, G, B, A]]" + assert len(interval) == 2, f"Interval {idx} should have 2 elements: [[min, max], [R, G, B, A]]" # Validate range component value_range = interval[0] - assert isinstance( - value_range, list - ), f"Interval {idx} range should be a list" + assert isinstance(value_range, list), f"Interval {idx} range should be a list" assert len(value_range) == 2, f"Interval {idx} range should have [min, max]" min_val, max_val = value_range - assert isinstance( - min_val, (int, float) - ), f"Interval {idx} min should be numeric" - assert isinstance( - max_val, (int, float) - ), f"Interval {idx} max should be numeric" - assert ( - min_val <= max_val - ), f"Interval {idx} min ({min_val}) should be <= max ({max_val})" + assert isinstance(min_val, (int, float)), f"Interval {idx} min should be numeric" + assert isinstance(max_val, (int, float)), f"Interval {idx} max should be numeric" + assert min_val <= max_val, f"Interval {idx} min ({min_val}) should be <= max ({max_val})" # Validate color component color = interval[1] @@ -171,12 +143,8 @@ def test_02_get_interval_legend(self, planetarycomputer_endpoint): assert len(color) == 4, f"Interval {idx} color should have 4 RGBA values" for i, component in enumerate(color): component_name = ["R", "G", "B", "A"][i] - assert isinstance( - component, int - ), f"Interval {idx} {component_name} should be int" - assert ( - 0 <= component <= 255 - ), f"Interval {idx} {component_name} should be 0-255" + assert isinstance(component, int), f"Interval {idx} {component_name} should be int" + assert 0 <= component <= 255, f"Interval {idx} {component_name} should be 0-255" # Validate intervals are sequential (each max should connect to next min) for i in range(len(response) - 1): @@ -223,18 +191,12 @@ def test_03_get_legend_as_png(self, planetarycomputer_endpoint): # Verify PNG magic bytes (89 50 4E 47 0D 0A 1A 0A) png_magic = b"\x89PNG\r\n\x1a\n" test_logger.info(f"PNG magic bytes: {png_magic.hex()}") - test_logger.info( - f"Response starts with PNG magic: {legend_bytes[:8] == png_magic}" - ) + test_logger.info(f"Response starts with PNG magic: {legend_bytes[:8] == png_magic}") # Assert response is valid PNG assert len(legend_bytes) > 0, "Legend bytes should not be empty" - assert ( - len(legend_bytes) > 100 - ), f"Legend should be substantial image, got only {len(legend_bytes)} bytes" - assert ( - legend_bytes[:8] == png_magic - ), "Response should be a valid PNG image (magic bytes mismatch)" + assert len(legend_bytes) > 100, f"Legend should be substantial image, got only {len(legend_bytes)} bytes" + assert legend_bytes[:8] == png_magic, "Response should be a valid PNG image (magic bytes mismatch)" # Parse and validate the PNG image try: @@ -250,19 +212,13 @@ def test_03_get_legend_as_png(self, planetarycomputer_endpoint): # Image dimensions should be non-zero width, height = legend_image.size - assert ( - width > 0 and height > 0 - ), f"Image should have non-zero dimensions, got {width}x{height}" + assert width > 0 and height > 0, f"Image should have non-zero dimensions, got {width}x{height}" # Typical legend is horizontal (width >> height) - assert ( - width > height - ), f"Legend should be horizontal (width > height), got {width}x{height}" + assert width > height, f"Legend should be horizontal (width > height), got {width}x{height}" # Color mode should be RGBA (with alpha channel) - assert ( - legend_image.mode == "RGBA" - ), f"Image mode should be RGBA, got {legend_image.mode}" + assert legend_image.mode == "RGBA", f"Image mode should be RGBA, got {legend_image.mode}" except ImportError: test_logger.warning("PIL not available, skipping image parsing") @@ -297,9 +253,7 @@ def test_04_get_legend_with_different_colormap(self, planetarycomputer_endpoint) # Verify PNG magic bytes png_magic = b"\x89PNG\r\n\x1a\n" assert len(legend_bytes) > 0, "Legend bytes should not be empty" - assert ( - len(legend_bytes) > 100 - ), f"Legend should be substantial image, got only {len(legend_bytes)} bytes" + assert len(legend_bytes) > 100, f"Legend should be substantial image, got only {len(legend_bytes)} bytes" assert legend_bytes[:8] == png_magic, "Response should be a valid PNG image" # Parse and validate the PNG image @@ -338,9 +292,7 @@ def test_05_class_map_legend_structure(self, planetarycomputer_endpoint): client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_class_map_legend(classmap_name={ColorMapNames.MTBS_SEVERITY})" - ) + test_logger.info(f"Calling: get_class_map_legend(classmap_name={ColorMapNames.MTBS_SEVERITY})") response = client.data.get_class_map_legend( classmap_name=ColorMapNames.MTBS_SEVERITY, ) @@ -364,16 +316,10 @@ def test_05_class_map_legend_structure(self, planetarycomputer_endpoint): ), "All color components should be integers 0-255" # Validate that different classes have different colors (except transparent) - non_transparent_colors = [ - tuple(c) for c in all_colors if c[3] != 0 - ] # Exclude transparent + non_transparent_colors = [tuple(c) for c in all_colors if c[3] != 0] # Exclude transparent # Convert to set to check uniqueness unique_colors = set(non_transparent_colors) - assert ( - len(unique_colors) > 1 - ), "Non-transparent classes should have different colors" + assert len(unique_colors) > 1, "Non-transparent classes should have different colors" - test_logger.info( - f"Found {len(response)} classes with {len(unique_colors)} unique non-transparent colors" - ) + test_logger.info(f"Found {len(response)} classes with {len(unique_colors)} unique non-transparent colors") test_logger.info("Test PASSED\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends_async.py index 4a6738ba7256..95b07d39cd75 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends_async.py @@ -55,9 +55,7 @@ async def test_01_get_class_map_legend(self, planetarycomputer_endpoint): client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_class_map_legend(classmap_name={ColorMapNames.MTBS_SEVERITY})" - ) + test_logger.info(f"Calling: get_class_map_legend(classmap_name={ColorMapNames.MTBS_SEVERITY})") response = await client.data.get_class_map_legend( classmap_name=ColorMapNames.MTBS_SEVERITY, ) @@ -72,26 +70,18 @@ async def test_01_get_class_map_legend(self, planetarycomputer_endpoint): # Assert MTBS Severity classes are present (0-6) expected_classes = ["0", "1", "2", "3", "4", "5", "6"] for class_value in expected_classes: - assert ( - class_value in response - ), f"Class '{class_value}' should be in response" + assert class_value in response, f"Class '{class_value}' should be in response" # Validate color structure for each class for class_value, color in response.items(): # Each color should be a list/array of 4 RGBA values - assert isinstance( - color, (list, tuple) - ), f"Color for class '{class_value}' should be a list/tuple" - assert ( - len(color) == 4 - ), f"Color for class '{class_value}' should have 4 RGBA values, got {len(color)}" + assert isinstance(color, (list, tuple)), f"Color for class '{class_value}' should be a list/tuple" + assert len(color) == 4, f"Color for class '{class_value}' should have 4 RGBA values, got {len(color)}" # Each RGBA component should be an integer 0-255 for i, component in enumerate(color): component_name = ["R", "G", "B", "A"][i] - assert isinstance( - component, int - ), f"{component_name} for class '{class_value}' should be int" + assert isinstance(component, int), f"{component_name} for class '{class_value}' should be int" assert ( 0 <= component <= 255 ), f"{component_name} for class '{class_value}' should be 0-255, got {component}" @@ -101,9 +91,7 @@ async def test_01_get_class_map_legend(self, planetarycomputer_endpoint): assert response["0"] == [0, 0, 0, 0], "Class 0 should be transparent black" # Class 4: Red (high severity) - assert ( - response["4"][0] == 255 - ), "Class 4 (high severity) should have high red component" + assert response["4"][0] == 255, "Class 4 (high severity) should have high red component" test_logger.info("Test PASSED\n") @@ -128,46 +116,30 @@ async def test_02_get_interval_legend(self, planetarycomputer_endpoint): client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_interval_legend(classmap_name={ColorMapNames.MODIS64_A1})" - ) - response = await client.data.get_interval_legend( - classmap_name=ColorMapNames.MODIS64_A1 - ) + test_logger.info(f"Calling: get_interval_legend(classmap_name={ColorMapNames.MODIS64_A1})") + response = await client.data.get_interval_legend(classmap_name=ColorMapNames.MODIS64_A1) test_logger.info(f"Response type: {type(response)}") test_logger.info(f"Response: {response}") # Assert response is a list - assert isinstance( - response, list - ), f"Response should be a list, got {type(response)}" + assert isinstance(response, list), f"Response should be a list, got {type(response)}" assert len(response) > 0, "Response should not be empty" # Validate each interval structure for idx, interval in enumerate(response): # Each interval should be a list with 2 elements: [range, color] assert isinstance(interval, list), f"Interval {idx} should be a list" - assert ( - len(interval) == 2 - ), f"Interval {idx} should have 2 elements: [[min, max], [R, G, B, A]]" + assert len(interval) == 2, f"Interval {idx} should have 2 elements: [[min, max], [R, G, B, A]]" # Validate range component value_range = interval[0] - assert isinstance( - value_range, list - ), f"Interval {idx} range should be a list" + assert isinstance(value_range, list), f"Interval {idx} range should be a list" assert len(value_range) == 2, f"Interval {idx} range should have [min, max]" min_val, max_val = value_range - assert isinstance( - min_val, (int, float) - ), f"Interval {idx} min should be numeric" - assert isinstance( - max_val, (int, float) - ), f"Interval {idx} max should be numeric" - assert ( - min_val <= max_val - ), f"Interval {idx} min ({min_val}) should be <= max ({max_val})" + assert isinstance(min_val, (int, float)), f"Interval {idx} min should be numeric" + assert isinstance(max_val, (int, float)), f"Interval {idx} max should be numeric" + assert min_val <= max_val, f"Interval {idx} min ({min_val}) should be <= max ({max_val})" # Validate color component color = interval[1] @@ -175,12 +147,8 @@ async def test_02_get_interval_legend(self, planetarycomputer_endpoint): assert len(color) == 4, f"Interval {idx} color should have 4 RGBA values" for i, component in enumerate(color): component_name = ["R", "G", "B", "A"][i] - assert isinstance( - component, int - ), f"Interval {idx} {component_name} should be int" - assert ( - 0 <= component <= 255 - ), f"Interval {idx} {component_name} should be 0-255" + assert isinstance(component, int), f"Interval {idx} {component_name} should be int" + assert 0 <= component <= 255, f"Interval {idx} {component_name} should be 0-255" # Validate intervals are sequential (each max should connect to next min) for i in range(len(response) - 1): @@ -229,18 +197,12 @@ async def test_03_get_legend_as_png(self, planetarycomputer_endpoint): # Verify PNG magic bytes (89 50 4E 47 0D 0A 1A 0A) png_magic = b"\x89PNG\r\n\x1a\n" test_logger.info(f"PNG magic bytes: {png_magic.hex()}") - test_logger.info( - f"Response starts with PNG magic: {legend_bytes[:8] == png_magic}" - ) + test_logger.info(f"Response starts with PNG magic: {legend_bytes[:8] == png_magic}") # Assert response is valid PNG assert len(legend_bytes) > 0, "Legend bytes should not be empty" - assert ( - len(legend_bytes) > 100 - ), f"Legend should be substantial image, got only {len(legend_bytes)} bytes" - assert ( - legend_bytes[:8] == png_magic - ), "Response should be a valid PNG image (magic bytes mismatch)" + assert len(legend_bytes) > 100, f"Legend should be substantial image, got only {len(legend_bytes)} bytes" + assert legend_bytes[:8] == png_magic, "Response should be a valid PNG image (magic bytes mismatch)" # Parse and validate the PNG image try: @@ -256,19 +218,13 @@ async def test_03_get_legend_as_png(self, planetarycomputer_endpoint): # Image dimensions should be non-zero width, height = legend_image.size - assert ( - width > 0 and height > 0 - ), f"Image should have non-zero dimensions, got {width}x{height}" + assert width > 0 and height > 0, f"Image should have non-zero dimensions, got {width}x{height}" # Typical legend is horizontal (width >> height) - assert ( - width > height - ), f"Legend should be horizontal (width > height), got {width}x{height}" + assert width > height, f"Legend should be horizontal (width > height), got {width}x{height}" # Color mode should be RGBA (with alpha channel) - assert ( - legend_image.mode == "RGBA" - ), f"Image mode should be RGBA, got {legend_image.mode}" + assert legend_image.mode == "RGBA", f"Image mode should be RGBA, got {legend_image.mode}" except ImportError: test_logger.warning("PIL not available, skipping image parsing") @@ -279,9 +235,7 @@ async def test_03_get_legend_as_png(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_04_get_legend_with_different_colormap( - self, planetarycomputer_endpoint - ): + async def test_04_get_legend_with_different_colormap(self, planetarycomputer_endpoint): """ Test getting a legend with a different color map (viridis). @@ -307,9 +261,7 @@ async def test_04_get_legend_with_different_colormap( # Verify PNG magic bytes png_magic = b"\x89PNG\r\n\x1a\n" assert len(legend_bytes) > 0, "Legend bytes should not be empty" - assert ( - len(legend_bytes) > 100 - ), f"Legend should be substantial image, got only {len(legend_bytes)} bytes" + assert len(legend_bytes) > 100, f"Legend should be substantial image, got only {len(legend_bytes)} bytes" assert legend_bytes[:8] == png_magic, "Response should be a valid PNG image" # Parse and validate the PNG image @@ -350,9 +302,7 @@ async def test_05_class_map_legend_structure(self, planetarycomputer_endpoint): client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info( - f"Calling: get_class_map_legend(classmap_name={ColorMapNames.MTBS_SEVERITY})" - ) + test_logger.info(f"Calling: get_class_map_legend(classmap_name={ColorMapNames.MTBS_SEVERITY})") response = await client.data.get_class_map_legend( classmap_name=ColorMapNames.MTBS_SEVERITY, ) @@ -376,18 +326,12 @@ async def test_05_class_map_legend_structure(self, planetarycomputer_endpoint): ), "All color components should be integers 0-255" # Validate that different classes have different colors (except transparent) - non_transparent_colors = [ - tuple(c) for c in all_colors if c[3] != 0 - ] # Exclude transparent + non_transparent_colors = [tuple(c) for c in all_colors if c[3] != 0] # Exclude transparent # Convert to set to check uniqueness unique_colors = set(non_transparent_colors) - assert ( - len(unique_colors) > 1 - ), "Non-transparent classes should have different colors" + assert len(unique_colors) > 1, "Non-transparent classes should have different colors" - test_logger.info( - f"Found {len(response)} classes with {len(unique_colors)} unique non-transparent colors" - ) + test_logger.info(f"Found {len(response)} classes with {len(unique_colors)} unique non-transparent colors") test_logger.info("Test PASSED\n") await self.close_client() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_07_collection_lifecycle.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_07_collection_lifecycle.py index c1d9d80d48a9..0af01422b100 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_07_collection_lifecycle.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_07_collection_lifecycle.py @@ -56,28 +56,18 @@ def test_01_begin_create_collection(self, planetarycomputer_endpoint): # Check if collection exists and delete it first try: - existing_collection = client.stac.get_collection( - collection_id=test_collection_id - ) + existing_collection = client.stac.get_collection(collection_id=test_collection_id) if existing_collection: - test_logger.info( - f"Collection '{test_collection_id}' already exists, deleting first..." - ) - delete_poller = client.stac.begin_delete_collection( - collection_id=test_collection_id, polling=True - ) + test_logger.info(f"Collection '{test_collection_id}' already exists, deleting first...") + delete_poller = client.stac.begin_delete_collection(collection_id=test_collection_id, polling=True) delete_poller.result() test_logger.info(f"Deleted existing collection '{test_collection_id}'") except Exception: - test_logger.info( - f"Collection '{test_collection_id}' does not exist, proceeding with creation" - ) + test_logger.info(f"Collection '{test_collection_id}' does not exist, proceeding with creation") # Define collection extents spatial_extent = StacExtensionSpatialExtent(bounding_box=[[-180, -90, 180, 90]]) - temporal_extent = StacCollectionTemporalExtent( - interval=[["2020-01-01T00:00:00Z", "2024-12-31T23:59:59Z"]] - ) + temporal_extent = StacCollectionTemporalExtent(interval=[["2020-01-01T00:00:00Z", "2024-12-31T23:59:59Z"]]) extent = StacExtensionExtent(spatial=spatial_extent, temporal=temporal_extent) # Create collection payload @@ -93,15 +83,11 @@ def test_01_begin_create_collection(self, planetarycomputer_endpoint): } test_logger.info("Calling: begin_create_collection(body=collection_data)") - create_poller = client.stac.begin_create_collection( - body=collection_data, polling=True - ) + create_poller = client.stac.begin_create_collection(body=collection_data, polling=True) result = create_poller.result() test_logger.info(f"Collection created: {result}") - created_collection = client.stac.get_collection( - collection_id=test_collection_id - ) + created_collection = client.stac.get_collection(collection_id=test_collection_id) assert created_collection is not None assert created_collection.id == test_collection_id assert created_collection.title == "Test Collection Lifecycle" @@ -110,12 +96,12 @@ def test_01_begin_create_collection(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy - def test_02_create_or_replace_collection(self, planetarycomputer_endpoint): + def test_02_replace_collection(self, planetarycomputer_endpoint): """ - Test updating a collection using create or replace. + Test updating a collection using replace. """ test_logger.info("=" * 80) - test_logger.info("TEST: test_02_create_or_replace_collection") + test_logger.info("TEST: test_02_replace_collection") test_logger.info("=" * 80) client = self.create_client(endpoint=planetarycomputer_endpoint) @@ -128,21 +114,12 @@ def test_02_create_or_replace_collection(self, planetarycomputer_endpoint): # Update description collection.description = "Test collection for lifecycle operations - UPDATED" - test_logger.info( - f"Calling: create_or_replace_collection(collection_id='{test_collection_id}', body=collection)" - ) - updated_collection = client.stac.create_or_replace_collection( - collection_id=test_collection_id, body=collection - ) + test_logger.info(f"Calling: replace_collection(collection_id='{test_collection_id}', body=collection)") + updated_collection = client.stac.replace_collection(collection_id=test_collection_id, body=collection) test_logger.info(f"Collection updated: {updated_collection}") - updated_collection = client.stac.get_collection( - collection_id=test_collection_id - ) - assert ( - updated_collection.description - == "Test collection for lifecycle operations - UPDATED" - ) + updated_collection = client.stac.get_collection(collection_id=test_collection_id) + assert updated_collection.description == "Test collection for lifecycle operations - UPDATED" test_logger.info("Test PASSED\n") @@ -160,12 +137,8 @@ def test_03_begin_delete_collection(self, planetarycomputer_endpoint): test_collection_id = "test-collection-lifecycle" - test_logger.info( - f"Calling: begin_delete_collection(collection_id='{test_collection_id}')" - ) - delete_poller = client.stac.begin_delete_collection( - collection_id=test_collection_id, polling=True - ) + test_logger.info(f"Calling: begin_delete_collection(collection_id='{test_collection_id}')") + delete_poller = client.stac.begin_delete_collection(collection_id=test_collection_id, polling=True) result = delete_poller.result() test_logger.info(f"Delete operation completed: {result}") @@ -175,17 +148,13 @@ def test_03_begin_delete_collection(self, planetarycomputer_endpoint): assert False, "Collection should have been deleted" except Exception as e: test_logger.info(f"Collection successfully deleted (404 expected): {e}") - assert ( - "404" in str(e) or "Not Found" in str(e) or "ResourceNotFound" in str(e) - ) + assert "404" in str(e) or "Not Found" in str(e) or "ResourceNotFound" in str(e) test_logger.info("Test PASSED\n") @PlanetaryComputerPreparer() @recorded_by_proxy - def test_04_create_collection_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_04_create_collection_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating a collection asset. Note: This test uses the existing test collection. @@ -201,22 +170,12 @@ def test_04_create_collection_asset( # Delete the asset if it already exists try: - test_logger.info( - "Checking if asset 'test-asset' already exists and deleting if found..." - ) - client.stac.delete_collection_asset( - collection_id=planetarycomputer_collection_id, asset_id="test-asset" - ) + test_logger.info("Checking if asset 'test-asset' already exists and deleting if found...") + client.stac.delete_collection_asset(collection_id=planetarycomputer_collection_id, asset_id="test-asset") test_logger.info("Deleted existing 'test-asset'") except Exception as e: - if ( - "404" in str(e) - or "Not Found" in str(e) - or "not found" in str(e).lower() - ): - test_logger.info( - "Asset 'test-asset' does not exist, proceeding with creation" - ) + if "404" in str(e) or "Not Found" in str(e) or "not found" in str(e).lower(): + test_logger.info("Asset 'test-asset' does not exist, proceeding with creation") else: test_logger.warning(f"Error checking/deleting asset: {e}") @@ -246,9 +205,7 @@ def test_04_create_collection_asset( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_05_replace_collection_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_05_replace_collection_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating or replacing a collection asset. """ @@ -272,7 +229,7 @@ def test_05_replace_collection_asset( file_tuple = ("test-asset.txt", file_content) test_logger.info( - f"Calling: create_or_replace_collection_asset(collection_id='{planetarycomputer_collection_id}', asset_id='test-asset', body={{...}})" + f"Calling: replace_collection_asset(collection_id='{planetarycomputer_collection_id}', asset_id='test-asset', body={{...}})" ) response = client.stac.replace_collection_asset( collection_id=planetarycomputer_collection_id, @@ -287,9 +244,7 @@ def test_05_replace_collection_asset( @PlanetaryComputerPreparer() @recorded_by_proxy - def test_06_delete_collection_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + def test_06_delete_collection_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test deleting a collection asset. First creates an asset specifically for deletion. @@ -336,12 +291,8 @@ def test_06_delete_collection_asset( test_logger.info("Asset deleted successfully") # Verify deletion by checking collection assets - collection = client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = client.stac.get_collection(collection_id=planetarycomputer_collection_id) if hasattr(collection, "assets") and collection.assets: - assert ( - "test-asset-to-be-deleted" not in collection.assets - ), "Asset should have been deleted" + assert "test-asset-to-be-deleted" not in collection.assets, "Asset should have been deleted" test_logger.info("Test PASSED\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_07_collection_lifecycle_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_07_collection_lifecycle_async.py index 428f562e07d2..3f1d8492b473 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_07_collection_lifecycle_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_07_collection_lifecycle_async.py @@ -39,9 +39,7 @@ test_logger.addHandler(file_handler) -class TestPlanetaryComputerCollectionLifecycleAsync( - PlanetaryComputerProClientTestBaseAsync -): +class TestPlanetaryComputerCollectionLifecycleAsync(PlanetaryComputerProClientTestBaseAsync): """Test suite for STAC Collection lifecycle operations.""" @PlanetaryComputerPreparer() @@ -60,28 +58,20 @@ async def test_01_begin_create_collection(self, planetarycomputer_endpoint): # Check if collection exists and delete it first try: - existing_collection = await client.stac.get_collection( - collection_id=test_collection_id - ) + existing_collection = await client.stac.get_collection(collection_id=test_collection_id) if existing_collection: - test_logger.info( - f"Collection '{test_collection_id}' already exists, deleting first..." - ) + test_logger.info(f"Collection '{test_collection_id}' already exists, deleting first...") delete_poller = await client.stac.begin_delete_collection( collection_id=test_collection_id, polling=True ) await delete_poller.result() test_logger.info(f"Deleted existing collection '{test_collection_id}'") except Exception: - test_logger.info( - f"Collection '{test_collection_id}' does not exist, proceeding with creation" - ) + test_logger.info(f"Collection '{test_collection_id}' does not exist, proceeding with creation") # Define collection extents spatial_extent = StacExtensionSpatialExtent(bounding_box=[[-180, -90, 180, 90]]) - temporal_extent = StacCollectionTemporalExtent( - interval=[["2020-01-01T00:00:00Z", "2024-12-31T23:59:59Z"]] - ) + temporal_extent = StacCollectionTemporalExtent(interval=[["2020-01-01T00:00:00Z", "2024-12-31T23:59:59Z"]]) extent = StacExtensionExtent(spatial=spatial_extent, temporal=temporal_extent) # Create collection payload @@ -97,15 +87,22 @@ async def test_01_begin_create_collection(self, planetarycomputer_endpoint): } test_logger.info("Calling: begin_create_collection(body=collection_data)") - create_poller = await client.stac.begin_create_collection( - body=collection_data, polling=True - ) - result = await create_poller.result() + import asyncio + from azure.core.exceptions import ResourceExistsError + + for attempt in range(12): + try: + create_poller = await client.stac.begin_create_collection(body=collection_data, polling=True) + result = await create_poller.result() + break + except ResourceExistsError: + test_logger.info(f"Collection still being deleted, retrying in 5s (attempt {attempt + 1}/12)") + await asyncio.sleep(5) + else: + raise RuntimeError("Failed to create collection after 12 retries") test_logger.info(f"Collection created: {result}") - created_collection = await client.stac.get_collection( - collection_id=test_collection_id - ) + created_collection = await client.stac.get_collection(collection_id=test_collection_id) assert created_collection is not None assert created_collection.id == test_collection_id assert created_collection.title == "Test Collection Lifecycle" @@ -116,12 +113,12 @@ async def test_01_begin_create_collection(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_02_create_or_replace_collection(self, planetarycomputer_endpoint): + async def test_02_replace_collection(self, planetarycomputer_endpoint): """ - Test updating a collection using create or replace. + Test updating a collection using replace. """ test_logger.info("=" * 80) - test_logger.info("TEST: test_02_create_or_replace_collection") + test_logger.info("TEST: test_02_replace_collection") test_logger.info("=" * 80) client = self.create_client(endpoint=planetarycomputer_endpoint) @@ -134,21 +131,12 @@ async def test_02_create_or_replace_collection(self, planetarycomputer_endpoint) # Update description collection.description = "Test collection for lifecycle operations - UPDATED" - test_logger.info( - f"Calling: create_or_replace_collection(collection_id='{test_collection_id}', body=collection)" - ) - updated_collection = await client.stac.create_or_replace_collection( - collection_id=test_collection_id, body=collection - ) + test_logger.info(f"Calling: replace_collection(collection_id='{test_collection_id}', body=collection)") + updated_collection = await client.stac.replace_collection(collection_id=test_collection_id, body=collection) test_logger.info(f"Collection updated: {updated_collection}") - updated_collection = await client.stac.get_collection( - collection_id=test_collection_id - ) - assert ( - updated_collection.description - == "Test collection for lifecycle operations - UPDATED" - ) + updated_collection = await client.stac.get_collection(collection_id=test_collection_id) + assert updated_collection.description == "Test collection for lifecycle operations - UPDATED" test_logger.info("Test PASSED\n") @@ -168,12 +156,8 @@ async def test_03_begin_delete_collection(self, planetarycomputer_endpoint): test_collection_id = "test-collection-lifecycle" - test_logger.info( - f"Calling: begin_delete_collection(collection_id='{test_collection_id}')" - ) - delete_poller = await client.stac.begin_delete_collection( - collection_id=test_collection_id, polling=True - ) + test_logger.info(f"Calling: begin_delete_collection(collection_id='{test_collection_id}')") + delete_poller = await client.stac.begin_delete_collection(collection_id=test_collection_id, polling=True) result = await delete_poller.result() test_logger.info(f"Delete operation completed: {result}") @@ -183,9 +167,7 @@ async def test_03_begin_delete_collection(self, planetarycomputer_endpoint): assert False, "Collection should have been deleted" except Exception as e: test_logger.info(f"Collection successfully deleted (404 expected): {e}") - assert ( - "404" in str(e) or "Not Found" in str(e) or "ResourceNotFound" in str(e) - ) + assert "404" in str(e) or "Not Found" in str(e) or "ResourceNotFound" in str(e) test_logger.info("Test PASSED\n") @@ -193,9 +175,7 @@ async def test_03_begin_delete_collection(self, planetarycomputer_endpoint): @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_04_create_collection_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_04_create_collection_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating a collection asset. Note: This test uses the existing test collection. @@ -211,22 +191,14 @@ async def test_04_create_collection_asset( # Delete the asset if it already exists try: - test_logger.info( - "Checking if asset 'test-asset' already exists and deleting if found..." - ) + test_logger.info("Checking if asset 'test-asset' already exists and deleting if found...") await client.stac.delete_collection_asset( collection_id=planetarycomputer_collection_id, asset_id="test-asset" ) test_logger.info("Deleted existing 'test-asset'") except Exception as e: - if ( - "404" in str(e) - or "Not Found" in str(e) - or "not found" in str(e).lower() - ): - test_logger.info( - "Asset 'test-asset' does not exist, proceeding with creation" - ) + if "404" in str(e) or "Not Found" in str(e) or "not found" in str(e).lower(): + test_logger.info("Asset 'test-asset' does not exist, proceeding with creation") else: test_logger.warning(f"Error checking/deleting asset: {e}") @@ -258,9 +230,7 @@ async def test_04_create_collection_asset( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_05_replace_collection_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_05_replace_collection_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test creating or replacing a collection asset. """ @@ -284,7 +254,7 @@ async def test_05_replace_collection_asset( file_tuple = ("test-asset.txt", file_content) test_logger.info( - f"Calling: create_or_replace_collection_asset(collection_id='{planetarycomputer_collection_id}', asset_id='test-asset', body={{...}})" + f"Calling: replace_collection_asset(collection_id='{planetarycomputer_collection_id}', asset_id='test-asset', body={{...}})" ) response = await client.stac.replace_collection_asset( collection_id=planetarycomputer_collection_id, @@ -301,9 +271,7 @@ async def test_05_replace_collection_asset( @PlanetaryComputerPreparer() @recorded_by_proxy_async - async def test_06_delete_collection_asset( - self, planetarycomputer_endpoint, planetarycomputer_collection_id - ): + async def test_06_delete_collection_asset(self, planetarycomputer_endpoint, planetarycomputer_collection_id): """ Test deleting a collection asset. First creates an asset specifically for deletion. @@ -350,13 +318,9 @@ async def test_06_delete_collection_asset( test_logger.info("Asset deleted successfully") # Verify deletion by checking collection assets - collection = await client.stac.get_collection( - collection_id=planetarycomputer_collection_id - ) + collection = await client.stac.get_collection(collection_id=planetarycomputer_collection_id) if hasattr(collection, "assets") and collection.assets: - assert ( - "test-asset-to-be-deleted" not in collection.assets - ), "Asset should have been deleted" + assert "test-asset-to-be-deleted" not in collection.assets, "Asset should have been deleted" test_logger.info("Test PASSED\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_08_collection_tiler.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_08_collection_tiler.py new file mode 100644 index 000000000000..e76cd7c2ff63 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_08_collection_tiler.py @@ -0,0 +1,318 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +""" +Unit tests for Collection-scoped Tiler operations. +""" +import logging +from pathlib import Path +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import PlanetaryComputerProClientTestBase, PlanetaryComputerPreparer +from azure.planetarycomputer.models import ( + TilerImageFormat, + Feature, + FeatureType, + Polygon, +) + +# Set up test logger +test_logger = logging.getLogger("test_collection_tiler") +test_logger.setLevel(logging.DEBUG) + +# Create logs directory if it doesn't exist +log_dir = Path(__file__).parent / "logs" +log_dir.mkdir(exist_ok=True) + +# File handler for test logs +log_file = log_dir / "collection_tiler_test_results.log" +file_handler = logging.FileHandler(log_file, mode="w") +file_handler.setLevel(logging.DEBUG) +formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") +file_handler.setFormatter(formatter) +test_logger.addHandler(file_handler) + + +class TestPlanetaryComputerCollectionTiler(PlanetaryComputerProClientTestBase): + """Test suite for Collection-scoped Tiler operations.""" + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_01_get_collection_info(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection tiler info.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_01_get_collection_info") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = client.data.get_collection_info( + collection_id=planetarycomputer_collection_id, + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_02_get_collection_point(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection point data at a specific location.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_02_get_collection_point") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + # Note: assets or expression is required for point queries (returns 400 without one) + response = client.data.get_collection_point( + collection_id=planetarycomputer_collection_id, + longitude=-84.3860, + latitude=33.6760, + assets=["image"], + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_03_get_collection_point_assets(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection point assets at a specific location.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_03_get_collection_point_assets") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + # Note: assets or expression is required for point queries (returns 400 without one) + response = client.data.get_collection_point_assets( + collection_id=planetarycomputer_collection_id, + longitude=-84.3860, + latitude=33.6760, + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_04_get_collection_tile(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting a collection tile.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_04_get_collection_tile") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = client.data.get_collection_tile_by_scale_and_format( + collection_id=planetarycomputer_collection_id, + tile_matrix_set_id="WebMercatorQuad", + z=14, + x=4349, + y=6564, + scale=1, + format="png", + assets=["image"], + asset_band_indices=["image|1,2,3"], + ) + + image_bytes = b"".join(response) + test_logger.info(f"Tile size: {len(image_bytes)} bytes") + + assert len(image_bytes) > 0 + assert image_bytes[:8] == b"\x89PNG\r\n\x1a\n", "Should be PNG format" + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_05_get_collection_tile_json(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection TileJSON metadata.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_05_get_collection_tile_json") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = client.data.get_collection_tile_json( + collection_id=planetarycomputer_collection_id, + assets=["image"], + asset_band_indices=["image|1,2,3"], + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + if hasattr(response, "as_dict"): + response_dict = response.as_dict() + test_logger.info(f"TileJSON keys: {list(response_dict.keys())}") + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_06_get_collection_bbox_crop(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting a bbox crop from a collection.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_06_get_collection_bbox_crop") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = client.data.get_collection_bbox_crop( + collection_id=planetarycomputer_collection_id, + minx=-84.3900, + miny=33.6800, + maxx=-84.3850, + maxy=33.6850, + format="png", + assets=["image"], + asset_band_indices=["image|1,2,3"], + ) + + image_bytes = b"".join(response) + test_logger.info(f"Image size: {len(image_bytes)} bytes") + + assert len(image_bytes) > 0, "Image bytes should not be empty" + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_07_get_collection_wmts_capabilities(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting WMTS capabilities for a collection.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_07_get_collection_wmts_capabilities") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = client.data.get_collection_wmts_capabilities( + collection_id=planetarycomputer_collection_id, + assets=["image"], + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + # WMTS returns XML + if isinstance(response, bytes): + assert b"WMTSCapabilities" in response or b"xml" in response + test_logger.info(f"Response size: {len(response)} bytes") + elif hasattr(response, "__iter__"): + xml_bytes = b"".join(response) + test_logger.info(f"Response size: {len(xml_bytes)} bytes") + assert len(xml_bytes) > 0 + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_08_crop_collection_feature_geo_json(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test cropping a collection by GeoJSON feature.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_08_crop_collection_feature_geo_json") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + geojson_feature = Feature( + type=FeatureType.FEATURE, + geometry=Polygon( + coordinates=[ + [ + [-84.3930, 33.6798], + [-84.3670, 33.6798], + [-84.3670, 33.7058], + [-84.3930, 33.7058], + [-84.3930, 33.6798], + ] + ] + ), + properties={}, + ) + + response = client.data.crop_collection_feature_geo_json( + collection_id=planetarycomputer_collection_id, + body=geojson_feature, + assets=["image"], + asset_band_indices=["image|1,2,3"], + ) + + image_bytes = b"".join(response) + test_logger.info(f"Image size: {len(image_bytes)} bytes") + + assert len(image_bytes) > 0, "Image bytes should not be empty" + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_09_list_collection_tilesets(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test listing tilesets for a collection.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_09_list_collection_tilesets") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = client.data.list_collection_tilesets( + collection_id=planetarycomputer_collection_id, + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_10_get_collection_assets_for_tile(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection assets for a specific tile.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_10_get_collection_assets_for_tile") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = client.data.get_collection_assets_for_tile( + collection_id=planetarycomputer_collection_id, + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + + @PlanetaryComputerPreparer() + @recorded_by_proxy + def test_11_get_collection_tileset_metadata(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection tileset metadata.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_11_get_collection_tileset_metadata") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = client.data.get_collection_tileset_metadata( + collection_id=planetarycomputer_collection_id, + tile_matrix_set_id="WebMercatorQuad", + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_08_collection_tiler_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_08_collection_tiler_async.py new file mode 100644 index 000000000000..e5cfbfe585c3 --- /dev/null +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_08_collection_tiler_async.py @@ -0,0 +1,336 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +""" +Unit tests for Collection-scoped Tiler operations (async). +""" +import logging +from pathlib import Path +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from devtools_testutils import recorded_by_proxy +from testpreparer_async import PlanetaryComputerProClientTestBaseAsync +from testpreparer import PlanetaryComputerPreparer +from azure.planetarycomputer.models import ( + TilerImageFormat, + Feature, + FeatureType, + Polygon, +) + +# Set up test logger +test_logger = logging.getLogger("test_collection_tiler") +test_logger.setLevel(logging.DEBUG) + +# Create logs directory if it doesn't exist +log_dir = Path(__file__).parent / "logs" +log_dir.mkdir(exist_ok=True) + +# File handler for test logs +log_file = log_dir / "collection_tiler_async_test_results.log" +file_handler = logging.FileHandler(log_file, mode="w") +file_handler.setLevel(logging.DEBUG) +formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") +file_handler.setFormatter(formatter) +test_logger.addHandler(file_handler) + + +class TestPlanetaryComputerCollectionTilerAsync(PlanetaryComputerProClientTestBaseAsync): + """Test suite for Collection-scoped Tiler operations (async).""" + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_01_get_collection_info(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection tiler info.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_01_get_collection_info") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = await client.data.get_collection_info( + collection_id=planetarycomputer_collection_id, + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_02_get_collection_point(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection point data at a specific location.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_02_get_collection_point") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + # Note: assets or expression is required for point queries (returns 400 without one) + response = await client.data.get_collection_point( + collection_id=planetarycomputer_collection_id, + longitude=-84.3860, + latitude=33.6760, + assets=["image"], + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_03_get_collection_point_assets(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection point assets at a specific location.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_03_get_collection_point_assets") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + # Note: assets or expression is required for point queries (returns 400 without one) + response = await client.data.get_collection_point_assets( + collection_id=planetarycomputer_collection_id, + longitude=-84.3860, + latitude=33.6760, + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_04_get_collection_tile(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting a collection tile.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_04_get_collection_tile") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = await client.data.get_collection_tile_by_scale_and_format( + collection_id=planetarycomputer_collection_id, + tile_matrix_set_id="WebMercatorQuad", + z=14, + x=4349, + y=6564, + scale=1, + format="png", + assets=["image"], + asset_band_indices=["image|1,2,3"], + ) + + image_bytes = b"".join([chunk async for chunk in response]) + test_logger.info(f"Tile size: {len(image_bytes)} bytes") + + assert len(image_bytes) > 0 + assert image_bytes[:8] == b"\x89PNG\r\n\x1a\n", "Should be PNG format" + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_05_get_collection_tile_json(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection TileJSON metadata.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_05_get_collection_tile_json") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = await client.data.get_collection_tile_json( + collection_id=planetarycomputer_collection_id, + assets=["image"], + asset_band_indices=["image|1,2,3"], + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + if hasattr(response, "as_dict"): + response_dict = response.as_dict() + test_logger.info(f"TileJSON keys: {list(response_dict.keys())}") + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_06_get_collection_bbox_crop(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting a bbox crop from a collection.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_06_get_collection_bbox_crop") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = await client.data.get_collection_bbox_crop( + collection_id=planetarycomputer_collection_id, + minx=-84.3900, + miny=33.6800, + maxx=-84.3850, + maxy=33.6850, + format="png", + assets=["image"], + asset_band_indices=["image|1,2,3"], + ) + + image_bytes = b"".join([chunk async for chunk in response]) + test_logger.info(f"Image size: {len(image_bytes)} bytes") + + assert len(image_bytes) > 0, "Image bytes should not be empty" + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_07_get_collection_wmts_capabilities( + self, planetarycomputer_endpoint, planetarycomputer_collection_id + ): + """Test getting WMTS capabilities for a collection.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_07_get_collection_wmts_capabilities") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = await client.data.get_collection_wmts_capabilities( + collection_id=planetarycomputer_collection_id, + assets=["image"], + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + if isinstance(response, bytes): + assert b"WMTSCapabilities" in response or b"xml" in response + test_logger.info(f"Response size: {len(response)} bytes") + elif hasattr(response, "__aiter__"): + xml_bytes = b"".join([chunk async for chunk in response]) + test_logger.info(f"Response size: {len(xml_bytes)} bytes") + assert len(xml_bytes) > 0 + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_08_crop_collection_feature_geo_json( + self, planetarycomputer_endpoint, planetarycomputer_collection_id + ): + """Test cropping a collection by GeoJSON feature.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_08_crop_collection_feature_geo_json") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + geojson_feature = Feature( + type=FeatureType.FEATURE, + geometry=Polygon( + coordinates=[ + [ + [-84.3930, 33.6798], + [-84.3670, 33.6798], + [-84.3670, 33.7058], + [-84.3930, 33.7058], + [-84.3930, 33.6798], + ] + ] + ), + properties={}, + ) + + response = await client.data.crop_collection_feature_geo_json( + collection_id=planetarycomputer_collection_id, + body=geojson_feature, + assets=["image"], + asset_band_indices=["image|1,2,3"], + ) + + image_bytes = b"".join([chunk async for chunk in response]) + test_logger.info(f"Image size: {len(image_bytes)} bytes") + + assert len(image_bytes) > 0, "Image bytes should not be empty" + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_09_list_collection_tilesets(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test listing tilesets for a collection.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_09_list_collection_tilesets") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = await client.data.list_collection_tilesets( + collection_id=planetarycomputer_collection_id, + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_10_get_collection_assets_for_tile(self, planetarycomputer_endpoint, planetarycomputer_collection_id): + """Test getting collection assets for a specific tile.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_10_get_collection_assets_for_tile") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = await client.data.get_collection_assets_for_tile( + collection_id=planetarycomputer_collection_id, + tile_matrix_set_id="WebMercatorQuad", + z=13, + x=2174, + y=3282, + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + await self.close_client() + + @PlanetaryComputerPreparer() + @recorded_by_proxy_async + async def test_11_get_collection_tileset_metadata( + self, planetarycomputer_endpoint, planetarycomputer_collection_id + ): + """Test getting collection tileset metadata.""" + test_logger.info("=" * 80) + test_logger.info("TEST: test_11_get_collection_tileset_metadata") + test_logger.info("=" * 80) + + client = self.create_client(endpoint=planetarycomputer_endpoint) + + response = await client.data.get_collection_tileset_metadata( + collection_id=planetarycomputer_collection_id, + tile_matrix_set_id="WebMercatorQuad", + ) + + test_logger.info(f"Response type: {type(response)}") + assert response is not None, "Response should not be None" + + test_logger.info("Test PASSED\n") + await self.close_client() diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/testpreparer.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/testpreparer.py index 2316702bc2cb..531b62db98a6 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/testpreparer.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/testpreparer.py @@ -25,6 +25,6 @@ def create_client(self, endpoint): EnvironmentVariableLoader, "planetarycomputer", planetarycomputer_endpoint="https://Sanitized.sanitized_label.sanitized_location.geocatalog.spatio.azure.com", - planetarycomputer_collection_id="naip-atl", + planetarycomputer_collection_id="naip", planetarycomputer_item_id="ga_m_3308421_se_16_060_20211114", ) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tsp-location.yaml b/sdk/planetarycomputer/azure-planetarycomputer/tsp-location.yaml index 7e7c127a4dfd..23a70733579a 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tsp-location.yaml +++ b/sdk/planetarycomputer/azure-planetarycomputer/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/orbital/Microsoft.PlanetaryComputer -commit: f6aac155e9a422cf0251498788e5726c3b615bf3 +commit: 7013d71d09237a0698cd8d2ec86d189afba10595 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/shared_requirements.txt b/shared_requirements.txt index 767957e0ecf6..3f8213d2e188 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -100,3 +100,5 @@ langchain-openai azure-ai-language-questionanswering github-copilot-sdk hypercorn +pystac +geojson