FeatureQuery
Finds the features that lie inside an area, which a host can often do
better than the browser, for example from a server that holds the layers.
Optional on Services: a host that supplies none offers no selection by
shape, and the ui must not require it. The SDK sends nothing itself, so a
host whose query sends a shape or layer ids to a server tells its visitors.
This is an interface exported by @mapcairn/core, checked against version 0.2.0.
Signature
import type { FeatureQuery } from "@mapcairn/core";
interface FeatureQuery
Description
It is a port of its own so that FeatureSelection stays synchronous.
Rules for every implementation:
- Every hit's
layerIdis one of the request'slayerIds, and a feature is listed once. - It returns
limithits when at least that many lie inside, and every hit when fewer do. It returns no more thanlimit, in any order. - An empty
layerIdsresolves with no hits. - It rejects only with a
FeatureQueryError:networkwhen the request failed,invalidwhen the request was not valid (anareathat is not a polygon with at least one closed ring on the globe, or alimitthat is not a whole number of at least 1) or the answer could not be read,unsupportedwhen the host cannot answer for the layers or the area, andabortedwhen the signal fires first, whether before the call or while it is pending. The ui ignoresaborted. - The port asks no more of an
areathan that. It does not check that a hole lies inside the outer ring, that no edge crosses another, or how many positions a ring has, so a host guards against a very large ring itself.
Methods
within
within(request: FeatureQueryRequest): Promise<readonly SelectionHit[]>;
Finds the features of the named layers that lie inside the area, at most limit of them.
request(FeatureQueryRequest)