mapp.utils.gazetteer{}

The gazetteer is used to search for locations via a provider or by searching for matching terms in a database.

A provider can be supplied to search e.g. Google

{
  "provider": "GOOGLE",
  "maxZoom": 10,
  "streetview": {
    "key": "xxxxxxxxxxxxxxxxxxxx"
  },
  "options": {
    "componentRestrictions": {
      "country": "country code"
    }
  }
}

This search will use google services and not interact with the database, if datasets are provided the search will also look through the database:

"datasets": [
  {
    "qterm": "postcode",
    "title": "Postcode",
    "layer": "retailpoints"
  }
]

To search only the database only a smaller config can be provided:

"gazetteer": {
  "layer": "scratch",
  "qterm": "store_name",
  "table": "scratch"
},

Dictionary entries:

  • no_results
  • invalid_lat_lon

Requires

Methods

(inner) addRow(dataset, layer, row)

Adds any search results to a list to be displayed in the view.

Uses module:/location/get to add a location to search results so they can be shown on click.

Parameters:
NameTypeDescription
datasetObject

The configuraion object from which the search is being conducted.

layerObject

The layer on which the result is found.

rowObject

the returned data.

(inner) datasets(term, gazetteer)

Calls the search function in cases where the gazetteer was not provided with datasets.

Parameters:
NameTypeDescription
termstring

The search term from the input

gazetteerObject

gazetteer configuration object.

Properties
NameTypeAttributesDescription
gazetteer.providerString<optional>

Provider for the search e.g. Google.

gazetteer.qtermString<optional>

A database field to search for the term.

(inner) getLocation(location, gazetteer)

Turns latitude and longitude parameters into a location.

Will display a warning if the returned location is outside the extent.

Parameters:
NameTypeDescription
locationObject

The configuraion object from which the search is being conducted.

gazetteerObject

The layer on which the result is found.

Properties
NameTypeDescription
location.lngNumber

The longitude of the location.

location.latNumber

The latitude of the location.

location.flyTofunction

module:/location/flyTo is used to go to a location.

(inner) search(term, dataset)

Performs the search using the provided dataset and term.

Provides a custom onLoad function for xhr utils which adds the found rows to the result set shown in the view.

Parameters:
NameTypeDescription
termstring

The search term from the input

datasetObject

The parameters for the search.