How to Constrain Geopoint Locations?

1457
3
Jump to solution
11-20-2016 06:55 AM
BradWells2
New Contributor II

How could I set constraints on geopoint lat/lon data in Survey123 Connect such that responses are limited to a rectangular area?

I have tried to use an expression similar to the following to accomplish it, but to no avail.

((pulldata("@geopoint", ., "x") >= -##.#### and pulldata("@geopoint",., "x") <= -##.#### ) and (pulldata("@geopoint", ., "y") >= ##.#### and pulldata("@geopoint",., "y") <= ##.#### ))

Any ideas?

1 Solution

Accepted Solutions
BradWells2
New Contributor II

I have resolved the issue by moving the constraint to a calculate field based on the lat/lon of the geopoint field.

View solution in original post

3 Replies
BradWells2
New Contributor II

I have resolved the issue by moving the constraint to a calculate field based on the lat/lon of the geopoint field.

View solution in original post

NealeHutcheon
New Contributor II

Brad,

I'm trying do something similar. 

I tried this in the geopoint constraint using separate pulldata functions but it still allowed all points to validate even if outside the range of lat/lon I set.

geopoint constraint (${X_Value}>140 and ${X_Value}<150 and ${Y_Value}>-39.2 and ${Y_Value}<-36)

where

X_Value calculation pulldata("@geopoint",${location},"x")

Y_Value calculation pulldata("@geopoint",${location},"y")

 Can you see where I've got this wrong ?

0 Kudos
FlorentBigirimana
New Contributor III

Hi Brad,

I have done something similar by 

1. creating an external choice table with rectangular  coordinate field a of my working area as a string  (working area, x_min,x_max,y_min,y_max)

2.creating a fields x_min, x_min,x_max,y_min,y_max  populated by the substr function from the working area coordinate string

2.created field, in my survey of latitude and longitude populated by the pulldata@geopoint  function

3.made the following calculation ${longitude}>=${x_min}and${longitude}<=${x_max} and ${latitude}>=${y_min}and${latitude}<=${y_max}

So this is working fine for me