Skip to main content

I am having Line and Point shapefile. I simply want to calculate the percentage at which the Point lies on the Line where starting point of the line being, the start of the digitization.

I tried MeasureExtractor, PolylineAnalyser, PercentOverlap but couldn't conclude my answer. Can someone help me with that. Thanks in advance.

Devan

Hi Devan,

If you are using FME 2015.1+, you can use the PointOnLineOverlayer to add measure to points. The measure value will be computed based on measure of the line related to the point.

  1. For the line features, add measure with the MeasureGenerator and calculate entire length with the LengthCalculator.
  2. Then, send the points and lines to the PointOnLineOvelayer. Here, the entire line length (attribute) will be merged to points, and measure will be added to the points.
  3. Use the MeasureExtractor to extract measure value for each output point.
  4. Finally, calculate percentage based on the measure value and the entire line length.

Takashi


Hi Takashi. I am working on 15515. I have tried MeasureGenerator-LengthCalculator-PoLO-MeasureExtractor.

Everything seems correct till length calculator.

PoLO- Point Tolerence: 0.1

All the PoLO outputs are showing 78 or 118 in _overlaps. Can you explain a bit please.


Hi Takashi. I am working on 15515. I have tried MeasureGenerator-LengthCalculator-PoLO-MeasureExtractor.

Everything seems correct till length calculator.

PoLO- Point Tolerence: 0.1

All the PoLO outputs are showing 78 or 118 in _overlaps. Can you explain a bit please.

"_overlaps" of the output lines from the PointOnLineOverlayer indicates the number of overlapping points on the original line. If 78 points overlap an input line, for example, "_overlaps" of every output line created by splitting the input line will store 78. I guess you have observed this situation.


"_overlaps" of the output lines from the PointOnLineOverlayer indicates the number of overlapping points on the original line. If 78 points overlap an input line, for example, "_overlaps" of every output line created by splitting the input line will store 78. I guess you have observed this situation.

Yes, I have noticed that. But I cannot understand why!! Either ways I cannot calculate the PoLO I suppose. Is there any other way to get the correct o/p for PoLO. Or its correct and MeasureExtractor is incorrect.


Hi Takashi. I am working on 15515. I have tried MeasureGenerator-LengthCalculator-PoLO-MeasureExtractor.

Everything seems correct till length calculator.

PoLO- Point Tolerence: 0.1

All the PoLO outputs are showing 78 or 118 in _overlaps. Can you explain a bit please.

If I have understood your first question correctly, it would not be necessary to use the output lines from the PointOnLineOverlayer.

Try extracting measure value of the output point with the MeasureExtractor. The value must be the distance measured along related line from the start node of the line to the point itself. I think you can calculate desired percentage (P) based on the measure value (M) and the length (L) of the original line.

P = M / L * 100

Isn't it your required "percentage"?

(edited)


I'm posting this as a separate answer, but really it's using the method Takashi suggests.

Attached is a workspace that demonstrates the method: findingmeasuresatpoint.fmw

For me it is easy to use the MeasureGenerator-PointOnLineOverlayer-MeasureExtractor - but the PoLo transformer has split your line into two parts. That's why I fetch the first measure too, and test if it is zero (if it is not, then this is not the part that is the start of the line)

As Takashi says, if you want percentage value you'll need an extra calculation - and use the LengthCalulator to measure the line right at the very start.

Hope this helps.


Thanks both. I think the major problem where i am lagging is PoLO's Point Tolerance. When I apply 0.1, the lines don't split at points. When I apply 0.5 ( as mentioned in Mark's sample wb, the splits are too many in numbers, thus creating incorrect intersections. I also tried doing with published parameters where Point shp was the parameter, but didn't work out (since it should be a real number, i guess). pfa-

percentcalculation.zip


If it was difficult to find the optimal tolerance for the PointOnLineOverlayer because of the variability of the point coordinates, the LengthToPointCalculator could be a second choice. See the attached workspace example: length-to-point-calculator-example.fmw


If it was difficult to find the optimal tolerance for the PointOnLineOverlayer because of the variability of the point coordinates, the LengthToPointCalculator could be a second choice. See the attached workspace example: length-to-point-calculator-example.fmw

It's a more concise data flow. length-to-point-calculator-example-2.fmw


Thanks both. I think the major problem where i am lagging is PoLO's Point Tolerance. When I apply 0.1, the lines don't split at points. When I apply 0.5 ( as mentioned in Mark's sample wb, the splits are too many in numbers, thus creating incorrect intersections. I also tried doing with published parameters where Point shp was the parameter, but didn't work out (since it should be a real number, i guess). pfa-

percentcalculation.zip

I updated your workspace. See the attached file: perectcalculation-2.fmwt

Every point was very close to the lines, so you can set a very small value to the tolerance parameter (e.g. 1e-8). Since your original setting was too large, each point has been related to all the line.

Why not use the output points from the PointOnLineOverlayer? It was easy to calculate the percentage for each point.


Reply