Thursday, 2 November 2017

postgis - From trajectory of GPS points to multiline segment?


Given a trajectory as a sequence of GPS points I would like to create a smooth linestring representing a path where a car drove. The data is stored in postgresql: the input trajectory in a table, where each row represents an individual GPS point, the output in a table, where each row represents the whole smooth tragectory. All points are stored in WGS84.



My approach for this would be the following:



  • implement everything in C++

  • retrieve the whole trajectory from the DB, convert it to UTM32N (as this is where the trajectories are coming from), flatten the points with the help of GDAL library

  • compute a some sort of approximate spline

  • linearize the approximate spline

  • transform it back to WGS84

  • send the data back to Postgres


What would be the best tools/libraries to use for approximate splines and linearization?



Java/C++/Postgis solutions are preferable, as currently we are using only these subsystems.


I suppose this is a very common task people need to do in gis environment, however I haven't found close matches to similar questions on gis stackexchange.


An alternative would be to:



  • collect all points into linestring

  • ST_LineToCurve

  • apply Bezier smoothening to the curve

  • ST_CurveToLine




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...