Took a few dull conference calls but I'm mostly there with the prototype.
Input is the explorer.kml file you get from VeloView containing the unvisited tiles around your max cluster.
Importing this through kml2gpx.com and into gpxeditor.co.uk made my browser slow down horribly, probably because it contained 832 separate tracks (one track per unvisited tile). It looked like this:-
My script parses the kml file and works out individual 'blocks' of adjacent tiles:-
The rough algorithm is that it converts the lat/lon co-ordinates to a grid (by determining the minimum value of lat and lon seen in the all of the points, then working out the average length of a tile boundary, bearing in mind a tiles NS length is different to its EW length) so I can work with simple integer cartesian co-ordinates:-
It finds 34 blocks in my file (which is slightly more up to date than the one original image up top) and assigns them a unique letter/number (just for the ASCII visualisation).
I then find the outline of each block by removing unnecessary edges (I remove every edge where there is a tile either side of the same 'block'). This gives:-
And then I pick a random point that hasn't been processed yet and trace round the border outputting a GPX file of the track(s), it removes the edges it travels along as it works so that it doesn't try and do anything twice.
Uploading that gpx file gives:-
This only contains 31 tracks (3 down on before as it can draw the blocks that connect diagonally by a single vertex in the same gpx tracks as the blocks they touch).
The browser is much more responsive and it should be much easier for me to plot my routes.
I may need to add in some extra lines in each block so i know where the inner tile boundaries are, but that should be relatively simple now I've got the outline of each block (which was the tricky bit). The point is the number of tracks will be much lower (31 down from 832 in my case) and it seems to be the sheer number of distinct tracks that causes the browser to slow down.
Once I clean up the code I might see about rewriting it in Python or Go and sticking it on a Heroku Dyno for anyone to use.