/location/get

The module exports the location get and getInfoj methods to request location data from the XYZ host.

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.

Parameters:
NameTypeDescription
locationobject
listobject

Object in which locations are stored as properties.

Properties
NameTypeAttributesDescription
location.layerlayer

The layer to which the location belongs.

location.idstring

The ID must be unique for the layer dataset.

layer.infojArray<optional>

The infoj array from the layer, this is required to decorate the location.

layer.mapviewmapview
mapview.interactionobject

The current [highlight] interaction.

mapview.hooksboolean

Hooks are enabled for the location.layer.mapview.

Returns:

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.

Parameters:
NameTypeDescription
locationobject
Properties
NameTypeAttributesDefaultDescription
location.layerlayer

The layer to which the location belongs.

location.getTemplatelayer<optional>
'location_get'

The query template for the location data.

Returns:

The populated location.infoj entries array.

Type: 
Promise.<object>