Question

FME not correctly extracting start and end of line segments


Badge

Hi there. I'm looking to add grid locations (GRID_ID) from a polygon feature class to a line feature class dataset in fme, but it does not seem to recognize the start and end of these lines, thus leaving the GRID_ID's the same. There is a lot of transformers and things going on in this workspace, but the two bookmarks are essentially duplicates, just different grid polygon datasets used.


12 replies

Userlevel 2
Badge +17

only by the screenshot, it's not clear how you intend to process the features. Could you please elaborate about how the workspace works?

It would help us to find problems if you could share a simplified workspace and a minimal data sample which reproduces the issue.

Badge +12

I can't tell from your image what's working and what's not, but myself, I would probably try an approach where I extract the start and end nodes from the line features (either as attributes, or as points) and work from there.

 

 

The CoordinateExtractor (with index set to 0 and -1) will create attributes for the start and end nodes respectively, whereas the Snipper (with index 0 and -1) will extract the points. I don't know which will be easier for you to handle in your workspace (points or attributes), but hopefully it is a start to set you off in the right direction.

 

Badge +21

Difficult to see based on only a screenshot @reidm35. But can you simplify by usng the 2DGridAccumulator and then do a NeighbourFinder or SpatialRelator afterwards?

Badge

@sigtill @jonas_nelson @takashi

My apologies. I've attached two screenshots of the workspace more up-close, and the workspace is also attached. (Reid_111419.fmw)

Essentially I have a line feature class of a roads dataset and a polygon feature class of NTS grids. I want to extract the GRID_ID attribute from the polygons and add it to the roads dataset.

To start I have used a chopper to break the lines down by the vertex, and then clip them to the grids with a clipper. I then used an aggregator to combine them back together, and created a list attribute for the GRID_ID attribute. I exposed this attribute using 0 as the start of the line, and 1 as the end, and then renaming the list attributes as start and end appropriately. Everything after then second geometry replacer is simply just breaking the attribute down into the correct format I need in the output. The problem I think lies before the second geometry replacer.

Hopefully this helps. Please let me know if I can provide any additional information.

Badge

only by the screenshot, it's not clear how you intend to process the features. Could you please elaborate about how the workspace works?

It would help us to find problems if you could share a simplified workspace and a minimal data sample which reproduces the issue.

@takashi please see my reply below. My apologies for the confusion.

Badge

Difficult to see based on only a screenshot @reidm35. But can you simplify by usng the 2DGridAccumulator and then do a NeighbourFinder or SpatialRelator afterwards?

Hi @sigtill Please see my reply below. My apologies for the confusion. Could you elaborate on the process you mention here? Thank you.

Badge

I can't tell from your image what's working and what's not, but myself, I would probably try an approach where I extract the start and end nodes from the line features (either as attributes, or as points) and work from there.

 

 

The CoordinateExtractor (with index set to 0 and -1) will create attributes for the start and end nodes respectively, whereas the Snipper (with index 0 and -1) will extract the points. I don't know which will be easier for you to handle in your workspace (points or attributes), but hopefully it is a start to set you off in the right direction.

 

Hi @jonas_nelson please see the new reply I've posted. If I made new attributes for the start and end nodes with the coordinate extractor, could I add those to the line dataset afterwards somehow?

Badge +7

For users who are getting errors when trying to open @reidm35's workspace, please try this attachment.

 

reids-workspace.fmw

Userlevel 2
Badge +17

As far as I can see, your workspace would extract GRID_IDs spatially related to the start and end node of the source line, if the nodes are located on a grid polygons.

To narrow down the issue, I would recommend you to run the workspace with Enable Feature Caching and/or Stop at Breakpoints option and inspect the features flowing on the data flow.

See also here to learn more about feature inspection with the options.

Badge +12

Hi @jonas_nelson please see the new reply I've posted. If I made new attributes for the start and end nodes with the coordinate extractor, could I add those to the line dataset afterwards somehow?

Yes @reidm35, if you use the path with the CoordinateExtracors, your output will still be the polylines, only now each line object also have six new attributes; (_xstart, _ystart, _zstart, _xend, _yend, _zend).

 

 

If you use the path with the Snippers, they will result in point objects (for your start and end points). If you like to use these points to obtain information about which GRID_ID each point is located in, you could do that using a PointOnAreaOverlayer, or a SpatialRelator I think. Then you can use THAT point output to get that info back on the line objects, using a PointOnLineOverlayer.

 

 

Of course, there might be an easier way too, using a SpatialRelator or something, as @sigtill has already proposed,

 

 

If you could upload a small sample of the data, it would be easier to produce a functioning workspace.
Badge

As far as I can see, your workspace would extract GRID_IDs spatially related to the start and end node of the source line, if the nodes are located on a grid polygons.

To narrow down the issue, I would recommend you to run the workspace with Enable Feature Caching and/or Stop at Breakpoints option and inspect the features flowing on the data flow.

See also here to learn more about feature inspection with the options.

@takashi Alright, thank you!

Badge

Yes @reidm35, if you use the path with the CoordinateExtracors, your output will still be the polylines, only now each line object also have six new attributes; (_xstart, _ystart, _zstart, _xend, _yend, _zend).

 

 

If you use the path with the Snippers, they will result in point objects (for your start and end points). If you like to use these points to obtain information about which GRID_ID each point is located in, you could do that using a PointOnAreaOverlayer, or a SpatialRelator I think. Then you can use THAT point output to get that info back on the line objects, using a PointOnLineOverlayer.

 

 

Of course, there might be an easier way too, using a SpatialRelator or something, as @sigtill has already proposed,

 

 

If you could upload a small sample of the data, it would be easier to produce a functioning workspace.

Hi @jonas_nelson. That makes sense! I uploaded the workspace above if you did want to take a look! Thank you

Reply