arcade : getting the upstream lentgh of a multipart polyline dynamically

312
1
03-17-2022 09:15 AM
Labels (1)
DISIG
by
New Contributor III

hello,

i am trying to calculate dynamically in the popup profile the upstream's length of a multipart line.

this script work well with single part lines only.

in this script i cut the line where the buffer of a point intersects the polyline (a road)

var CurDep = $feature.road
var CurArcGeom = First(Filter(FeatureSetByName($datastore,"test_li"),'ROAD=@CurDep'))
var cutter = Rotate(Clip(CurArcGeom,Extent(Buffer($feature,0.1, 'meters'))),90)
var DYN_CUMUL = round(Length(First(Cut(CurArcGeom,cutter))))
dyn_cumul

In the picture above you can see the results (labels) on two polylines. the first result goes wrong because of the multipart.

DISIG_0-1647533329579.png

any idea 🙂

 

 

0 Kudos
1 Reply
KimGarbade
Occasional Contributor III

I think you want to use the "paths" property of the $feature's geometry

KimGarbade_1-1647548954980.png

If you look closely at the labeled line below you can see that it shows the coordinates of a "multipart" polyline.  See how there are two opening and closing brackets every so often.  These "[[" and "]]" brackets contain the coordinates of multiple parts of the same line.

KimGarbade_0-1647548237194.png

This code uses "paths" to return the first point of the first polyline part:

KimGarbade_3-1647550109431.png

This code uses "paths" to return the first point of the second polyline part:

KimGarbade_2-1647549989513.png

Unless there is a way to do it I'm unaware of, I think you will have to construct what your looks for from this structure.