I've attempted to build a Survey123 form that calculates an estimated transmitter location using triangulation based on azimuths and GPS points from 3–5 observer positions. Each observer records:
A geopoint (their current location)
An azimuth (direction of strongest signal via radio telemetry)
The goal was to estimate:
Latitude & longitude of the signal source
Error radius based on variance between intersections
In the XLSForm, I used a repeat group to collect observer location + azimuth, then constructed a triplet_string like lat,long,az | lat,long,az| ... This string was passed to a JavaScript function using:
pulldata("@javascript", "triangulate.js", "triangulateFromRepeat", ${triplet_string}, 0)
The trinagulate.js script included:
parent.triangulateFromRepeat = function(inputString) {
return [estimatedLat, estimatedLon, errorRadius];
};
I tried defining test functions with static return values and packaged a minimal test form which confirmed that Survey123 could see the script but not invoke any function inside it.
Despite following Esri's documented pattern (parent.functionName = ...), Survey123 Connect (v3.22.49) consistently returned:
@javascript error: TypeError: Property 'functionName' of object [object Object] is not a function
This occurred with multiple valid JS definitions, a stripped-down test form, and with clean scripts with no syntax errors.
Are functions defined with parent.functionName = ... not accessible?
Any thoughts on how to estimate a location using triangulation using multiple points and azimuths inside of Survey123?