Select to view content in your preferred language

Point along a line based on a sum of another features field

365
2
Jump to solution
07-10-2023 04:30 AM
Labels (2)
GHarris
New Contributor II

Good Morning all,

 

I am working on a task that requires a point along a line based on the total of a survey. This point needs to be dynamic, and as more survey requests have been completed I want the point to move along the line based on the total. 

 

So far I have the survey that works and populates a table. 
I have then created my Line feature (the route) for visualisation purposes. 

I have then created points along the lines at intervals. 
I now want to use the Survey Table and use one of the fields questions 'Distance covered' and caculcate the sum. I then want to display the point along the route that is nearest to that sum. And this to be dynamic. 

 

 

Essentially, I want people to submit how far they have travelled and this to be cumulative as a group and added to a map that places a point along the line based on the sum of distance travelled. I have tried a variety of expressions but a little puzzled on how I can solve this just using AGOL and make it automatic. 

Many Thanks


0 Kudos
1 Solution

Accepted Solutions
MobiusSnake
MVP

This sounds like a job for the ArcGIS API for Python and/or ArcPy, either using webhooks or a scheduled AGOL notebook.  I used a notebook similar to this a couple years back for a little personal project that sounds vaguely similar.

I had a polyline feature layer that represented a route I was visualizing, a point feature layer with a single point showing progress, and a table showing daily distance entries.  Each day there'd be one submission to the table, at which point the sum of all distances would be used to move the single point feature along the polyline.  I used a scheduled notebook that ran each night, used the ArcGIS API for Python to query the distance entries and the polyline geometry, used the ArcPy method Polyline.distanceAlongLine() to calculate the point's new location, then used the ArcGIS API for Python to update the point to that new location.

View solution in original post

0 Kudos
2 Replies
MobiusSnake
MVP

This sounds like a job for the ArcGIS API for Python and/or ArcPy, either using webhooks or a scheduled AGOL notebook.  I used a notebook similar to this a couple years back for a little personal project that sounds vaguely similar.

I had a polyline feature layer that represented a route I was visualizing, a point feature layer with a single point showing progress, and a table showing daily distance entries.  Each day there'd be one submission to the table, at which point the sum of all distances would be used to move the single point feature along the polyline.  I used a scheduled notebook that ran each night, used the ArcGIS API for Python to query the distance entries and the polyline geometry, used the ArcPy method Polyline.distanceAlongLine() to calculate the point's new location, then used the ArcGIS API for Python to update the point to that new location.

0 Kudos
GHarris
New Contributor II

Thank you for this.

I have used a Notebook within AGOL to create a script that gives the line Geometry, finds the coordinates for the distance along the line that is the sum of the users inputs. 

I have then placed this within a Webhook on the survey for everytime someoe submits. Although I am getting a 'failed to fetch' error, the code itself works, so thank you!  

0 Kudos