I am quite a newbie in Postgres and Postgis so please be simple and clear I am trying to do a simple map-matching (or path-inference if you wish) of some GPS points. I am using postgres(postgis).
Here is the problem:
I have a table in my database containing my GPS points: gpspoints (Lat, Long, time, speed, azimuth, geometry, ...)
I have imported a shapefile of the road network into my database as well:routes (gid, idrte,version, nomrte, norte, clsrte, geom, ...) -- I DO NOT HAVE the azimuth of the links, and I am not sure how can I calculate it using the postgis function ST_azimuth. All I have is a shapefile of the road network containing columns enumerated above.
I want to associate each GPS point to the nearest link (in a buffer of 20 meters around the point) only if the direction of the link agrees with the azimuth of the GPS point (+ or -15 degrees) and retrieve the projected position. Otherwise I want it to search for the NEXT nearest link, within the 20 meter buffer, which has an acceptable azimuth! (Just like the picture!)
I want the new coordinates of the projected GPS points to be added in the table "gpspoints" as "projectedLat" and "projectedLong".
I appreciate your help
(In the picture below, actual points are demonstrated using a direction while projected points do not have any direction mark)
أكثر...
Here is the problem:
I have a table in my database containing my GPS points: gpspoints (Lat, Long, time, speed, azimuth, geometry, ...)
I have imported a shapefile of the road network into my database as well:routes (gid, idrte,version, nomrte, norte, clsrte, geom, ...) -- I DO NOT HAVE the azimuth of the links, and I am not sure how can I calculate it using the postgis function ST_azimuth. All I have is a shapefile of the road network containing columns enumerated above.
I want to associate each GPS point to the nearest link (in a buffer of 20 meters around the point) only if the direction of the link agrees with the azimuth of the GPS point (+ or -15 degrees) and retrieve the projected position. Otherwise I want it to search for the NEXT nearest link, within the 20 meter buffer, which has an acceptable azimuth! (Just like the picture!)
I want the new coordinates of the projected GPS points to be added in the table "gpspoints" as "projectedLat" and "projectedLong".
I appreciate your help
(In the picture below, actual points are demonstrated using a direction while projected points do not have any direction mark)
أكثر...