1

How to convert an Esri Line-Shape to an Esri Point-Shape using FME Desktop?

The distance between the resulting points should be 1 meter.

Which transformer(s) would be best?

Edit

The distance between the points is not everywhere exactly 1 meter.

4

Several ways possible. One way is:

  • Read the shape (FeatureReader).
  • Densify the line, distance 1 meter. (Densifier, exact interval, 1 meter.) This needs to be done to introduce the points where the line need to be split.
  • Chop the line in segments of 1 meter. (Chopper, by length, 1 meter.) This need to be done because you don't need the other points.
  • Chop the segments in points. (Chopper by vertex, 1 maximum vertices.)
  • Remove the duplicate points where startpoint of one segment is endpoint of second segment. (Matcher, single matched and not matched.) You just went from 1 meter lines to points, where the first parts endpoint is the second parts startpoint.

enter image description here

  • Thank you for your help. But the distance between some points is not exactly 1m. Especially after a vertex and after the first and before the last point of the line. – joe_gerner Sep 11 '18 at 10:03
  • Not sure if I understand correctly: You mean the last linepart is shorter than 1 meter? If so, what do you want to do with the last point? – nielsgerrits Sep 11 '18 at 10:07
  • 1
    No, I mean that after the conversion to points the distance between to most points is exactly 1m. But not between every point. The distance between the startpoint and the secondpoint is only 0,5m. And if the line has a bend, then is the distance between the point in the bend and the following point not exactly 1m. – joe_gerner Sep 11 '18 at 10:37
  • I guess the 0.5 m intervals are caused by different lines? Connect the lines first to one complete line to solve that. The problem with the bends might be harder to solve. I think that you need to densify more and find a algorithm in the Generalizer transformer but not sure which one. – nielsgerrits Sep 11 '18 at 10:54
  • 1
    The IterativeSnipper in the FMEHub could be an alternative here, with a CoordinateExtractor and VertexCreator to extract the points. – FSimardGIS Sep 11 '18 at 12:30
2

There really is no good way to do this, or at least no simple way. But the first thing you have to recognize (you probably already know) is that your existing vertices will need to be moved to give exact 1m spacing, and therefore the shape of the resulting line won't be exactly the same as the original.

Anyway, the IterativeSnipper is the closest, but it will give you X metre lines, which may have extra vertices. Remove the extra vertices and you won't have a 1m line any more.

The Densify/Chopper method is pretty much giving you the same result. It can't produce exactly what you need because what you need is the original vertices moved/removed.

So I don't see any way to get the exact result you want, without an iterative solution. I can come up with an algorithm of sorts, but I don't have enough time to try and implement this (because it's going to be quite complex).

Anyway say, for example, you have a line with 4 sections (call them sections 1-4) and 5 vertices (call them vertices 1-5).

Use a Chopper to chop that original line into those four 2-vertex sections.

Here's where the iteration starts. Say I create a count, starting with X = 1

Take section X and use one of the above methods to create 1m vertices. The final part is very unlikely to be 1m exactly. Measure it to find how long it is. If it's <0.5m then use a VertexRemover to drop that final point. If it's >0.5m then use the VertexRemover again to drop the point, but then extend the line by 1m (basically finding the closest coordinate to end with a 1m spacing).

That gives a new position for vertex X+1.

Take section X+1 and move its start vertex (the old vertex X+1 position) to the new vertex X+1 position (a Snapper could do this). So in the first iteration you now take section 2, and snap its start point to the new end point of section 1.

Increment X and go back to the start of the iteration.

In other words you're taking each section of line in turn, calculating a new end vertex that gives you exactly 1m parts, and snapping the next section to it. Then you start densifying that next section in the same way, creating a new end point and snapping the start of the next line to that new end point.

To do that in FME will require a custom transformer in order to use a loop. It will probably need a linked transformer (not embedded) because there's likely to be a blocker transformer in there, and you can't have an embedded custom transformer with a blocker in it.

I hope this helps, even if it's not a full solution (just the algorithm). For that reason I would have just added this as a comment but there were too many characters for it! It will be quite complex to implement, but I don't see another way to give the exact solution you want. I would love to be corrected though.

  • 1
    This is a brilliant idea, that would be great to see in action! I thought about it too, and I wonder if the Bufferer could be useful in the process? How about creating a 1m buffer around the point, then extract the part of the line that intersects that buffer, and use its endpoint, and so on iteratively? – FSimardGIS Sep 12 '18 at 1:28
  • That's a good idea to use the bufferer. Put a 1m buffer around the last-but-one point, then snap the next section of line to the buffer. Adds a level of complexity, but it also minimizes the amount that the points get moved. A less disruptive solution. I like. – Mark Ireland Sep 12 '18 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.