Hey folks,
I have a polygon layer in collector to map plots and want to use Survey123 to collect more data to this plot. I managed to open my Survey out of collector with handing over the objectid of my feature to the survey so I can easily join the data later again. I was wondering if I could also hand over the coordinates of the centroid of my polygon to set the geopoint of my survey to have also the survey data in the correct place.
You can but you would have to add the X and Y of the centroid polygon as attributes to the feature layer first. Then you can pass them using the center parameter like in this blog post. If the polygons are moved, however, the attributes will not be updated.
Thanks Michael. But that doesn't work when I just created a new polygon in Collector and want to use its centroid coordinates. What a pitty.
Michael, can you clarify? I understand I can pass lat,long coordinates to survey123 using the center parameter, but does this actually create a geopoint with those coords or does it simply center the map at that point? Thanks.
ichivite-esristaff says in https://community.esri.com/groups/survey123/blog/2016/07/30/understanding-survey123s-custom-url-scheme :
The last parameter we pass in the example above is center=43.567,-117.380. This will set the location of geopoint questions in your survey at the provided coordinate pair. You must pass a latitude-longitude pair in decimal degrees separated by a comma as no other coordinate systems or formats are supported.
So I understand it as the geopoint will be set to these coordinates.
Just to clarify, if you pass lat/long coordinates into a Survey123 form using the center parameter, the location of the geopoint question in the Survey123 form gets overwritten. So instead of your current location being used (which is the default), the lat/long parameters passed in are used.
Thanks for the info Michael and Nicole.
I'm trying to pass manhole coordinates to Survey123 but cannot seem to get it to stick. I have created a DECCOORD field in my manhole feature class containing the coordinates in decimal degrees (39.216150990637,-119.738567302004). I use the center={DECCOORD} parameter.
Tested center=39.216150990637,-119.738567302004 and the coordinate is passed and correctly located in the survey.
What am I missing? Thanks!
I would suggest you pass the {DECCOORD} parameter into a text field (e.g. &field:TextFieldName={DECCOORD}) to see exactly what it's passing (or look at the hyperlink in a feature popup). There is probably something in there that it is not expecting. Either that or there is a syntax error or a misspelling with one of the parameters. What is the full parameter you are using?
It is possible to get the centroid of a polygon via Arcade. So once Collector supports Arcade (see The Aurora Project), you will be able to pass the centroid of a polygon to Survey123 using this method directly after a polygon is created through Collector.
The one caveat is that using the Geometry() function (which is needed to pass in the polygon geometry) as an input to the Centroid() function will yield results only as precise as the view's scale resolution. Therefore values returned from expressions using this function may change after zooming between scales.
Michael, an additional limitation on the technique of using Arcade- the coordinate will be expressed in the coordinate system of the map - the map for that workflow will need to be in a GCS (like WGS 1984, SRID 4326).
Michael Kelly
Hi Nicole and Michael,
I'm following along with Ismael Chivite in the https://community.esri.com/groups/survey123/blog/2016/07/30/understanding-survey123s-custom-url-scheme and I've found that I when I pass the coordinates from Collector to Survey123 using attribute expressions (X/Y of a point location). The result I get "${expression/expr2}" deposited in a text field I'm using to check my variables. I'm sending the same content as using the 'center' argument but it doesn't update/override the point location of the Survey.
Is there something I'm missing?
I’ve been struggling to pass on the lat/long of a Collector point to Survey123. I’ve had success with passing straightforward text fields, but I am confused about the exact syntax needed for geometry. After lengthy research and I’ve come across different approaches to this, including using parameters like field:, center, pulldata(), and the use of attribute expressions in popup configurations. I'm not a super savvy coder - there's something I'm missing in how it should be coded, or in the setup of the attribute expression from https://community.esri.com/groups/survey123/blog/2016/07/30/understanding-survey123s-custom-url-scheme.
What I’m looking to do: Take the coordinates from a point in Collector, and pass it to Survey123, where it will overwrite or insert the coordinates for the geopoint survey question.
Here's are some examples of the many combinations I've tried:
arcgis-survey123://?itemID=babe31bcd39b4e6e97642b27d52efcd9&field:PlotNumber={Plot_Number}&field: GeoPtLoc={expression/expr0},{expression/expr1}
or ...center=({expression/expr0},{expression/expr1})
Hi Allyson,
For passing from a Collector URL, the center attribute is the appropriate method; this will set the location. Just use center={Lat},{Lon} where {Lat} and {Lon} correspond to the latitude (Y in DD) and longitude (X in DD).
Just checking, in your example above, you have {expression/expr0} - are you also using Arcade expressions? That is not supported in the current production version of Collector (I'm not sure if it's in Aurora yet). Also, there's a limitation in that the shape functions in Arcade produce values in the coordinate system of the map - the map *must* be in WGS84 or another Geographic Coordinate System for Survey213 to receive the values correctly.
Thanks for the fast response, James!
I was attempting the attribute expression from https://community.esri.com/groups/survey123/blog/2016/07/30/understanding-survey123s-custom-url-scheme (see below), to try and get lat/long from new points placed on the map in Collector, rather than pulling them from a prepopulated feature class. Is this only applicable to web maps, and not the app?
If you want to pass lat/lon values from the geometry in a feature, you can add an Attribute Expression to your popup do dynamically get the lat/lon values from the geometry of your feature. 1) Open the 'Configure pop-up dialog of your feature layer's and then select 'Configure Attributes'. 2) Add a new Attribute Expression. 3) Look for Geometry under the Globals tab and fetch Geometry($feature).x 4) Use the Edit link at the top to give your expression a friendly name 5) Repeat steps 2 through 4 to create a second expression for the y coordinate.
Yes, the instructions you're quoting apply to the web map that Collector uses - this configuration needs to be done in the Map Viewer in ArcGIS Online/ArcGIS Enterprise.
@DougBrowning @JamesTedrick
All:
I have been experiencing the same issues described in this thread: trying to create an attribute expression that calculates lat/long coordinates from a hosted feature layer, then integrate Field Maps with Survey123 to open a form and have the geopoint plot the submitted survey on top of the feature using the result of the attribute expression using a custom URL via the custom URL popup (¢er=).
I have been using the below formula, which is called out in a multitude of other posts on the community page and it was correctly calculating the coordinates in ArcGIS Online Web Viewer Classic, but then when we tested this functionality in the field, the point was not mapping:
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (Geometry($feature).x / originShift) * 180.0;var lat = (Geometry($feature).y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);return [lat, lon];
I found that this formula results in an Array data type, with associated brackets. These brackets do not show up in ArcGIS Online, but when you view the popup in Field Maps, you can see the brackets. So because of this, i tested further and in the original function, i removed the brackets in the return line, which worked but was not perfect. It was not perfect because the coordinate results ended up being truncated to 2 decimals, and even though the submitted form was executing, the point was being plotted hundred of feet away.
After 10 hours of testing and researching these threads (which by the way, all of the contributions are EXPONENTIALLY HELPFUL AND I AM SO GRATEFUL OF YOUR KNOWLEDGE) i was able to find the CORRECT SOLUTION:
1.) Create an attribute expression for latitude:
var lat;var originShift = 2.0 * PI * 6378137.0 / 2.0;
lat = number(Geometry($feature).y / originShift) * 180.0;lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);return lat;
2.) Create an attribute expression for longitude:
var lon;var originShift = 2.0 * PI * 6378137.0 / 2.0;
lon = number(Geometry($feature).x / originShift) * 180.0;return lon;
3.) Because of the "number" identifier, In ArcGIS Online Web Map Viewer Classic go to Configure Popups, make sure your pop up display is custom, then the important step is to click Configure Attributes. Navigate to the newly created expressions and expand the decimal places to a minimum of 5.
4.) Lastly, in the custom URL make the "¢er={expression/expr3},{expression/expr4} where expr 3 is Lat and expr 4 is Long.
I have been testing since i discovered this and it has been running smoothly. Happy Mapping!
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.