Skip to main content

SearchProvider

Finds places by name. Implementations throw SearchError for offline, rate-limited or failed requests and PortAbortError when the signal fires. When a search runs, and cancelling a superseded one, belong to one ui hook. A service's own usage limits (such as Nominatim's one request per second) belong to its implementation, since every caller shares them.

This is an interface exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import type { SearchProvider } from "@mapcairn/core";

interface SearchProvider

Methods​

reverse​

reverse(position: LatLng, options?: Pick<SearchOptions, "signal">): Promise<SearchResult | null>;

Finds the place at a position, or null when there is none.

  • position (LatLng)
  • options? (Pick<SearchOptions, "signal">)
search(query: string, options?: SearchOptions): Promise<readonly SearchResult[]>;

Finds places that match the text. A blank query resolves to an empty list.

  • query (string)
  • options? (SearchOptions)

See also​

Source: packages/core/src/ports/search.ts:39