|
POST
|
I'm having the same problem. Can call Survey123, pass attributes and centroid Lat/Long for geopoint creation, but upon returning to Field Maps, it just shows the popup. No edit pane or fields updated. Trying to update a field with the date and time that the survey happened via Now() in my Arcade URL generation .
... View more
05-13-2024
12:51 AM
|
0
|
0
|
3658
|
|
POST
|
Ok - thats interesting. I haven't seen any evidence of the curly brackets in my URL's when running my validation in the Arcade editors and copying the URL's in the browser.....BUT!......I've just reimplemented the original MID code and testing in Field Maps and it works! Turns out the app returns {a1b2c3-d4e5...} whereas in my web browser I was only seeing a1b2c3-d4e5... which when combined with the MID code would drop the first character (leaving me with 1b2c3-d4e5...). Lesson learnt - trust the code authors! At least I hope others can learn from my trials and tribulations documented here!
... View more
05-13-2024
12:45 AM
|
0
|
0
|
3425
|
|
POST
|
Post edited after I sorted out most of my own issues by undoing other supposed "fixes" (see comments above about the MID function and globalID's). I have managed to get my code working almost perfectly now. The only spot that I was getting stuck at and for which I've implemented a workaround, is passing back a date value to Field Maps instead of a text value to update the selected features attribute as done (instead of saying "Complete", it states when it was completed). Breif explanation of my code below, as I've extended it to use multiple fields from the source feature. The source (launching) feature in Field Maps has multiple fields which are checked to see at what "stage" an inspection process is up to (happens at various stages over 2 years). These are checked to find the first empty value and that is used to populate the type of inspection being done. This value is also used to then determine which date (now text) field should be edited upon callback to show that the corresponding inspection has been completed. The selected features centroid coordinates are also returned and converted into Lat/Long and passed as a parameter to Survey123 for the geopoint location. I couldn't for the life of me though figure out how to get the updateFeature section (Line 80) to work with a date value/field in Field Maps. I've change the fields to text and have now passed a string formatted as "my_username @ 2024-05-14 09:59 17.510" (Lines 45-47): Below is the full code I have implemented. // Calculate inspection number
var Inspection = IIF(IsEmpty($feature.insp_2_weeks)==True,"2 weeks",
IIF(IsEmpty($feature.insp_4_weeks)==True,"4 weeks",
IIF(IsEmpty($feature.insp_6_weeks)==True,"6 weeks",
IIF(IsEmpty($feature.insp_8_weeks)==True,"8 weeks",
IIF(IsEmpty($feature.insp_10_weeks)==True,"10 weeks",
IIF(IsEmpty($feature.insp_12_weeks)==True,"12 weeks",
IIF(IsEmpty($feature.insp_4_months)==True,"4 months",
IIF(IsEmpty($feature.insp_5_months)==True,"5 months",
IIF(IsEmpty($feature.insp_6_months)==True,"6 months",
IIF(IsEmpty($feature.insp_9_months)==True,"9 months",
IIF(IsEmpty($feature.insp_12_months)==True,"12 months",
IIF(IsEmpty($feature.insp_15_months)==True,"15 months",
IIF(IsEmpty($feature.insp_18_months)==True,"18 months",
IIF(IsEmpty($feature.insp_21_months)==True,"21 months","24 months"))))))))))))))
// Get matching inspection number field name
var InspFieldName = IIF(Inspection=="2 weeks","insp_2_weeks",
IIF(Inspection=="4 weeks","insp_4_weeks",
IIF(Inspection=="6 weeks","insp_6_weeks",
IIF(Inspection=="8 weeks","insp_8_weeks",
IIF(Inspection=="10 weeks","insp_10_weeks",
IIF(Inspection=="12 weeks","insp_12_weeks",
IIF(Inspection=="4 months","insp_4_months",
IIF(Inspection=="5 months","insp_5_months",
IIF(Inspection=="6 months","insp_6_months",
IIF(Inspection=="9 months","insp_9_months",
IIF(Inspection=="12 months","insp_12_months",
IIF(Inspection=="15 months","insp_15_months",
IIF(Inspection=="18 months","insp_18_months",
IIF(Inspection=="21 months","insp_21_months","insp_24_months"))))))))))))))
// Get centroid Lat and Long
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (Centroid($feature).X / originShift) * 180.0;
var lat = (Centroid($feature).Y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp(lat * PI / 180.0)) - PI / 2.0);
// Generate callback attribute
var user = GetUser($layer).username
var date = left(Date(),10)
var cbvalue = user + " on " + date
// Source: https://community.esri.com/t5/arcgis-survey123-questions/help-with-survey123-link-from-field-maps-with/td-p/1306591
// To launch survey123 from map
// EDIT THIS LINK TO MATCH YOUR SURVEY LINK (Only edit AFTER itemID= and BEFORE &
var urlsource ="arcgis-survey123://?itemID=b40c1e4d99084cbca8170ff273c74977&"
//Format globalid to "link" survey point to map data -- MUST have globalid field for this script to work. DO NOT EDIT THIS LINE
var fglobalid = Mid($feature.GlobalID, 1,36)
//Generate other url parameters to pass to survey123. -- These are the values you wish to transfer from Field Maps to your Survey123 form.
// Edit or delete fields as necessary. The line containing $feature.GlobalID MUST NOT BE REMOVED, but the field to the left of $feature.GlobalID may
// be changed to reflect the field in your Survey to store the GlobalID.
var params = {
"field:plantation": $feature.Plantation,
"field:years_planted": $feature.PlantingYear,
"field:tree_species": $feature.Species,
"field:tenure": $feature.RENDER_LABEL,
"field:inspection_number": Inspection,
};
// Get map center coordinates
var center = concatenate([lat,lon],",")
// Create callback portion of link using itemID (map ID) and featureSourceURL (services link to the layer containing the feature to be edited following survey submission)
// EDIT THIS LINK FOR MAP AND FEATURE SERVICE. updateFeature&itemID=<your maps ID>&featureSourceURL=<link to the feature class to be edited>
var callback = {
callback:"https://fieldmaps.arcgis.app/?referenceContext=updateFeature&itemID=##############&featureSourceURL=https://services3.arcgis.com/############/arcgis/rest/services/#################/FeatureServer/0",
//var callback = {callback:"https://fieldmaps.arcgis.app",
}
// // Add featureID (must be var fglobalid) portion of callback link
// THIS LINE MUST NOT BE CHANGED. This line is what tells the script which point in the feature class will be edited
var callbackid = "featureID=" + fglobalid
var callbackattribute = 'featureAttributes={"' + InspFieldName + '":"' + cbvalue + '"}'
// Return the entire link/URL. This is what the FieldMaps app is following when you click the link to enter survey data. This should not be changed unless there is no callback
// attribute to pass back to Field Maps
/// return urlsource + UrlEncode(params) + "&" + UrlEncode(callback) + "%26" + UrlEncode(callbackid) + "%26" + UrlEncode(callbackattribute)
return urlsource + UrlEncode(params) + "¢er=" + UrlEncode(center) + "&" + UrlEncode(callback) + "%26" + UrlEncode(callbackid) + "%26" + UrlEncode(callbackattribute)
// For use in the pop-up for your featureclass, simply enter the expression name in the link field (i.e. {expression/expr0})
... View more
05-12-2024
09:47 PM
|
0
|
0
|
717
|
|
POST
|
I've just been working to implement this code in my URL using the full callback and feature update (edit) capabilities (previously was just calling the app and stopping there). I think I found a bug in the fglobalid variable assignment (Line 8). You're using: var fglobalid = Mid($feature.GlobalID, 1,36) but this seems to be trimming off the first character of the GlobalID value (index should start at 0 instead of 1?). I tidied it up though to simply be: var fglobalid = $feature.GlobalID Curious to know why you didn't do this in the first case. Cheers!
... View more
05-12-2024
08:02 PM
|
0
|
2
|
3460
|
|
POST
|
Modified to sort values (Line 10), exclude 0 values (Line 7) and return just the output value (Line 18). var poly1 = FeatureSetByName($map, "FPC Plantations")
var intersects = Intersects(Geometry($feature), poly1)
var distinct_planting = []
var display_output = ""
for(var f in intersects) {
iif(f['EstabYear']==0,"",Push(distinct_planting, f['EstabYear']))
}
distinct_planting = Distinct(Sort(distinct_planting))
for (var pyear in distinct_planting) {
display_output = display_output + distinct_planting[pyear] + ' '
}
display_output = Trim(display_output)
return(display_output) And further modified to separate with commas and spaces ', ' (Line 13) plus removing the last comma and space (Line 16) which negates the need for the Trim function which only removed the original trailing space. var poly1 = FeatureSetByName($map, "FPC Plantations")
var intersects = Intersects(Geometry($feature), poly1)
var distinct_planting = []
var display_output = ""
for(var f in intersects) {
iif(f['EstabYear']==0,"",Push(distinct_planting, f['EstabYear']))
}
distinct_planting = Distinct(Sort(distinct_planting))
for (var pyear in distinct_planting) {
display_output = display_output + distinct_planting[pyear] + ', '
}
return(Left(display_output, Count(display_output)-2))
... View more
05-07-2024
05:40 PM
|
1
|
0
|
2894
|
|
POST
|
Awesome starting point. Changed my layer and field names and tested it out with the below results. Just need to work on it a bit to filter out the "0" values (where no Year value exists) and sort from oldest to most recent (as well as the formatting to just return a value instead of the table and "text" values).
... View more
05-07-2024
05:34 PM
|
0
|
1
|
2894
|
|
POST
|
We're experimenting with Field Maps and Survey123 and I was hoping to build a URL which would be listed in a features popup in Field Maps. Once selected, it would pass over some basic attribution as well as the geometry of the selected feature to create the surveys geoshape data. All the reference material I've read so far talks about linking to an existing feature (not what I want to do). The URL would be in a popup of another layer, so essentially the survey inherits the geometry from the other layer, but they are distinctly separate entities. Is this possible?
... View more
05-06-2024
10:53 PM
|
0
|
1
|
1156
|
|
POST
|
Came back from a camping weekend hoping to see something here, but alas there isn't! Can someone at least confirm if I'm correct in assuming that Field Maps can display and interrogate a linear referenced dataset (with the Find Measure tool) but can't create LRS data in associated tables?
... View more
05-05-2024
09:26 PM
|
0
|
0
|
1694
|
|
IDEA
|
@ShaunGibbins yep - I've gone back and reviewed the Arcade functions and I don't believe you can access the GPS location - only feature locations. Until something like your idea is implemented, a related feature class instead of straight table with the IsEmpty condition on the field calculation from @DougBrowning would be the best bet.
... View more
05-05-2024
06:19 PM
|
0
|
0
|
3417
|
|
POST
|
I've been reading and experimenting with Linear Referencing in ArcGIS Pro. I have managed to create a Route layer as well as point and line Route Event Layers. Now I want to publish these to ArcGIS Online for use in Field Maps (to view and for data collection). To me, it sounds like this should be possible (see here: Collect measurement data in the field (esri.com)) , but I'm finding it hard to find literature, and not succeeding in publishing the Event Layers. I suceeded in publishing the event table, but once in ArcGIS Online, can't figure out how to link the 2 to display the Route Events in the Map Viewer. Can anyone provide any useful information on the specifics of creating Linear Referenced datasets in ArcGIS Online for use in Field Maps?
... View more
05-01-2024
11:49 PM
|
0
|
2
|
1802
|
|
POST
|
I'm anticipating a problem I'm going to need to solve next week and don't believe my knowledge is up to it. Sooooo, I'm hoping the brains trust can help me out! I will have 2 polygon layers in Field Maps. One contains features (plantation areas) and another will have a new feature added to it which intersects with multiple plantation areas. What I want to achieve is an arcade script that runs an intersect between the 2 layers (which I know how to do) but then takes the planting year of all the intersect plantation areas (e.g. 1992, 1992, 1992, 1995, 1996, 1996, ...) and return a concatenated string of the Distinct values (e.g. 1992, 1995, 1996, ...). This string will then get passed to Survey123 to auto populate a field in the survey. Is this possible?
... View more
05-01-2024
10:32 PM
|
0
|
3
|
2996
|
|
IDEA
|
Could you not create Lat & Long fields and use Arcade to calculate the values? (fields would not be manually editable)
... View more
05-01-2024
06:37 PM
|
0
|
0
|
3508
|
|
POST
|
Awesome. Thanks for the extra info. This will help when explaining to management how it all works.
... View more
04-30-2024
05:19 PM
|
0
|
0
|
4713
|
|
POST
|
Yep, I feel more coordination will be needed in the future. I've just done a test run creating an offline capable webmap, uploaded a new vtpk and referenced that in the advanced offline settings. I then downloaded the vtpk with the 1st offline area and made some edits. I've then uploaded a 2nd vtpk and done the Replace layer function on the hosted tile layer and deleted the old vtpk and the archived tile layer. The existing offline area continued to function before and after updating the advanced offline settings to reference the new vtpk and with a second offline area downloaded using the new vtpk (once it had downloaded). I assume this means that the original vtpk is kept on the mobile device even after being replaced in the webmap? And would it continue to stay on the device after any offline areas referencing it have been removed? If this is the case, I can see it chewing up your devices storage over time with basemaps accumulating.
... View more
04-29-2024
08:00 PM
|
0
|
0
|
4731
|
|
IDEA
|
@cbp-geus yep - all very good points. To make it work offline you would need to create 2 different hosted views of the layer, not just duplicate the layer in the map. Scale intervals can certainly be beneficial to reduce that clutter as you zoom out.
... View more
04-29-2024
07:56 PM
|
0
|
0
|
4056
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 2 weeks ago | |
| 2 | 2 weeks ago | |
| 4 | 2 weeks ago | |
| 1 | 2 weeks ago | |
| 2 | 3 weeks ago |
| Online Status |
Online
|
| Date Last Visited |
54 seconds ago
|