Skip to main content
Hi,

 

 

I have two datasets:

 

1. Images, with the datetime attrribute

 

2. GPS points, also with a datetime attribute

 

 

I've formatted both datetime attributes to the FME date/time system.

 

 

How can I merge these two sets? The images should get the coordinates

 

of the GPS point with the minimal difference in datetime.

 

 

J.
You could use the FeatureMerger (attributes only in parameters).  If there are small differences in time, round them off to the closest 15/30 seconds using the AttributeRounder.
I assume you have some ID?

 

 

But if you want that, just merge them (suplier = 1 and requestor = 1) all and calculate difference.

 

Then listbuilder grouped by ID, listsorter on difference ascending and listindexer with index=0.
Hi,

 

 

Another thought.

 

If you replace the images and GPS points with time positions on a time line, the NeighborFinder can be used to find GPS point which has minimal time difference for each image.

 

Assuming that the format of datetime is "yyyymmddHHMMSS".

 

 

(1) Use a RasterExtractor to store each raster (image) data as an attribute.

 

(2) Replace each raster with a point on the time line by a VertexCreator.

 

X: datetime of the image, Y: 0

 

(3) Extract the coordinate (x, y) of each GPS point by a CoordinateExtractor.

 

(4) Replace each GPS point with a point on the time line by a VertexCreator.

 

X: datetime of the GPS point, Y; 0

 

(5) Add a NeighborFinder; send the (2) points to the Base port; send the (4) points to the Candidate port. Matched features will have the coordinate (x, y) of the closest candidate (GPS) point on the time line.

 

(6) Finally use a RasterReplacer to restore the original raster.

 

 

Alternatively, (assuming the rasters have unique ID attribute) you can use a FeatureMerger to merge the Matched features to the original images, instead of the RasterExtractor/RasterReplacer pair. 

 

 

Takashi
If you adopt the time line method, it's better to format the datetime with "%s" (epoch time), rather than "yyyymmddHHMMDD".
Time line method works perfectly, thank you Takashi

 

At first sight, both date/time formats work well for this method

Reply