Skip to main content
I am new to FME so sorry if the question is not clear or silly.

 

 

I would like to create a workflow that compares two sets of data. Well really it is one dataset that I want to manipulate the data first and then compare it to itself.

 

 

The dataset is a list of two sets of points in latitude and longitude coming from excel.

 

Example

 

Line        lat1                         long1                      lat2                         long2

 

Line1      39.9379                 -104.9802             39.9508                 -104.9768            

 

I would like to link these two points to create a line and then add a buffer to the line of 300 ft. So my workflow looks something like this:

 

 

1) Reader

 

2) 2DPointAdder into another 2DPointAdder (creating the line)

 

3) Reproject (reprojecting from degrees to feet)

 

4) Buffer (add buffer ft)

 

5) reproject (reporjecting back in to degrees)

 

 

I then want to compare the original list back and see if any of the original lines are within the new buffer. I know that i will get one positive because I am comparing the same list to its self but I am looking to see if any other lines neighboring that line are within the buffer zone.

 

 

I have tried to send both the buffered lines and non buffer lines into a clipper but I was unsuccessful.

 

 

Anyone have any ideas.  Thank you in advance for any assistance.

 

 

 

Hi,

 

 

I think the SpatialRelator transformer is suitable.

 

Send non-buffered lines to BASE port, buffered lines to CANDIDATE port. Output lines will have list attributes which contain attributes of every candidate feature spatially related. You can specify spatial relationship type(s) to "Tests to Perform" parameter.

 

Takashi
So I tired this but it did not work.  I had three listings Two of which should have been next to one another and one that was no where close.  However I recieved all 3 records as results form the SpatialRelator.  As far as test to preform I tried them all.  Question, how does FME step through the list.  Does it compare is candidate to all base records?  Thanks Takashi for your help.
The SpatialRelator compares every candidate to each base feature, then it will append list attributes containing attributes of candidates related spatially, to the output feature.

 

In your case, the lists always will contain attributes of at least one candidate by default, because the candidates are buffered base lines. That is to say, one element of the list is same as an attribute of the base itself. I guess one of the three records you mentioned contains base attributes.

 

If the features have unique identifier attribute (e.g. called "ID"), specify "ID" to "Attribute(s) Must Differ" parameter of the SpacialRelator to avoid comparing of  candidate and  base having same "ID".

 

If not, consider using the Counter to set "ID" to every feature before buffering.

 

Try this.
Takashi thank you so much. I am getting oh soooo close. So I am send the results to a excel writer after the SpatialRelator. The attributes I have added are the unique ID and description for the base (2 attributes), I have also added and attribute for the related candidates count, as well as one more attribute for what I believed was the candidates unique ID. I then linked these attributes from the SpatialRelator to the writer. When I run the translation the count give me what I would expect but it does not tell me when candidates made up that count. What am I missing?

 

 

Thank you again for your help. I cannot believe we have almost got this figured out; it is really great and will help me tremendously!

 


Assuming you are trying to write features having these 5 attributes into Excel table: 1. ID of base feature 2. Description for base feature (1) 3. Description for base feature (2) 4. Number of related candidate features 5. ID(s) of related candidate feature(s)   Since 1,2,3 are attributes of base feature, there will not be problems. The 4th attribute will be created by the SpatialRelator as related candidate count, you can send it directly to corresponding field..   How are you writing the 5th attribute - candidate ID(s) ? The SpatialRelator saves attributes of related candidates in list attributes, i.e. candidate ID(s) will be contained in a list attribute as its element(s). Here, be aware that we cannot write list attributes into any destination dataset directly. Concatenating list elements to change the list to a non-list is a general way in many similar cases. If you are facing difficulties on how to write candidate ID(s), consider using the ListConcatenator transformer before writing.
Success!!!  I have got what I need.  Thank you for all your help!

Reply