Freigeben über


Scenes.SearchFeaturesAsync Methode

Definition

Suchen Sie nach STAC-Features nach Sammlungs-ID, bbox, sich überschneidende Geometrie, Start- und Endzeit.

public virtual System.Threading.Tasks.Task<Azure.Response> SearchFeaturesAsync (string collectionId, Azure.Core.RequestContent content, int? maxpagesize = default, int? skip = default, Azure.RequestContext context = default);
abstract member SearchFeaturesAsync : string * Azure.Core.RequestContent * Nullable<int> * Nullable<int> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.SearchFeaturesAsync : string * Azure.Core.RequestContent * Nullable<int> * Nullable<int> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function SearchFeaturesAsync (collectionId As String, content As RequestContent, Optional maxpagesize As Nullable(Of Integer) = Nothing, Optional skip As Nullable(Of Integer) = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameter

collectionId
String

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

content
RequestContent

Der Inhalt, der als Textkörper der Anforderung gesendet werden soll. Details zum Anforderungstextschema finden Sie im Abschnitt Hinweise unten.

maxpagesize
Nullable<Int32>

Maximale Anzahl erforderlicher Features (inklusive). Minimum = 1, Maximum = 100, Standardwert = 10.

skip
Nullable<Int32>

Überspringen Sie das Token, um den nächsten Satz von Ergebnissen abzurufen.

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 im Abschnitt Hinweise unten.

Ausnahmen

collectionId oder content ist NULL.

collectionId 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 SearchFeaturesAsync mit den erforderlichen Parametern und Anforderungsinhalten aufgerufen und das Ergebnis analysiert wird.

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

var data = new {
    startDateTime = "2022-05-10T18:57:31.2311892Z",
    endDateTime = "2022-05-10T18:57:31.2311892Z",
};

Response response = await client.SearchFeaturesAsync("<collectionId>", RequestContent.Create(data));

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("features")[0].GetProperty("stacVersion").ToString());
Console.WriteLine(result.GetProperty("features")[0].GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("features")[0].GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("features")[0].GetProperty("properties").ToString());
Console.WriteLine(result.GetProperty("features")[0].GetProperty("links")[0].GetProperty("href").ToString());
Console.WriteLine(result.GetProperty("features")[0].GetProperty("links")[0].GetProperty("rel").ToString());
Console.WriteLine(result.GetProperty("features")[0].GetProperty("assets").GetProperty("<test>").GetProperty("href").ToString());

In diesem Beispiel wird gezeigt, wie SearchFeaturesAsync mit allen Parametern und Anforderungsinhalten aufgerufen und das Ergebnis analysiert wird.

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

var data = new {
    startDateTime = "2022-05-10T18:57:31.2311892Z",
    endDateTime = "2022-05-10T18:57:31.2311892Z",
    intersects = new {
        coordinates = new[] {
            new[] {
                new[] {
                    new[] {
                        123.45d
                    }
                }
            }
        },
        type = "MultiPolygon",
    },
    bbox = new[] {
        123.45d
    },
    featureIds = new[] {
        "<String>"
    },
};

Response response = await client.SearchFeaturesAsync("<collectionId>", RequestContent.Create(data), 1234, 1234);

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

Hinweise

Im Folgenden finden Sie das JSON-Schema für die Anforderungs- und Antwortnutzlasten.

Anforderungstext:

Schema für SearchFeaturesQuery:

{
  startDateTime: string (ISO 8601 Format), # Required. Start datetime of the time interval in which to search for Features.
  endDateTime: string (ISO 8601 Format), # Required. End datetime of the time interval in which to search for Features.
  intersects: {
    type: "Point" | "Polygon" | "MultiPolygon", # Required. GeoJSON object type.
  }, # Optional. GeoJSON (For more details: https://geojson.org/). Note: Coordinates are expected in [Longitude, Latitude] format.
  bbox: [number], # Optional. Only features that have a geometry that intersects the bounding box are selected.
The bounding box is provided as four numbers. The coordinate reference system of the values is WGS84 longitude/latitude.
  featureIds: [string], # Optional. Array of feature ids to return.
}

Antworttext:

Schema für SearchFeaturesResponse:

{
  features: [
    {
      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.
    }
  ], # Required. List of features.
  nextLink: string, # Optional. URL to do the POST request with same filters,
to get next set of features.
}

Gilt für: