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.
any idea 🙂
I think you want to use the "paths" property of the $feature's geometry
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.
This code uses "paths" to return the first point of the first polyline part:
This code uses "paths" to return the first point of the second polyline part:
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.