I have a table that contains the route's GPS traces and I want to select only unique and longest routes.
Table looks like:
route_id gpstrace
route1 [[long,lat], [long,lat],... ]
route2 [[long,lat], [long,lat],... ]
route3 [[long,lat], [long,lat],... ]
route19 [[long,lat], [long,lat],... ]
In route_id
column there is possibility that route1
, route2
and route3
are same but route1
is little bit longer than route2
and route3
. So I want to return route1
.
Similarly I want to return all unique and longest route from the table.
I tried:
https://gis.stackexchange.com/questions/96037/sql-geometry-query-similar-to-select-by-centroid
Can anyone help me with SQL query?