Skip to content

ArcGisServerRestVectorAsyncFeatureSource

Namespace: ThinkGeo.Core

Reads features asynchronously from an ArcGIS Server REST feature layer.

public class ArcGisServerRestVectorAsyncFeatureSource : WebBasedAsyncFeatureSource, IHttpRequestService

Inheritance object → AsyncFeatureSource → WebBasedAsyncFeatureSource → ArcGisServerRestVectorAsyncFeatureSource
Implements IHttpRequestService

Remarks:

A bounding-box query runs in two steps, which is how the service is meant to be used: ask for the matching object ids, then fetch those ids in batches of ArcGisServerRestVectorAsyncFeatureSource.FeatureLimitPerRequest, at most ArcGisServerRestVectorAsyncFeatureSource.MaxConcurrentRequests at a time. That keeps a dense extent from becoming one enormous response.

ArcGIS also accepts a geometry simplification tolerance, maxAllowableOffset, which is only meaningful relative to how large the view is on screen. An ArcGisServerRestVectorAsyncLayer passes the size of the view for the queries of each draw; any other query - one made directly on this source, or on the layer outside a draw - sends no tolerance and gets the exact geometry, unless ArcGisServerRestVectorAsyncFeatureSource.MaxAllowableOffset is set.

Properties

Url

Gets or sets the URL of the ArcGIS Server REST feature layer.

public string Url { get; set; }

Property Value

string

Remarks:

Read when the source opens: the layer definition, fields 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.

OutSR

Gets or sets the spatial reference features are requested in.

public Nullable<int> OutSR { get; set; }

Property Value

Nullable<int>

Remarks:

Defaults to the layer's own spatial reference, read when the source opens.

MaxConcurrentRequests

Gets or sets how many requests may be in flight at once while fetching batches of features.

public int MaxConcurrentRequests { get; set; }

Property Value

int

FeatureLimitPerRequest

Gets or sets how many features to ask for in a single request.

public int FeatureLimitPerRequest { get; set; }

Property Value

int

Remarks:

ArcGIS Server caps the number of features it will return per request, and this should stay at or below that cap. The default of 200 is safe for a stock configuration.

OutFields

Gets the fields to bring back with each feature. Leave it empty for all of them.

public Collection<string> OutFields { get; }

Property Value

Collection<string>

MaxAllowableOffset

Gets or sets the geometry simplification tolerance sent as maxAllowableOffset.

public Nullable<double> MaxAllowableOffset { get; set; }

Property Value

Nullable<double>

Remarks:

In the units of ArcGisServerRestVectorAsyncFeatureSource.OutSR. A dynamic tolerance is always derived from the request extent and the screen size; when this is set it acts as a cap, so simplification never exceeds the caller's limit.

ResolutionBasedMaxAllowableOffsetFactor

Gets or sets a multiplier applied to the automatically calculated tolerance.

public double ResolutionBasedMaxAllowableOffsetFactor { get; set; }

Property Value

double

Remarks:

Greater than 1 simplifies more aggressively; between 0 and 1 preserves more detail.

GeometryPrecision

Gets or sets the coordinate precision requested from the server. Null sends none.

public Nullable<int> GeometryPrecision { get; set; }

Property Value

Nullable<int>

HttpClient

Gets or sets the HTTP client used for outbound requests.

public HttpClient HttpClient { get; set; }

Property Value

HttpClient

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

HttpMessageHandler

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

IWebProxy

TimeoutInSeconds

Gets or sets the request timeout, in seconds.

public int TimeoutInSeconds { get; set; }

Property Value

int

Credentials

Gets or sets the credentials used when authenticating requests.

public ICredentials Credentials { get; set; }

Property Value

ICredentials

UserAgent

Gets or sets the user-agent header sent with each request.

public string UserAgent { get; set; }

Property Value

string

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

ConcurrentAccess

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

bool

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

ProjectionConverter

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

WellKnownType

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

ArcGisServerRestVectorAsyncFeatureSource()

Initializes a new instance of the ArcGisServerRestVectorAsyncFeatureSource class.

public ArcGisServerRestVectorAsyncFeatureSource()

ArcGisServerRestVectorAsyncFeatureSource(string)

Initializes a new instance of the ArcGisServerRestVectorAsyncFeatureSource class.

public ArcGisServerRestVectorAsyncFeatureSource(string url)

Parameters

url string
The URL of the ArcGIS Server REST feature layer.

Methods

A(float, float)

internal void A(float , float )

Parameters

`` float

`` float

Returns

void

GetBoundingBoxAsyncCore(CancellationToken)

Returns the extent the service reports for this layer, read when the source opened.

protected Task<RectangleShape> GetBoundingBoxAsyncCore(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken
A token that cancels the operation.

Returns

Task<RectangleShape>
The layer extent, or null when the service reports none.

GetLayerInfo()

Gets the layer metadata read when the source was opened.

public ArcGisServerRestLayerInfo GetLayerInfo()

Returns

ArcGisServerRestLayerInfo
The layer information.

OpenAsyncCore(CancellationToken)

Reads the layer definition so the fields, geometry field, extent and spatial reference are known.

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 layer definition 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 fields read from the layer definition.

protected Task<Collection<FeatureSourceColumn>> GetColumnsAsyncCore(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken
A token that cancels the operation.

Returns

Task<Collection<FeatureSourceColumn>>
The columns this layer publishes.

GetFeaturesInsideBoundingBoxAsyncCore(RectangleShape, IEnumerable<string>, CancellationToken)

Requests the features inside , asking the service for the matching ids first and then fetching them in batches.

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 fields returned are controlled by .

cancellationToken CancellationToken
A token that cancels the operation.

Returns

Task<Collection<Feature>>
The features inside the bounding box.

GetFeaturesByIdsAsyncCore(IReadOnlyList<string>, IEnumerable<string>, CancellationToken)

Returns the features carrying the given object ids.

protected Task<Collection<Feature>> GetFeaturesByIdsAsyncCore(IReadOnlyList<string> ids, IEnumerable<string> returningColumnNames, CancellationToken cancellationToken)

Parameters

ids IReadOnlyList<string>
The object ids to fetch.

returningColumnNames IEnumerable<string>
Ignored; the fields returned are controlled by .

cancellationToken CancellationToken
A token that cancels the operation.

Returns

Task<Collection<Feature>>
The features found.

A(string, CancellationToken)

internal Task<ValueTuple<int, Collection<Feature>>> A(string , CancellationToken )

Parameters

`` string

`` CancellationToken

Returns

Task<ValueTuple<int, Collection<Feature>>>

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;