ODK XForms spec proposal: add `incremental=true` attribute for geotrace and geoshape

In support of Blocking invalid (self-intersecting) polygons in Collect, we propose adding the following function to the spec:

The boolean incremental attribute (see W3C XForms) is recognized on the geotrace and geoshape form control (body) elements. When a geotrace or geoshape question has incremental=true, any change to the value such as moving a vertex, adding a vertex, removing a vertex results in validating the new value and showing a constraint message if the constraint is violated. Clients may additionally choose to block the addition of new points when a constraint is violated to draw user attention to the problem. Clients may choose to recalculate and revalidate the whole form or not depending on performance considerations and how they display geo questions.

If no value or an invalid value is given for the attribute, it is ignored and revalidation and recalculation happen according to the client’s defaults.

This will primarily combine with the intersects function to provide ongoing feedback about self-intersections but could also be used to enforce things like a maximum expected area or perimeter.

I take it this means that moving a vertex that isn't the last one (say, adjusting position of # 3 of 10) that results in intersects causing a constraint violation will have the same outcome as adding a new vertex that results in an invalid polygon?

And this could also revalidate geofencing similarly to perimeter/area?

Sounds great to me, as any change to the geometry would then be checked and the user informed.

1 Like

Yes, that's right!

Yes but do note that currently geofence can only check if a specific point is inside a shape. Initially the incremental=true functionality will only be for trace and shape. We do eventually intend to implement it for points with maps as well but it won't be part of the initial release.