MeasureGenerator + MeasureExtractor for multipart lines
I have an aggregated line, containing three parts. Every 50 meters I need to have a point/vertex/measure and using the MeasureGenerator in conjunction with the MeasureExtractor works in principle fine.
The MeasureGenerator will only work if I ‘Deaggregate’ the parts and then every part gets a list of measures, starting from zero (as defined in the MeasureGenerator). My challenge is, that the next part of the line should actually not start from zero, but should set the first measure with regards to the remainder from the part before, where there might be the last measure at e.g. 250 m, but there is a remaining piece of 2.2 m.
These 2.2 m should basically subtracted from the start value when creating measures for the next part.
Is there a way to achieve that?
Page 1 / 1
Hi @tb09114 ,
For what you want, having every 50meters a point and the distance from a starting point for each point. I think you can do this without using MeasureGenerator/Extractor.
To create a point every 50 meters you can use labeller, then coordinateExtractor and VertexReplacer (certainly there is a better way to do this just with the labeller).
Then you can input your line and your points in an intersector (to get all points you need from the Node port), without this step you will have just points every 50meters and if it rests 1 m it will miss it.
Finally the neighborFinder will give you the distance of each point from one starting point in the the attribute _distance. You just have to know which point is the starting point.
Hoping this will help you !
Deaggregator → Densifier (to get 50 metre spaced vertices) → LineCombiner with “Preserve Lines as Path Segments” set to “Yes”. This gets the parts all combined into a Path.
->MeasureGenerator to then get the M distance along each Path. PathSplitter will then return the Paths back to their component segment lines.
I went a slightly different way. Not sure if all steps are necessary.
Since there are not to many line features did I use an AttributeCreator to number the lines in the order the chainage should be established. → Sorter → Densifier (setting the frequency to 50 meters does not create always at precisely 50 meters. So, I went a bit overboard and went with 10 centimeters!) → LengthCalculator → StatisticsCalculator (calculate the sum of the length) → AttributeManager (enabled adjacent feature attributes to add the length of the current feature to the length of the prior feature. I called this attribute ‘start’) → MeasureGenerator (set Start value to attribute value ‘start’) → MeasureExtractor → PointVertexReplacer → AttributeManager (using fmod against a value of 50 and a test if the attribute value from the measure is either grater than 49.8 or less than 0.1)
Here I also had to deal with the issue that these vertices created by the Densifier do not hit precisely the 50 meters. I use a conditional value in the AttributeManager where I check if either the measure value of the current feature, the prior feature, or the subsequent feature is closer to 50, or a multitude of it. The value returned by the conditional value is the vertex id with the smallest distance to 50 (or a multitude of it). Based on this vertex id I continue to work.