Wednesday, April 4, 2012

Feature Manipulation Engine & Linear Referencing

keywords: FME, LRS (linear referencing system)

… a little bit something for FME addicts … my people :-)

Recently I have to to solve one simple task regarding linear referencing. It is common task for all systems where the coordinate system is related to the linear elements. Each feature location is expressed as a distance from the beginning of some line segment. For example of such systems I can point out road systems, pipeline systems and similar.

In this case that I’m writing about I had GPS data in csv format and road axis in the Oracle database. The GPS data represent location of the images (taken by the specially equipped vehicle for road measurements) along the road. To import images into application that animates ride down the road I had to express GPS coordinates for every image as a distance from the beginning of the road segment, ie. I had to establish LRS. For this particular task I’ve choose FME.

For better understanding I’ll break down the task into smaller activities (steps):
1. create point geometry from GPS data in csv format (if needed change the coordinate system)
2. prepare line geometry of selected road segment
3. move (map) measured GPS points to the nearest point on the road segment
4. calculate measure for all points on road segment (old and new points added in step 3)
5. join original attributes of GPS points (image ID needed for animation) with the calculated measure (step 4)

Here is the produced workbench file (FME 2012).

Unfortunately I can't post original data but if you have some additional questions feel free to ask. Maybe FME have some better solution for this task but I didn't have additional time to explore. The whole schema presented in separate steps is here.

  • 2D point adder creates geometry from atribute data
  • Reprojector chenges coordinate system of GPS data to match coordinate system of road data
  • Counter creates ID on every point (I wonder why I put it here...  just forget it ...)
  • Coordinate rounder removes unuseful decimals places on coordinates
  • tester removes points that are collected before measuring car entered discussed road
  • rounding the coordinates
  • length calculation  (_uk value) using LengthCalculator :-)
  • calculation of scale factor (ExpressionEvaluator)
  • ratio between distance calculated from geometry data (_uk) and distance measured by odometer (STAC_ZAV) and stored in database … this calculation is not so important for this solution but it may be required
  • store ratio (_koef) as a variable using VariableSetter
  • remove height coordinate (2DForcer)
  • NeighborFinder finds closest point on road line for every gps point. Coordinates are stored as attribute values
  • 2DPointReplacer takes previously calculated coordinates from attribute values and create geometry objects
  • custom transformer unique_geom creates unique identifier for every point based on point coordinates
  • overylay points on the line (PointOnLineOverlayer) and join generated line segments (LineJoiner)
  • calculate measure for all vertices (point) in line generated in previous step
  • break line feature into points (line vertices) using Chopper
  • create unique identifier for every point based on point coordinates (unique_geom)
  • extract generated measure (LR) an store it as attribute value (MeasureExtracor)
  • retrieve variable created in step 1 and store it as attribute value (VariableRetriever)
  • scale calculated measure values using variable value retrieved in previous step
  • using FeatureMerger merge calculated measure values (step 4) with the original attributes of GPS points. Unique identifier based on geometry is used for this task (custom transformer: unique_geom).
  • remove unnecessary attributes using AttributeRemover
  • store result into desired format (in this case it was xls)

No comments:

Post a Comment