/location/get
The module exports the location get and getInfoj methods to request location data from the XYZ host.
- Source
Requires
Methods
(inner) get(location, list) → {Promise.<object>}
The method will shortcircuit if a default getLocation method has been assigned to the [highlight] interaction.
The get method assigns a unique location.hook composed from the location.layer.key and the location.id.
The layer.key being unique to the locale, and the id being unique to the layer makes the location.hook unique to the mapview.
A location will be removed from the list object param if the location already exists in the list. Otherwise the location will be assigned as a property to the list object.
The getInfoj() method is awaited before the location is decorated.
Name | Type | Description |
---|---|---|
location | object | |
list | object | Object in which locations are stored as properties. |
Name | Type | Attributes | Description |
---|---|---|---|
location.layer | layer | The layer to which the location belongs. | |
location.id | string | The ID must be unique for the layer dataset. | |
layer.infoj | Array | <optional> | The infoj array from the layer, this is required to decorate the location. |
layer.mapview | mapview | ||
mapview.interaction | object | The current [highlight] interaction. | |
mapview.hooks | boolean | Hooks are enabled for the location.layer.mapview. |
- Source
Decorated location
- Type:
- Promise.<object>
(inner) getInfoj(location) → {Promise.<object>}
The method sends a parameterised query to the location.getTemplate query template.
The response is expected to be an object, not an array.
The response properties are mapped into clones of the layer.infoj which will be assigned to the location.
Name | Type | Description |
---|---|---|
location | object |
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
location.layer | layer | The layer to which the location belongs. | ||
location.getTemplate | layer | <optional> | 'location_get' | The query template for the location data. |
- Source
The populated location.infoj entries array.
- Type:
- Promise.<object>