Dear users,
It’s my pleasure to share this solution to the question of (How to constraint Geopoint for the desired area ?). While the user pins the location, four different values will combine and save in the variable in the space-separated format: ( 36.1242 42.2563 0 0 ).
Latitude: 36.1242
Longitude: 42.2563
Altitude: 0
Accuracy: 0
To retrieve the first and second values ( latitude and longitude), we should use the built-in function selected-at(). To specify the square area we need (minimum, maximum) points of latitude and longitude, you can get these coordinating points anywhere.
selected-at( x , y) has two parameters:
x is the variable name.
y is the index number.
In the constraint column, you should use this template function:
selected-at(${geopoint_variable},0) >= number and selected-at(${geopoint_variable,0) <= number
and
selected-at(${geopoint_variable},1) >= number and selected-at(${geopoint_variable},1) <= number
Example:
selected-at(${place},0) >= 36.131125 and selected-at(${place},0) <= 36.249716
and
selected-at(${place},1) >= 43.948286 and selected-at(${place},1) <= 44.06856
In this example, the geopoint constraint forces the user to pin inside Erbil city in the Kurdistan region of Iraq.
Here is the XLSForm file:
Geopoint constraint.xlsx (8.7 KB)