Skip to main content
I'm starting with a small dataset of GPS coordinates and apply a spatial filter to only keep points that fall within a geofenced (polygon) boundary.  I now have a subset of points that can be grouped further by an attribute column used to store unique integer values (specifically unix/epoch time values, e.g. 1414538606, 1414539194, etc.). 

 

 

These groupings are determined by the range of the integer values, where I would like to associate records that fall within a range of an arbitrary limit (in my case 1200).  My desired output is the number of groups identified (the actual attributes are meaningless for my purposes).

 

 

I've attached a screen shot to illustrate my problem.  The (blue) highlighted records are the points that fall within my polygon area and are immediately next to other (highlighted) records that should make up the desired group.  My illustration displays 11 records that should produce 4 groups representing 4 separate instances in time that my GPS device enters my geofenced area.

 

 

This problem seems fairly trivial to me, but not sure how to accomplish it in FME.  I'm hoping someone has done something simliar and can offer some assistance please.  Thank you in advance

 

 

 

 

 
If I am understanding correctly, you want to group them into groups of 1200 seconds? While I am not sure how you will decide how to do that e.g. if 5 photos are taken over 1400 seconds, how do you split them into groups if the 5 are evenly spread. Anyway that isn't answering your question. What I have done previously in these situation is turn your non-spatial problem into a spatial problem. In your case you could use the epoch time as an X value and set Y as 0 and create a point for each value. Then you can use all the spatial transformers such a nearestneighbour. etc to work grouping etc.
create those groups by using the time past between each record. (sorted on local time ofcourse)

 

This is iterative.

 

Create a count attribute to hold number of records.

 

1. Use a variablesetter to create a list of the first record.

 

   When next record is within 1200 sec of first record (simple tester), u add it to this list.

 

   U end the list when a record is met that is not within 1200 sec of first item in list.

 

   When list is ended u asign it a group ID.

 

test if record count is met and if so end else loop to 1 . 

 

 

You can create a list of a object or objects by creating an atribute to build on (i like to use "BuildThis" = 1.

 

Adding a object can be done by adding this (common) attribute to it and then exploding existing list and immdiately rebuilding it.

 

When u start a new list u must first remove this attribute from objects that are already tested. (by for instance slecting objects on basis of existance of this attribute and then deleting it, a customtransformer is handy for this)

 

 

 

If u copy paste a piece of the table in this forum, i could make a  sample script. (now its just a pic)

 

I use similar techniques for RandomStratified Samplers etc. (statistics)

 

 
tdavis/Geo,

 

Thank you both for the quick response.  I've elected to try what tdavis suggested as it was an intriguingly clever way to look at my problem and it seems to work.  Much appreciated.

 

Cheers!

Reply