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
- Source
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.
Name | Type | Description |
---|---|---|
dataset | Object | The configuraion object from which the search is being conducted. |
layer | Object | The layer on which the result is found. |
row | Object | the returned data. |
- Source
(inner) datasets(term, gazetteer)
Calls the search function in cases where the gazetteer was not provided with datasets.
Name | Type | Description |
---|---|---|
term | string | The search term from the input |
gazetteer | Object | gazetteer configuration object. |
Name | Type | Attributes | Description |
---|---|---|---|
gazetteer.provider | String | <optional> | Provider for the search e.g. Google. |
gazetteer.qterm | String | <optional> | A database field to search for the term. |
- Source
(inner) getLocation(location, gazetteer)
Turns latitude and longitude parameters into a location.
Will display a warning if the returned location is outside the extent.
Name | Type | Description |
---|---|---|
location | Object | The configuraion object from which the search is being conducted. |
gazetteer | Object | The layer on which the result is found. |
Name | Type | Description |
---|---|---|
location.lng | Number | The longitude of the location. |
location.lat | Number | The latitude of the location. |
location.flyTo | function | module:/location/flyTo is used to go to a location. |
- Source
(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.
Name | Type | Description |
---|---|---|
term | string | The search term from the input |
dataset | Object | The parameters for the search. |
- Source