Partager via


Scenes.SearchFeatures Méthode

Définition

Recherchez les fonctionnalités STAC par id de collection, bbox, géométrie croisée, date/heure de début et de fin.

public virtual Azure.Response SearchFeatures (string collectionId, Azure.Core.RequestContent content, int? maxpagesize = default, int? skip = default, Azure.RequestContext context = default);
abstract member SearchFeatures : string * Azure.Core.RequestContent * Nullable<int> * Nullable<int> * Azure.RequestContext -> Azure.Response
override this.SearchFeatures : string * Azure.Core.RequestContent * Nullable<int> * Nullable<int> * Azure.RequestContext -> Azure.Response
Public Overridable Function SearchFeatures (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 Response

Paramètres

collectionId
String

ID de collection à rechercher. Valeurs autorisées : « Sentinel_2_L2A » | « Sentinel_2_L1C ».

content
RequestContent

Contenu à envoyer en tant que corps de la demande. Les détails du schéma du corps de la demande se trouvent dans la section Remarques ci-dessous.

maxpagesize
Nullable<Int32>

Nombre maximal de fonctionnalités nécessaires (inclus). Minimum = 1, Maximum = 100, Valeur par défaut = 10.

skip
Nullable<Int32>

Ignorer le jeton pour obtenir le jeu de résultats suivant.

context
RequestContext

Contexte de la demande, qui peut remplacer les comportements par défaut du pipeline client par appel.

Retours

Réponse retournée par le service. Les détails du schéma du corps de la réponse se trouvent dans la section Remarques ci-dessous.

Exceptions

collectionId ou content est null.

collectionId est une chaîne vide et devait être non vide.

Le service a retourné un code de status non réussi.

Exemples

Cet exemple montre comment appeler SearchFeatures avec les paramètres requis et demander le contenu, et comment analyser le résultat.

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 = client.SearchFeatures("<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());

Cet exemple montre comment appeler SearchFeatures avec tous les paramètres et demander le contenu, et comment analyser le résultat.

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 = client.SearchFeatures("<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());

Remarques

Vous trouverez ci-dessous le schéma JSON pour les charges utiles de requête et de réponse.

Corps de la demande :

Schéma pour 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.
}

Corps de réponse :

Schéma pour 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.
}

S’applique à