Select to view content in your preferred language

Calculating a geotrace from 2 geopoint repeat records

2302
10
07-16-2021 05:02 AM
Adrian_S
Occasional Contributor

I need to display on a map on a form a line connecting a series of geopoints.  Can anyone suggest please a better way to do it than outlined below?

The geopoints are entered by people surveying lengths of hedge to mark changes such as different characteristics or direction.

I've almost got a solution, in Survey123 (XLSForm is attached below). However, in the field app the map displays without the blue geotrace line showing: calculated geotrace - before refresh.png

It's only after the surveyor goes back one repeat and manually taps the map refresh button (circled in red above) that the line appears:calculated geotrace - after refresh.png

Is there a way to auto-refresh, or another method altogether?

10 Replies
BarbaraWebster1
Esri Regular Contributor

Hi Adrian,

You could put one geopoint in a repeat and then calculate the geotrace outside the repeat with the sum() function. See the attached XLS.

This XLS is an excerpt from the Line and Polygons sample survey, which demos a few other methods for working with lines and polygons that might be useful. It's available in Connect when you click on New Survey>Samples and search for Lines and Polygons. 

-Barbara

Adrian_S
Occasional Contributor

Thanks Barbara.

Not quite what I was asking. Sorry if I've confused everyone!

Your geotrace includes all the repeated geopoints, whereas I need the trickier case of a geotrace of any 2 geopoints selected from many.

As per my original solution, I'd solved that, except that the geotrace requires manual refresh, for every repeat instance.

Any thoughts on eliminating the manual refresh please?

Adrian.

0 Kudos
DerrickWestoby
Frequent Contributor

What about using once() on the geotrace calc, along with adding a condition to the relevant column that the geotrace isn't calculated until you have 2 repeat entries, using count()? 

I don't know if this will work or not, but I did use the relevant/count approach when geoshape & geoshape were first released to keep from having to hit the refresh button on the geoshape once 3 or more repeats were added.  I'm assuming that using once(sum(${repeat_location}) for the geotrace calc would work, but haven't tried it. 

edit: After re-reading, hopefully I'm not misunderstanding the question too.  I'm assuming that you're just wanting to calculate a 2-vertex line out of any random two geopoints in a repeat, and that it only needs to happen once, and you don't care which 2 points.  Now that I noticed you're creating a tool for surveyors, I'm thinking I misunderstood the workflow.  Is this just a tool for them to input coordinates and calculate a projected bearing and distance as-needed or something?   I guess a different approach if that is the case could be to create nested repeats, where the the geotrace is contained within a repeat and max-2 geopoints are contained in a nested repeat.   I assume this would allow the surveyors just to add + a new repeat (the geotrace) each time they need to do a new calc, instead of changing the existing points and refreshing the existing geotrace.   

Apologies if I'm way off the mark on one or both of these comments...

BarbaraWebster1
Esri Regular Contributor

Does the geotrace question need to be in the repeat for your workflow? If you moved it outside the repeat and used the same calculation method from your original XLS form (current geopoint concatenated with the next geopoint in the repeat), you would be able to see the geotrace based on two geopoints and wouldn't need to manually recalculate every time a geopoint is added or changed (see attached XLS form). 

As far as I know there isn't currently a way to change the default calculation behavior for the geotrace question inside the repeat.  

-Barbara

0 Kudos
JoshB123
Occasional Contributor

Hi,

I know this post is old now but in case anyone find this useful, I figured a solution to a similar problem I had.

Im creating a transect route survey, that allows surveyors to create various geopoints within a repeat. The main reason for doing this is so I can calculate the length of each transect section.

Each repeat record holds the section point and then creates a section line by calculating the current and previous repeat records. The main survey layer then calculates the overall transect line by using sum(${repeat_geopoint}).

The method I used was to pull the Lat and Long from the previous repeat records, then create create the previous geopoint from that. It might be more convoluted than it needs to be but it works for my purposes. 

Here's a snippet of my XLS form in case it is useful

JoshB123_1-1716032512136.png

The result is that I get one feature layer that has the overall Transect (left) and another layer that has each section in (right)

JoshB123_2-1716032671155.pngJoshB123_3-1716032718347.png

 

I also used calculationmode seen here to ensure the calculations always refresh automatically if the user wants to edit their points

Survey123 Tricks of the Trade: Calculation modes (esri.com)

 

Josh

 

 

DianaTorres10
Occasional Contributor

@JoshB123 

Hi Josh, I used your example on my Survey and I was wondering if you have any advice for my situation.

I'm trying to get a record of the coordinates of each point submmited by the user and also make the geotrace the main geometry.

I already set both geopoints with a null fieldType, however the main gemotry is still a point.

DianaTorres10_0-1724453900395.png

Thanks!

 

Laura

 

 

 

0 Kudos
JoshB123
Occasional Contributor

Hi Laura,

"I already set both geopoints with a null fieldType, however the main gemotry is still a point."

I've experienced this type of problem when i've added the geopoint questions before adding the geotrace question. For some reason it seems to always take the first geo question that is created (even if you change them to null).

Without knowing the specifics of your XLS form, my first thought is try creating a Survey from scratch and make sure to add the geotrace question above and before adding any geopoint rows that are intended to be null.

Hope that helps.

Josh

0 Kudos
DianaTorres10
Occasional Contributor

Yeah, I already made that:

DianaTorres10_0-1724774967709.png

It works perfectly fine before publishing:

DianaTorres10_1-1724775025966.png

 

However once published it won't work:

DianaTorres10_2-1724775062557.png

Thanks anyway.

 

Laura

 

0 Kudos
JoshB123
Occasional Contributor

You're problem maybe due to creating the geotrace line using the sum function, but you need to use the concat function instead (see my geotrace question in the screenshot above).

Josh

0 Kudos