Scenes.SearchFeaturesAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Search for STAC features by collection id, bbox, intersecting geometry, start and end datetime.
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)
Parameters
- collectionId
- String
Collection Id to be searched. Allowed values: "Sentinel_2_L2A" | "Sentinel_2_L1C".
- content
- RequestContent
The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
Maximum number of features needed (inclusive). Minimum = 1, Maximum = 100, Default value = 10.
- 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 content
is null.
collectionId
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 SearchFeaturesAsync with required parameters and request content, and how to parse the result.
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());
This sample shows how to call SearchFeaturesAsync with all parameters and request content, and how to parse the result.
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());
Remarks
Below is the JSON schema for the request and response payloads.
Request Body:
Schema for 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.
}
Response Body:
Schema for 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.
}
Applies to
Azure SDK for .NET