OgcApiAsyncFeatureSource¶
Namespace: ThinkGeo.Core
Reads features asynchronously from an OGC API - Features service.
public class OgcApiAsyncFeatureSource : WebBasedAsyncFeatureSource, IHttpRequestService
Inheritance object → AsyncFeatureSource → WebBasedAsyncFeatureSource → OgcApiAsyncFeatureSource
Implements IHttpRequestService
Remarks:
The service pages with a next link rather than an offset, so OgcApiAsyncFeatureSource.GetFeaturesPageAsync(RectangleShape, IEnumerable<string>, string, int, CancellationToken) carries that link forward in the FeaturePage.NextToken and the caller never has to know the difference.
There is no standalone count method. The specification makes numberMatched optional precisely because counting can be expensive, so a total is reported through FeaturePage.NumberMatched when the server volunteers one and is -1 when it does not - rather than promising a count this source cannot always deliver.
Properties¶
Url¶
Gets or sets the landing-page URL of the service.
public string Url { get; set; }
Property Value¶
Remarks:
Read when the source opens: the collections, schema and extent it describes are fetched then and kept. Set it before AsyncFeatureSource.OpenAsync(CancellationToken); a change on an open source takes effect when the source is closed and opened again.
CollectionId¶
Gets or sets the collection to read features from.
public string CollectionId { get; set; }
Property Value¶
Remarks:
Read when the source opens: the schema and extent it describes are fetched then and kept. Set it before AsyncFeatureSource.OpenAsync(CancellationToken); a change on an open source takes effect when the source is closed and opened again.
BulkSize¶
Gets or sets how many features to ask for per request.
public int BulkSize { get; set; }
Property Value¶
Remarks:
A bounding-box query walks the service's next links until the extent is exhausted, so this sets the size of each hop rather than a limit on the total.
CollectionIds¶
Gets the collection identifiers the service publishes, available once the source is open.
public IReadOnlyList<string> CollectionIds { get; }
Property Value¶
HttpClient¶
Gets or sets the HTTP client used for outbound requests.
public HttpClient HttpClient { get; set; }
Property Value¶
Remarks:
Assign this to take full control of the client, including its handler pipeline and default headers. It takes precedence over WebBasedAsyncFeatureSource.HttpMessageHandler, and ownership stays with the caller: the source will not dispose a client it did not create.
HttpMessageHandler¶
Gets or sets an optional handler used to build the client when the source opens.
public HttpMessageHandler HttpMessageHandler { get; set; }
Property Value¶
Remarks:
Useful for Blazor WebAssembly, for DelegatingHandler chains such as Polly or OpenTelemetry, and for tests with a mock handler. Read once during open, ignored when WebBasedAsyncFeatureSource.HttpClient is already assigned, and never disposed by this source.
WebProxy¶
Gets or sets the proxy through which requests should be routed.
public IWebProxy WebProxy { get; set; }
Property Value¶
TimeoutInSeconds¶
Gets or sets the request timeout, in seconds.
public int TimeoutInSeconds { get; set; }
Property Value¶
Credentials¶
Gets or sets the credentials used when authenticating requests.
public ICredentials Credentials { get; set; }
Property Value¶
UserAgent¶
Gets or sets the user-agent header sent with each request.
public string UserAgent { get; set; }
Property Value¶
ConcurrentAccess¶
Gets or sets whether this source can be read from more than one thread at once, and if it cannot, whether copying it per worker is the cheap way to read it anyway.
public ConcurrentAccess ConcurrentAccess { get; set; }
Property Value¶
Remarks:
The same declaration FeatureSource.ConcurrentAccess carries, for the same reason: whoever cuts or draws several tiles at once asks the source before deciding whether to copy it per worker. ConcurrentAccess.UnsafeLock by default; a source that answers each read from its own request says ConcurrentAccess.Safe. https://community.thinkgeo.com/t/features-cut-off-on-tile-border-with-gpu-rendering/12481
IsOpen¶
Gets a value indicating whether the source has been opened and is ready to answer queries.
public bool IsOpen { get; }
Property Value¶
ProjectionConverter¶
Gets or sets the converter that translates between the coordinate system the service publishes and the one the map is drawn in.
public ProjectionConverter ProjectionConverter { get; set; }
Property Value¶
Remarks:
Bounding boxes passed in are converted to the service's own projection before the request is issued, and the features that come back are converted to the map's projection. Where a service can reproject on request, asking it to do so is usually better than converting afterwards, because the server holds the authoritative transformation for its own grid.
GeometryType¶
Gets the kind of geometry the source holds - points, lines or areas - as its service declares it.
public WellKnownType GeometryType { get; protected set; }
Property Value¶
Remarks:
Read when the source opens, at no cost of its own: WFS from the DescribeFeatureType the open already fetches, ArcGIS Server from the layer definition. It is WellKnownType.Invalid before that, after the source closes, and whenever the service does not say - OGC API - Features has no required schema, and a WFS schema may name a geometry (gml:GeometryPropertyType) without saying which. Invalid is not a promise that the source holds no geometry. https://community.thinkgeo.com/t/v15-beta160-follow-up-remaining-gpu-style-parity-source-lifecycle-wfs-v2-and-wms-gaps/12468
Constructors¶
OgcApiAsyncFeatureSource()¶
Initializes a new instance of the OgcApiAsyncFeatureSource class.
public OgcApiAsyncFeatureSource()
OgcApiAsyncFeatureSource(string, string)¶
Initializes a new instance of the OgcApiAsyncFeatureSource class.
public OgcApiAsyncFeatureSource(string url, string collectionId)
Parameters¶
url string
The landing-page URL of the OGC API - Features service.
collectionId string
The collection to read.
Methods¶
GetBoundingBoxAsyncCore(CancellationToken)¶
Returns the extent the service advertises for this collection, read when the source opened.
protected Task<RectangleShape> GetBoundingBoxAsyncCore(CancellationToken cancellationToken)
Parameters¶
cancellationToken CancellationToken
A token that cancels the operation.
Returns¶
Task<RectangleShape>
The advertised extent, or null when the service advertises none.
OpenAsyncCore(CancellationToken)¶
Reads the collections document and, when the service publishes one, the collection's schema.
protected Task OpenAsyncCore(CancellationToken cancellationToken)
Parameters¶
cancellationToken CancellationToken
A token that cancels the operation.
Returns¶
Task
A task that represents the asynchronous operation.
CloseAsyncCore(CancellationToken)¶
Releases the metadata read at open time.
protected Task CloseAsyncCore(CancellationToken cancellationToken)
Parameters¶
cancellationToken CancellationToken
A token that cancels the operation.
Returns¶
Task
A task that represents the asynchronous operation.
GetColumnsAsyncCore(CancellationToken)¶
Returns the columns from the collection's schema document.
protected Task<Collection<FeatureSourceColumn>> GetColumnsAsyncCore(CancellationToken cancellationToken)
Parameters¶
cancellationToken CancellationToken
A token that cancels the operation.
Returns¶
Task<Collection<FeatureSourceColumn>>
The columns, or an empty collection when the service publishes no schema.
GetFeaturesInsideBoundingBoxAsyncCore(RectangleShape, IEnumerable<string>, CancellationToken)¶
Requests the features inside , following the service's next links until the extent is exhausted.
protected Task<Collection<Feature>> GetFeaturesInsideBoundingBoxAsyncCore(RectangleShape boundingBox, IEnumerable<string> returningColumnNames, CancellationToken cancellationToken)
Parameters¶
boundingBox RectangleShape
The extent to query, in the service's own projection.
returningColumnNames IEnumerable<string>
Ignored; the service returns whole GeoJSON features.
cancellationToken CancellationToken
A token that cancels the operation.
Returns¶
Task<Collection<Feature>>
The features inside the bounding box.
GetFeaturesPageAsync(RectangleShape, IEnumerable<string>, string, int, CancellationToken)¶
Returns one page of features, carrying the service's next link forward as the continuation token.
public Task<FeaturePage> GetFeaturesPageAsync(RectangleShape boundingBox, IEnumerable<string> returningColumnNames, string continuationToken, int maxCount, CancellationToken cancellationToken)
Parameters¶
boundingBox RectangleShape
The extent to query, in the map's projection. Pass null for the whole collection.
returningColumnNames IEnumerable<string>
Ignored; the service returns whole GeoJSON features.
continuationToken string
The next link from the previous page, or null to start.
maxCount int
The largest number of features to return in this page.
cancellationToken CancellationToken
A token that cancels the operation.
Returns¶
Task<FeaturePage>
A page of features, and the next link when the service supplied one.
GetFeaturesByColumnValueAsyncCore(string, string, IEnumerable<string>, CancellationToken)¶
Returns the features whose equals , filtered by the service through its property query parameter.
protected Task<Collection<Feature>> GetFeaturesByColumnValueAsyncCore(string columnName, string columnValue, IEnumerable<string> returningColumnNames, CancellationToken cancellationToken)
Parameters¶
columnName string
The column to filter on.
columnValue string
The value the column must equal.
returningColumnNames IEnumerable<string>
Ignored; the service returns whole GeoJSON features.
cancellationToken CancellationToken
A token that cancels the operation.
Returns¶
Task<Collection<Feature>>
The matching features.
A(RectangleShape, int)¶
internal string A(RectangleShape , int )
Parameters¶
`` int
Returns¶
Events¶
SendingHttpRequest¶
Occurs before an HTTP request is dispatched so callers can inspect or cancel it.
public event EventHandler<SendingHttpRequestMessageEventArgs> SendingHttpRequest;
ReceivedHttpResponse¶
Occurs after an HTTP response is received.
public event EventHandler<ReceivedHttpResponseMessageEventArgs> ReceivedHttpResponse;