I have a field map with a point layer and when a user selects a point, the pop up contains a link that launches survey123 and automatically fills in some of the survey fields based on information from field maps using the field:fieldname parameter. I assumed that the location of the point in field maps would be used as the location of the entry in survey123, but instead it uses the user's location. Is there a way to use the field maps point location as the survey123 location?
Solved! Go to Solution.
Hi Sean, here's how we do that:
You'll need to use an Arcade expression to get the lat-long values. If your Field Maps point data happens to be in 4326 (WGS 84), you can just add
"¢er=" + Geometry($feature).y + ',' + Geometry($feature).x
@JRhodes is correct with the URL values, but if your data is in WGS84 (Web Meractor) the Geomtetry($feature) returns projected coordinates instead of the necessary decimal degrees. You'll need to convert them.
function MetersToLatLon(x, y) {
var long = (x / 20037508.34) * 180;
var lat = (y / 20037508.34) * 180;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return{
y: lat,
x: long
}
}
var latlon = MetersToLatLon(Geometry($feature).X, Geometry($feature).Y);
// assuming you have a URL already and adding parameters
url = url + "¢er=" = latlon.y + "," + latlon.x
Other examples of that here and elsewhere on the community forums
Hi Sean, here's how we do that:
You'll need to use an Arcade expression to get the lat-long values. If your Field Maps point data happens to be in 4326 (WGS 84), you can just add
"¢er=" + Geometry($feature).y + ',' + Geometry($feature).x
Hi Joseph, I'm having a similar issue but with pulling in the z value and horizontal accuracy from Field Maps into Survey123. The S123 form is set up to capture the x, y, z values, along with the horizontal accuracy of the point that is created in Field Maps and hyperlinks to a Survey123 form. When the S123 form is initiated directly through the Survey123 app all of those values are captured correctly, however, when the form is initiated from hyperlink in Field Maps, only the x and y values are carried over. Any ideas on how I can bring in the z and horizontal accuracy as well? Thanks
@JRhodes is correct with the URL values, but if your data is in WGS84 (Web Meractor) the Geomtetry($feature) returns projected coordinates instead of the necessary decimal degrees. You'll need to convert them.
function MetersToLatLon(x, y) {
var long = (x / 20037508.34) * 180;
var lat = (y / 20037508.34) * 180;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return{
y: lat,
x: long
}
}
var latlon = MetersToLatLon(Geometry($feature).X, Geometry($feature).Y);
// assuming you have a URL already and adding parameters
url = url + "¢er=" = latlon.y + "," + latlon.x
Other examples of that here and elsewhere on the community forums
Thank you both so much for the very helpful responses!
did you get it working? If so please mark the comment that helped you as the answer so the post is closed.
Cheers, Chris