Question

Grid Locations for start and end of line segments


Badge

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

Userlevel 2
Badge +17

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

Badge +10

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

Badge

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

Yes I do.

Badge

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.

Badge +10

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?

Badge

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.

Badge +10

@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

Badge

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

Badge

They most definitely overlap. I've checked in arcmap

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

Badge +10

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

Can you see that they overlap in the inspector?

Userlevel 2
Badge +17

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)

Badge

Can you see that they overlap in the inspector?

Yes I can.

Badge

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?

Badge

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?

Reply