Select to view content in your preferred language

Find nearest point on a line (and M value)

1266
2
Jump to solution
11-08-2023 01:13 PM
ChaimSchwartzIroads
Regular Contributor

I have a point feature class (BUS_STATIONS), and an M-enabled line feature class (ROADS)

We are trying to build an attribute rule on the BUS_STATIONS feature class, that would populate a field with the M-value of the nearest point of the road. NOTE: I don't want the M-value of the nearest vertex (which could be far away) but rather the nearest portion of the line. What I was thinking to do was the following:

1. Find the coordinates of that nearest point (not vertex) on the line

2. Then find the M-values of the vertex before and after that point and calculate the M value. 

But right now I'm stuck with step #1. Any ideas how to achieve that?

Thank you

Chaim

 

 

a point feature class, that will populate the M value of the nearest li

0 Kudos
1 Solution

Accepted Solutions
ChaimSchwartzIroads
Regular Contributor

We eventually got it to work, thanks to our amazing developers Eduard and Sara. The logic we use is basically:

1. Calculate the distance between the BUS_STATION point and all the vertices in the adjacent ROAD. 

2. For all segments between vertices, calculate the nearest distance from the BUS_STATION to that segment (length of line perpendicular to that segment). 

3. Choose the shortest of all outcomes and retrieve the M-value of that point. 

View solution in original post

0 Kudos
2 Replies
MikeMillerGIS
Esri Frequent Contributor

Since you want the calculated M for that location, I am guessing that https://developers.arcgis.com/arcade/function-reference/geometry_functions/#nearestcoordinate will not work?

All the logic you need to get the nearest points and the two bounding vertex to calculate the M is in this rule:

https://github.com/Esri/arcade-expressions/blob/master/attribute_rule_calculation/SplitIntersectingL...

 

ChaimSchwartzIroads
Regular Contributor

We eventually got it to work, thanks to our amazing developers Eduard and Sara. The logic we use is basically:

1. Calculate the distance between the BUS_STATION point and all the vertices in the adjacent ROAD. 

2. For all segments between vertices, calculate the nearest distance from the BUS_STATION to that segment (length of line perpendicular to that segment). 

3. Choose the shortest of all outcomes and retrieve the M-value of that point. 

0 Kudos