capture-coordinates display-coordinates
Below is an example of using capture-coordinates
along with a marker-query
.
Copy < 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 >
Copy < 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 >
Copy function init () {
view .users = DB . user .where ( 'location != ?' , null );
}
Below is an example of using display-coordinates
along with multiple query markers.
Copy < 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 >
Copy < var name = "map_center" type = "location" />
< var name = "users" type = "query:user" />
< display-coordinates bind = "map_center" >
< marker-query query = "users" latitude = "{location.latitude}" longitude = "{location.longitude}" label = "{name}" />
</ display-coordinates >
Copy function init () {
view .map_center = journey . hardware .getCurrentLocation ();
view .users = DB . user .where ( 'location != ?' , null );
}
Copy < 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 >