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
@JosephRhodes2 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
@JosephRhodes2 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