I'm working on a TV graphics system which will be used on a broadcast from train ride.
With this system I want to automatically be able to list interesting POIs along our route.
We have a large postgis table of POIs which are within 2km of the train route, and we have a GPS fitted to the train, so we know both our current position, the polyline of the train route and the lat/lng of the POIs close to the route.
I've been wrestling with understanding how I can most easily get a hold of the POIs which are closest to my current posistion at any given time.
I have two
The first is called
'tracks' with two columns:
date (date) | track (polyline)
The other is called
'pois', and has several columns, but the relevant one is
I have a GPS connected by socket which I can read whenever.
So the query I'm interested in formulating is something like:
"Give me the POIs closest to my current GPS position along this linestring"
I've been looking at using
ST_BUFFER in combination with
ST_DWITHIN to get it up and running, but I'm obviously not at a high enough competency level to get it working. Seeing as both my GPS position and the POIs position probably will never be exactly on top of the linestring, will this maybe complicate things further?
Has anyone done something like this?