Validating Geotrace and Geoshape

I am using ODK Collect to collect line strings.

My problem is the following:
Geotrace does not force the user to collect at least 2 points. The result is a single point instead of a line if the user only collects one point.

Is there a way to validate geotrace so that the user must collect at least two points?

Apologies, I don't have an answer to your question.

But, if you can provide the details, I would be a curious to hear more details about your use case. What does the line string represent or how is the data being used that creates an issue with a single point?

@danbjoseph I suppose that by definition a line should contain two or more points? @Jefferson_Francisco I invite you to take a look at the thread on Collect geotrace and geoshape improvements and see whether you would like to propose making this a geotrace requirement along with other proposed changes.

For now, you can add a constraint that requires two or more semicolons. The constraint will look like regex(., '^([^;]*;){2,}$'). This says the resulting geotrace (the dot in the regex function) must contain non-semicolon characters ([^;]*) followed by a semicolon (;), repeated 2 or more times {2,}.

Here is a form that shows this at work.

1 Like

That regex constraint works very well.
:clinking_glasses:
Thanks!

1 Like