geopoint with default coordinates

3271
2
Jump to solution
04-08-2021 07:56 AM
SaraMiller
New Contributor III

I am trying to use a geopoint field for both known and unknown site locations.  I followed guidance on https://community.esri.com/t5/arcgis-survey123-blog/calculations-on-geopoints/ba-p/893788 to set up the default coordinates of known site locations using a list on the Choices tab.

In a previous version of the survey (before I switched to the latest XLS form), if a known site was selected, the geopoint field would not be relevant so the map field would not show in the app, but the data point would still map correctly on the Data tab in Survey123 online.  If one of the "Other" options were selected, the geopoint field would be relevant, the map field would appear in the app, and user could input a new point on the map.  Therefore, the same geopoint field is used to map both known and unknown sites, and the location of known sites cannot be erroneously changed by the user because the map field does not appear for these.

However, in the latest version of the survey (using the latest XLS form), if the geopoint field is not relevant for a known site, it does not map a point according to the default coordinates on the Data tab and instead defaults to 0-0 off the Atlantic coast of Africa (the desired default if no point is entered for "Other" sites).

I have tried to set the geopoint field to be readonly if a known site is selected, e.g., any site that is not one of the "Other" sites, so that the map appears with the default point showing and cannot be erroneously edited by a user.  However, if one of the "Other" site options is selected, only a bar appearing for the map which cannot be edited to enter a new point location.

${Site}!='Other_CEE' or ${Site}!='Other_NE' or ${Site}!='Other_SE' or ${Site}!='Other_NI' or ${Site}!='Other_W' or ${Site}!='Other_NS'  or ${Site}!='Other_SS' or ${Site}!='Other_IR'

Can someone help me figure out how to meet the following requirements:

1. When a known site is selected, the point appears on the Data tab map according to the default coordinates for that site.  (It doesn't matter whether or not the map appears in the app, as long as it is correctly mapped with the data.)

2. If the map must be shown for a known site to fulfill requirement #1, then this map needs to be read-only, or otherwise un-editable by a user.

3. When one of the "Other" site options is selected, the map appears and a user can enter a new point on the map for this site.

I have attached several screenshots of various iterations as well as the current XLS form for v7.1.

 

0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

Hi @SaraMiller 

The rule with relevant statements is that if the relevant expression evaluates to false, your question will be hidden AND its value will be nulled. If you want to use an expression to just hide question without nulling its value, then use your expression in the body::esri:visible.

The behavior you observe where your geopoint question is set to a null value when the relevant statement is true, is correct.

As I indicate above, you may want to consider using body::esri:visible instead of relevant. Another approach is illustrated in the attached XLSForm.

Essentially, I added a question for the user to specify if the location will be set using a list of known places or a map.  The output geopoint question uses the coalesce() function to calculate its value from either the list or the map, whatever is not null.

Since in ArcGIS a layer can only have one geometry column, I set the esriFieldType column in the XLSForm to null for my first map.

I also set the output map as a required read-only question to ensure the user selects a location from the list or the map.

aa.gif

 

View solution in original post

0 Kudos
2 Replies
IsmaelChivite
Esri Notable Contributor

Hi @SaraMiller 

The rule with relevant statements is that if the relevant expression evaluates to false, your question will be hidden AND its value will be nulled. If you want to use an expression to just hide question without nulling its value, then use your expression in the body::esri:visible.

The behavior you observe where your geopoint question is set to a null value when the relevant statement is true, is correct.

As I indicate above, you may want to consider using body::esri:visible instead of relevant. Another approach is illustrated in the attached XLSForm.

Essentially, I added a question for the user to specify if the location will be set using a list of known places or a map.  The output geopoint question uses the coalesce() function to calculate its value from either the list or the map, whatever is not null.

Since in ArcGIS a layer can only have one geometry column, I set the esriFieldType column in the XLSForm to null for my first map.

I also set the output map as a required read-only question to ensure the user selects a location from the list or the map.

aa.gif

 

0 Kudos
SaraMiller
New Contributor III

Excellent, thank you Ismael.  I used the first solution you suggested and put myexpression in the body::esri:visible column and it seems to work, given the three different mapping options I've been hoping for.

0 Kudos