Freigeben über


Scenes.GetStacFeatureAsync(String, String, RequestContext) Methode

Definition

Ruft ein Feature(SpatioTemporal Asset Catalog (STAC)-Element) für die angegebene Sammlung und Feature-ID ab.

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)

Parameter

collectionId
String

Die abzurufende Sammlungs-ID. Zulässige Werte: "Sentinel_2_L2A" | "Sentinel_2_L1C".

featureId
String

Die abzurufende Feature-ID.

context
RequestContext

Der Anforderungskontext, der das Standardverhalten der Clientpipeline pro Aufruf außer Kraft setzen kann.

Gibt zurück

Die vom Dienst zurückgegebene Antwort. Details zum Antworttextschema finden Sie unten im Abschnitt Hinweise.

Ausnahmen

collectionId oder featureId ist NULL.

collectionId oder featureId ist eine leere Zeichenfolge und wurde erwartet, dass sie nicht leer ist.

Der Dienst hat einen nicht erfolgreichen status Code zurückgegeben.

Beispiele

In diesem Beispiel wird gezeigt, wie GetStacFeatureAsync mit den erforderlichen Parametern aufgerufen und das Ergebnis analysiert wird.

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());

Hinweise

Im Folgenden finden Sie das JSON-Schema für die Antwortnutzlast.

Antworttext:

Schema für 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.
}

Gilt für: