I have several GPX files that I'm trying to load into a PostGIS table, with the goal of map-matching them (I intend to use pgMapMatch but open to other services I can run on my own machine). pgMapMatch requires the GPS trace to be a linestring with an M coordinate indicating the timestamp of each point. I cannot figure out how to do this.
There's an answer here Storing GPS tracks with timestamps in PostGIS that suggests storing each gps track_point in a table, then converting to a linestring with ST_Makeline. I think it could work, but I need to figure out how to get ST_Makeline to consume a point geom with just an x,y coordinate and a separate time value, and combine them to produce a linestring with points with x,y,m coordinates.
The best I've been able to do so far is get the each gpx track layer as its own multilinestring with just x,y coordinates using
ogr2ogr -f "PostgreSQL" PG:"host=localhost user=postgres port=5432 dbname=my_db_name password=my_password" my_gpx_filename.gpx -overwrite -lco GEOMETRY_NAME=geom -nln "my_table_name" track_points
I've looked over the documentation on the GDAL site for both the GPX format (https://gdal.org/drivers/vector/gpx.html) and PostGIS format (https://gdal.org/drivers/vector/pg.html), but haven't figured it out