Skip to main content
Solved

Merge features based on time


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.

Best answer by takashi

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
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

Forum|alt.badge.img
  • April 8, 2015
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.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • April 8, 2015
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.

takashi
Evangelist
  • Best Answer
  • April 8, 2015
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

takashi
Evangelist
  • April 9, 2015
If you adopt the time line method, it's better to format the datetime with "%s" (epoch time), rather than "yyyymmddHHMMDD".

  • Author
  • April 9, 2015
Time line method works perfectly, thank you Takashi

 

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

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