marker-query

Version compatibility

marker-query was introduced in version 4.82.0 of the JourneyApps Runtime.

Overview

marker-query is almost identical to marker. It differs in that the markers can be populated on the map using a query.

Basic Example

Below is an example of using capture-coordinates along with a marker-query.

schema.xml
<model name="user" label="User">
    <field name="name" label="Name" type="text:name"/>
    <field name="location" label="Location" type="location"/>
    <display>{name} - {location}</display>
</model>
main.view.xml
<var name="current_location" type="location" />
<var name="users" type="query:user" />

<capture-coordinates bind="current_location">
    <marker-query query="users" latitude="{location.latitude}" longitude="{location.longitude}" label="{name}" />
</capture-coordinates>
main.js
function init() {
    view.users = DB.user.where('location != ?', null);
}

Standard Attributes

bind

See marker > bind.

label

See marker > label.

latitude and longitude

See marker > latitude and longitude.

query

Required

Type: location

Default: unset

A query or array of objects containing a location variable or field. Use latitude and longitude from the location variable or field to specify a marker's location.

<var name="current_location" type="location" />
<var name="markers" type="array:location" />

<capture-coordinates bind="current_location">
    <marker-query query="markers" latitude="{marker.latitude}" longitude="{marker.longitude}" />
</capture-coordinates>

Advanced Attributes

color

See marker > color

icon

See marker > icon

icon-color

See marker > icon-color

on-press

See marker > on-press

Last updated