On occasion, you may want to limit the extent in which points can be input into a survey. This may be to simply validate the input data on initial entry, or to restrict input for functional requirements. In the attached survey, the extent has been limited to Ireland. In order to do this, there are a few things that have to be done.
A good way to do this is to go to your organisations settings. Go to your Organisation - Edit Settings - Map and click Choose Extent as below.
From there, you can a Draw an extent, and note down the Lat/Long values you will need to use in your survey. The values below correspond to the values used in the attached form, so you can directly replace them as necessary.
The alternative is to use the super-useful Super-Duper Extent Helper developed by Bradley Snider.
There are various calculations you have to make in order to limit and input point to a particular extent, as below.
This is ultimately what is used to check whether the point is within the specified extent. A message is returned to the user if it is not within the appropriate extent. In order for this to pass, it's value must equal 2 (i.e. the sum of both if statements). If it is not equal to 2, it means that either the x or y attributes, or both do not lie within the specified extent.
In order to hide any validation calculations, we set the field types as hidden. We also use The Power of Nothing to ensure fields are not created to store the calculation results being used as part of the point validation (see bind::esri:fieldType column).
This will help notify the user that they are outside of the allowable extent. To do this, you add a note row, along with a label - not including a name here results in a field not being created in the Feature Layer for the note. Then specify a relevant calculation so that the warning message only gets displayed when the user is outside of the allowable extent.
See the completed form below (also attached):
type | name | label | constraint | constraint_message | relevant | calculation | bind::esri:fieldType |
geopoint | Location | Specify Location | |||||
hidden | XValue | X Co-Ordinate | pulldata("@geopoint",${Location},"x") | null | |||
hidden | YValue | Y Co-Ordinate | pulldata("@geopoint",${Location},"y") | null | |||
hidden | ValidX | X Within Range | if((number(${XValue}) > -10.7) and (number(${XValue}) < -5.4), 1, 0) | null | |||
hidden | ValidY | Y Within Range | if((number(${YValue}) > 51.4) and (number(${YValue}) < 55.4), 1, 0) | null | |||
hidden | Allowed | Within Specified Extent? | .=2 | Specified Location Outside of Extent | int(${ValidX}) + int(${ValidY}) | null | |
note | <b><center><font color="red">**** Specified Location Outside of Ireland ****</font></center></b> | ${Allowed} != 2 |
This is not currently supported in Web Forms because the pulldata() function is not supported when used against geopoint question (as documented here)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.