Skip to main content
Question

Grid Locations for start and end of line segments


reidm35
Forum|alt.badge.img

Hi there,

I'm trying to get grid locations from a polygon fgdb feature class attribute for the the start and end of a fgdb line feature class. The attribute I need to put into the line data is a GRID ID. I thought about using a spatial relator or a lineonareaoverlayer, but I cannot figure out how to use either transformer and how to transfer the attribute over. I'm especially having problems with exposing elements and dealing with list attributes. I can add photos or attach the workspace if needed

14 replies

takashi
Evangelist
  • November 1, 2019

Do you have the grid data as a polygon dataset or so?


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • November 1, 2019

If you use spatial relator and test for intersects and build a list of your GRID IDS, you can then use two ListIndexers to get the first and last GRID_IDs in the list which will correspond to the start and end points of your line

Another option is to only test for polygons which the line starts or ends in, then you can use an attributecreator to transfer the two list elements to the attributes you want


reidm35
Forum|alt.badge.img
  • Author
  • November 1, 2019
takashi wrote:

Do you have the grid data as a polygon dataset or so?

Yes I do.


reidm35
Forum|alt.badge.img
  • Author
  • November 1, 2019
ebygomm wrote:

If you use spatial relator and test for intersects and build a list of your GRID IDS, you can then use two ListIndexers to get the first and last GRID_IDs in the list which will correspond to the start and end points of your line

Another option is to only test for polygons which the line starts or ends in, then you can use an attributecreator to transfer the two list elements to the attributes you want

Thank you for @ebygomm for the help! Although when I follow this process I just get null values in the grid id columns. I've attached a screenshot of the workspace.


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • November 1, 2019
reidm35 wrote:

Thank you for @ebygomm for the help! Although when I follow this process I just get null values in the grid id columns. I've attached a screenshot of the workspace.

Are both datasets in the same coordinate system? If you inspect the data coming out the spatialrelator do they have a related candidates count of 0?


reidm35
Forum|alt.badge.img
  • Author
  • November 1, 2019
ebygomm wrote:

Are both datasets in the same coordinate system? If you inspect the data coming out the spatialrelator do they have a related candidates count of 0?

@ebygomm Both datasets are in the same coordinate system yes. When I inspect the data coming out of the spatial relator yes the related candidates are all 0.


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • November 1, 2019
reidm35 wrote:

@ebygomm Both datasets are in the same coordinate system yes. When I inspect the data coming out of the spatial relator yes the related candidates are all 0.

That suggests that your lines and polygons don't overlap. Do they appear to overlap in the data inspector


reidm35
Forum|alt.badge.img
  • Author
  • November 1, 2019
ebygomm wrote:

That suggests that your lines and polygons don't overlap. Do they appear to overlap in the data inspector

They most definitely overlap. I've checked in arcmap


reidm35
Forum|alt.badge.img
  • Author
  • November 1, 2019
reidm35 wrote:

They most definitely overlap. I've checked in arcmap

@ebygomm is there anything else I could do to check this?


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • November 1, 2019
reidm35 wrote:

@ebygomm is there anything else I could do to check this?

Can you see that they overlap in the inspector?


takashi
Evangelist
  • November 3, 2019

Hi @reidm35, I don't think that the first/last elements in the list generated by the SpatialRelator always indicate the grid polygons related to the start/end nodes of the line segment. Which grid polygon intersects start/end nodes of the line segment depends on the input order of the grid polygons.

A possible workaround is:

  1. GeometryExtractor: Save the line geometry as a feature attribute.
  2. Chopper (Mode: By Vertex, Maximum Vertices: 1): Split the line segment into individual vertices - i.e. start node point and end node point.
  3. Clipper or SpatialFilter: Merge GRID_ID of grid polygons to the points individually.
  4. Aggregator: Aggregate the points in the input order (from start to end) and store the GRID_IDs into a list attribute.
  5. AttributeManageter: Rename the list elements and remove unnecessary attributes.
  6. GeometryReplacer: Restore the original line segment geometry.

See also the attached workspace example: none2none.fmwt (FME 2019.1.3.1)


reidm35
Forum|alt.badge.img
  • Author
  • November 4, 2019
ebygomm wrote:

Can you see that they overlap in the inspector?

Yes I can.


reidm35
Forum|alt.badge.img
  • Author
  • November 4, 2019
takashi wrote:

Hi @reidm35, I don't think that the first/last elements in the list generated by the SpatialRelator always indicate the grid polygons related to the start/end nodes of the line segment. Which grid polygon intersects start/end nodes of the line segment depends on the input order of the grid polygons.

A possible workaround is:

  1. GeometryExtractor: Save the line geometry as a feature attribute.
  2. Chopper (Mode: By Vertex, Maximum Vertices: 1): Split the line segment into individual vertices - i.e. start node point and end node point.
  3. Clipper or SpatialFilter: Merge GRID_ID of grid polygons to the points individually.
  4. Aggregator: Aggregate the points in the input order (from start to end) and store the GRID_IDs into a list attribute.
  5. AttributeManageter: Rename the list elements and remove unnecessary attributes.
  6. GeometryReplacer: Restore the original line segment geometry.

See also the attached workspace example: none2none.fmwt (FME 2019.1.3.1)

Hi @takashi. Thank you for the advice! Although when I run, I get zero features exiting the inside part of the Clipper transformer. Is there something wrong with my data?


reidm35
Forum|alt.badge.img
  • Author
  • November 6, 2019
takashi wrote:

Hi @reidm35, I don't think that the first/last elements in the list generated by the SpatialRelator always indicate the grid polygons related to the start/end nodes of the line segment. Which grid polygon intersects start/end nodes of the line segment depends on the input order of the grid polygons.

A possible workaround is:

  1. GeometryExtractor: Save the line geometry as a feature attribute.
  2. Chopper (Mode: By Vertex, Maximum Vertices: 1): Split the line segment into individual vertices - i.e. start node point and end node point.
  3. Clipper or SpatialFilter: Merge GRID_ID of grid polygons to the points individually.
  4. Aggregator: Aggregate the points in the input order (from start to end) and store the GRID_IDs into a list attribute.
  5. AttributeManageter: Rename the list elements and remove unnecessary attributes.
  6. GeometryReplacer: Restore the original line segment geometry.

See also the attached workspace example: none2none.fmwt (FME 2019.1.3.1)

Hi again @takashi. I'm still getting Null values in the my writer feature type. Although this workflow definitely worked. The Geometry Replacer have the correct attributes, but FME is not transferring these over to the writer! Any tips?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings