odk:setlocationaction sets the current location's geopoint value in the instance data node specified in the
valueattribute or text content will be ignored. Failure to retrieve the location will result in an empty string value.
<odk:setlocation ref="/data/location" event="odk-instance-first-load" />
I would like to propose the following XLSForm spec to enable the collection of a single geopoint in the background on form load:
Introduce a new
auto-location type to the metadata section of the specification. Unlike the other metadata types, with
auto-location, the text in the
name column is chosen by the user. The provided
name is used to name the target node.
For example, given the following row in an XLSForm:
A node named
my-location would be added to the primary instance. That node would be given a type of
geopoint and be the target of a
setlocation action triggered by the
<bind nodeset="/data/my-location" type="geopoint" /> <odk:setlocation ref="/data/my-location" event="odk-instance-first-load" />
Of course, there’s a lot more that can be done with
setlocation when combined with
xforms-value-changed events and soon with
odk-new-repeat events. I think those should be addressed by a different spec.