Bit of a newbie here, trying to work out whether any PostGIS functions can help with my task. Apologies in advance if my use of GIS terminology is not up to scratch yet.
I have a large database of GPS points, ie lat/long coordinate pairs (large being "millions" of points). Currently they have no relational information, so they are not linked together.
However, they were collected over the UK rail network, typically every few metres. So all points map to rail tracks.
I need to process these points and link them together, so they map onto real railway lines. I want to identify which GPS points are buffers (ie ends of track) and points (in the rail sense - ie where track splits) as well as those that are "just sections of track". This needs to be a process that runs automatically with no user intervention.
There are many areas where multiple tracks run in parallel, or areas such as large stations with lots of points & sidings, where there are large numbers of GPS points in a small area.
Being rail, there is a limit to how much the line will curve, so that must be a key feature to aid analysis. As the GPS points are close together, it should be possible to see which form lines that could be track, and dismiss those that turn too sharply (which must be points from parallel tracks).
Initially I had been planning to write some java code that would pick GPS points from the DB that fall within a limited geographical area of each other, and look for GPS points within that region that continued in a straight-ish line. The add/update "previous node id" and "next node id" fields for each point. Then repeat, using the last linked node as the centre of the next geographical region to analyse. When the end of a track was reached, then I'd pick the next "untraversed" point in the DB and start again. Then repeat this cycle until every point in the DB had been traversed.
Initially the data is in a mySQL database table. I'd added an extra field, in which I'd converted the lat/long pairs to a geo "Point" field. Then used some rudimentary "MBRContains" queries to return points within a certain area (eg 100m2). I was then going to write some java code that explored/traversed the points, with repeated calls to get points within small areas.
So my question(s) are:
Does PostGIS offers any functions that could assist with the task of identifying related points ?
Or are there any better approaches out there to achieve this ?
Maybe there are tools/routines to do just this kind of thing, but I don't know the terminology enough to know about it yet :)
Thanks for any advice.