LayerSearch

ol-ishare/search~ LayerSearch

Layer search instance compatible with Gazetteer control. See module:ol-ishare/search~layerSearchForLayer to create a LayerSearch from an existing overlay layer.

Constructor

new LayerSearch(options)

Implements:

Layer search instance compatible with module:ol-ishare/control/gazetteer~Gazetteer control To use with module:ol-ishare/control/gazetteer~Gazetteer pass an instance of LayerSearch as a member of module:ol-ishare/control/gazetteer~Gazetteer options.sources Array.

import { LayerSearch } from 'ol-ishare/search';
Parameters:
Name Type Description
options Object

Options

Properties
Name Type Description
iShareUrl String

Base URL for iShare Web app

profile String

Name of profile that the search is associated with

owsUrl String

Base URL for WMS/ WFS requests (only required when iShareUrl and profile options are not supplied)

layerName String

Name of layer to search

searchField String

Name of field to search

srs String

EPSG code of the search results defaults to EPSG:27700 (British National Grid)

formatResult function

Function called with feature argument, expected to return a string that will be displayed to the user

maxFeatures Number

Maximum number of features to return from the server

Methods

Implements:

Fetches feature search results, returns a Promise which will resolve to an Array of module:ol-ishare/ui/gazetteer~GazetteerResult objects or an error

Parameters:
Name Type Description
query string

String to search for

Returns:

Promise that resolves to an Array of GazetteerResult objects or an Error

Type
Promise.<Array.<module:ol-ishare/ui/gazetteer~GazetteerResult>>