Udostępnij za pośrednictwem


Scenes.GetStacFeatureAsync(String, String, RequestContext) Method

Definition

Get a feature(SpatioTemporal Asset Catalog (STAC) Item) for given collection and feature id.

public virtual System.Threading.Tasks.Task<Azure.Response> GetStacFeatureAsync (string collectionId, string featureId, Azure.RequestContext context = default);
abstract member GetStacFeatureAsync : string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetStacFeatureAsync : string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetStacFeatureAsync (collectionId As String, featureId As String, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

collectionId
String

Collection Id to be fetched. Allowed values: "Sentinel_2_L2A" | "Sentinel_2_L1C".

featureId
String

Feature Id to be fetched.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service. Details of the response body schema are in the Remarks section below.

Exceptions

collectionId or featureId is null.

collectionId or featureId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetStacFeatureAsync with required parameters and parse the result.

var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetScenesClient(<2022-11-01-preview>);

Response response = await client.GetStacFeatureAsync("<collectionId>", "<featureId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("stacVersion").ToString());
Console.WriteLine(result.GetProperty("stacExtensions")[0].ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("geometry").ToString());
Console.WriteLine(result.GetProperty("bbox")[0].ToString());
Console.WriteLine(result.GetProperty("properties").ToString());
Console.WriteLine(result.GetProperty("links")[0].GetProperty("href").ToString());
Console.WriteLine(result.GetProperty("links")[0].GetProperty("rel").ToString());
Console.WriteLine(result.GetProperty("links")[0].GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("links")[0].GetProperty("title").ToString());
Console.WriteLine(result.GetProperty("assets").GetProperty("<test>").GetProperty("href").ToString());
Console.WriteLine(result.GetProperty("assets").GetProperty("<test>").GetProperty("title").ToString());
Console.WriteLine(result.GetProperty("assets").GetProperty("<test>").GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("assets").GetProperty("<test>").GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("assets").GetProperty("<test>").GetProperty("roles")[0].ToString());
Console.WriteLine(result.GetProperty("collection").ToString());

Remarks

Below is the JSON schema for the response payload.

Response Body:

Schema for StacFeature:

{
  stacVersion: string, # Required. The STAC version the Feature implements.
  stacExtensions: [string], # Optional. A list of extensions the Feature implements.
  id: string, # Required. Provider identifier. Globally unique ID by Data provider.
  type: string, # Required. Type of the GeoJSON Object. It's value is always Feature.
  geometry: AnyObject, # Optional. Defines the full footprint of the asset represented by this item.
Its a GeoJSON geometry.
  bbox: [number], # Optional. Bounding box of the feature.
  properties: AnyObject, # Required. A dictionary of additional metadata for the item.
  links: [
    {
      href: string, # Required. The actual link in the format of an URL.
      rel: string, # Required. Relationship between the current document and the linked document.
      type: string, # Optional. Media type of the referenced entity.
      title: string, # Optional. A human readable title to be used in rendered displays of the link.
    }
  ], # Required. List of link objects to resources and related URLs.
  assets: Dictionary<string, StacFeatureAsset>, # Required. Dictionary of asset objects, each with a unique key.
  collection: string, # Optional. The id of the STAC Collection this Feature references.
}

Applies to