How to automate coordinate calculation? or a better way to pass coordinates to survey123?

04-15-2022 07:21 AM
Labels (2)
New Contributor III


I am looking for some direction...I have a hosted feature layer for catch basins, which are point features. I am using url parameters ({Lat},{Long}) to give inspection records the same coordinates as the basin being inspected. My issue is occasionally a basin is found to be incorrectly located and is moved, or is completely missing from the map and a new feature is created. If they perform an inspection on the moved, or new feature, the coordinates for the survey are either incorrect or blank coordinates are passed. I figure I could  run a script daily that recalculates the fields in the feature layer but this wouldn't fully solve the problem unless they wait until the following day to inspect modified/new features (not practical). Since designing this system I have learned a lot more about AGOL and intend to redesign our CB cleaning and inspection program in the next year to utilize related tables, but for now we are continuing with this system...

Is it possible for a new or modified feature to somehow automatically populate the lat/long columns? We are using the map in field maps, which I know recently added calculated expressions, though I am unsure how/if I could calculate lat and long. Is there a better way to pass location to a survey?

Any ideas as to how I could best approach this problem are appreciated.



2 Replies
New Contributor III

Hey Brandon

I'm not sure if it is allowed to reply with topics that do not answer, but I am having the same issue. Url center is now unreliable. Sometimes it works, and sometimes it does not. It is kind of frustrating because it's not a reliable error, I decided to troubleshoot it and suddenly everything works even if I have not changed anything. 

I read so much documentation regarding geopoints on Survey123, but no success so far. Instead of using the center function on URL, you can try to make a calculation on the geopoint row and calculation column of your excel file, which grabs the points X and Y, if you are adding the X and Y fields to the new feature.

concat(substr(${Point_Y}, 0, 10), " ",substr(${Point_X}, 0,10))

No success on my side, but you might give a try. 



New Contributor III

For my scenario, I just instructed field workers to not perform inspections on features that are moved or created, until the following day. I am planning on writing a script today to run at the end of each workday to recalculate the x and y values daily and then will continue using the center parameter for the inspection survey. Unless I find an easy fix we will operate like this until I implement a related table system. 

0 Kudos