Collector (Aurora) Custom Expressions in Custom URL Scheme Error

1791
10
04-11-2019 07:44 AM
WarrenCarver
New Contributor II

I am writing a campsite collection form that uses Collector and Survey 123. I set this up using Arcmap's custom URL scheme. The user can select a site in collector and two links are included in the pop-up. One says Resurvey Campsite the other says Survey New Site. The resurvey link has a rather lengthy URL that attempts to pre-fill many of the fields of survey123. This worked other than the attributes that I had custom expressions to set correctly. The final bit the resurvey link sends the coordinates of the campsite using another custom expression.

Unfortunately, the custom expressions would work on my desktop, but when I opened collector on the iPad issued to me, they would not. I posted on this issue and was informed that Collector Aurora would support custom expressions in the URL link. I signed up for the beta and had fair success with the iPad. Some custom expressions still didn't send but coordinates did, and they were the most important one to work.

Now that Collector (Aurora) is officially out, I went out and field tested the two apps to discover that custom expressions are once again not working on my iPad or Samsung Galaxy phone. I am curious is this is a known issue and can be fixed or not, as it is rather pivotal that I can at least send the coordinates of the point to Survey 123. Below is my custom URL scheme for the resurvey link and the steps I went through to test if the custom URL was truly the issue

Resurvey Campsite Link - (&center={expression/expr2} is the non-functioning part)

arcgis-survey123://?itemID=1284e4815d4c4995b5809f1a51a83f9f&field:District={expression/expr1}&field:Wilderness_CRD={expression/expr3}&field:Wilderness_BRRD={expression/expr4}&field:Wilderness_CRRD={expression/expr5}&field:New_Site=no&field:Date_Orig_Collection={calOrigYear}&field:Campsite_ID_Number={expression/expr0}&field:Dist_Along_Trail={Dist_Along_Trail}&field:Ground_Dist={Ground_Dist}&field:Tree_Damage={Tree_Damage}&field:Disturbed_Area={Disturbed_Area}&field:Overall_Imp={Overall_Imp}&field:Between_Trail_Stream={Between_Trail_Stream}&field:Water_Source={expression/expr7}&field:Water_Dist_FT={Water_Dist}&field:Social_Trails={Social_Trails}&field:Main_Trail_Designated={Main_Trail_Designated}&field:Trail_Dist_FT={Trail_Dist}&field:Impact_Area={expression/expr6}&field:Litter_Trash={Litter_Trash}&field:Pot_Site_Expan={Pot_Site_Expan}&field:NNIS_Presence={NNIS_Presence}&field:Site_Condi={Site_Condi}&field:Rec_Site_S={expression/expr8}&field:Admin_Structures={Admin_Structures}&center={expression/expr2}

Resurvey Campsite Link Output on Desktop

arcgis-survey123://?itemID=1284e4815d4c4995b5809f1a51a83f9f&field:District=CRRD&field:Wilderness_CRD=&field:Wilderness_BRRD=&field:Wilderness_CRRD=MT&field:New_Site=no&field:Date_Orig_Collection=2007&field:Campsite_ID_Number=1&field:Dist_Along_Trail=&field:Ground_Dist=1&field:Tree_Damage=1&field:Disturbed_Area=1&field:Overall_Imp=3&field:Between_Trail_Stream=&field:Water_Source=1&field:Water_Dist_FT=45&field:Social_Trails=%20&field:Main_Trail_Designated=&field:Trail_Dist_FT=-100&field:Impact_Area=3&field:Litter_Trash=%20&field:Pot_Site_Expan=Medium&field:NNIS_Presence=Unknown&field:Site_Condi=Fair&field:Rec_Site_S=&field:Admin_Structures=N%2FA&center=34.745047%2C%20-83.844254

Expression/expr2 - Code to calculate geometry

function metersToLatLon(mx, my) {

   var originShift = 2.0 * PI * 6378137.0 / 2.0;

   var lon = (mx / originShift) * 180.0;

   var lat = (my / originShift) * 180.0;

   lat = 180.0 / PI * (2.0 * Atan(Exp(lat * PI / 180.0)) - PI / 2.0);

return [lat, lon];

}

var poly = Geometry($feature);

var result = '';

if (!IsEmpty(poly)) {

   var latlon = metersToLatLon(poly.x, poly.y);

   result = Round(latlon[0], 6) + ', ' + Round(latlon[1], 6);

}

return result;

Process for Testing Error

  • After noticing the error in the field, I retested each device in the office

     Desktop (Success)                          iPad (Error) - Newest Collector App             Android (Error) - Beta App

  • I then created a third link that only included the code to send the coordinates and tested it on each device

    Link - arcgis-survey123://?itemID=1284e4815d4c4995b5809f1a51a83f9f&center={expression/expr2}

    Desktop (Success)                       iPad (Error) - Newest Collector App             Android (Error) - Beta App

  • Finally, I created one more link that sent a fixed coordinates instead of using the custom expression

Link - arcgis-survey123://?itemID=1284e4815d4c4995b5809f1a51a83f9f&center=34.734837%2C%20-83.916739

     Desktop (Success)                       iPad (Success) - Newest Collector App             Android (Success) - Beta App

Thank you for anyone who has made it this far, I would really appreciate any help on resolving this bug as I'm super excited about using Collector and Survey 123. Good work!

10 Replies
MarkBockenhauer
Esri Regular Contributor

Thanks for your write up.  In a different context (ArcGIS Pro) I have noticed that in some instances the geometry function will return values in the coordinate system of the source data, while in others it returns values in the coordinate system of the map.  I mention this because your result difference  -9331888.963170711 vs. -83.829785  Is what I have seen while using a similar expression in ArcGIS Pro - Labeling vs. Popup vs. Calculation - same expression yields different results.  It would appear that there is something in the webmap use case that triggers similar inconsistencies.

0 Kudos