Question

Compare attributes from two features

  • 9 September 2016
  • 3 replies
  • 9 views

Badge

I want to compare the attributes from two features in same shape-file. If the timestamp attribute does not differ more than one minute from the timestamp attribute from the previous Point, I want to create a line between the points with PointConnector. Does anyone have any idea how to make this comparision?


3 replies

Badge +16

you can test the dates and see if the fall within a minute range.

You could also calculate the dates difference date calculator is the store transformer to use I believe and test the difference

Tip if you are using the dates for the test format them first using the dareformatter with the 's' setting

Userlevel 2
Badge +17

Hi @keoe, expanding Itay's idea regarding %s format, I would add line ID attribute that can be used to group the points by the AttributeCreator with combination of the Advanced options and Conditional Value setting.

  1. DateFormatter: Format the timestamp value with %s format (count of seconds elapsed from the epoch).
  2. AttributeExposer: Expose the line ID attribute name (e.g. "_line_id"). It has no value yet.
  3. AttributeCreator: Assign actual value to "_line_id" as the screenshot illustrates.
  4. PointConnector: Set "_line_id" to the "Connection Break Attributes" parameter.

[Addition] The intention of this setting is: If the number of seconds elapsed from the timestamp of the previous point is greater than 60, assign "ID of previous point + 1". Otherwise assign the same ID as previous point.

Badge

Thank you @takashi! Your solution works fine.

Reply