A techy post reporting on some work in progress, and seeking suggestions! …

A while back we introduced various new URL formats like:

http://www.cyclestreets.net/journey/to/SW1A+2AA/

which would allow someone at that postcode to put a link 'cycle here' on their website.

Journey to...

This is designed so that the user needing to plan a journey would just follow the link, type in where they want to start from, and click 'Plan'.

We've been working on some more formats lately (well, actually, last night until 3am!). This is a quick 'work-in-progress' post, and we'd welcome any ideas.

You can enter /to/ or /from/, can enter postcodes, lat/lon and can add an optional label at the end. Examples:

Postcode:

Both – London to Cambridge:

Lat,lon, with or without a zoom level:

With a customised label added:

There are also the area homepages, which can be combined with the above:

Very experimental, and not yet working well: including the NameCapitalised in the URL, e.g.

What other formats could be useful?

Once we've finalised them, we'll turn them into a nice interface like the Link page has.

Tech spot:

Definitely stop reading now if you're not a techy :)

The regexp for these is not very nice! /journey/<from>/<to>/  is done using:

^/journey/((?:[A-Z]{1}[^/]+)|(?:[a-zA-Z]{1}[^/]+)|(?:(?:-?[0-9][0-9]?\.?[0-9]{0,7}),(?:-?[0-9][0-9]?\.?[0-9]{0,8})(?:,(?:7|8|9|10|11|12|13|14|15|16))?))/((?:[A-Z]{1}[^/]+)|(?:[a-zA-Z]{1}[^/]+)|(?:(?:-?[0-9][0-9]?\.?[0-9]{0,7}),(?:-?[0-9][0-9]?\.?[0-9]{0,8})(?:,(?:7|8|9|10|11|12|13|14|15|16))?))/$

4 thoughts to “New ‘cycle to us’ links – techy work in progress

  • SK53

    Ordnance Survey grid refs are perhaps still used by keen cyclists. I'd have thought having 6-figure grid refs as from & to might be useful. So from/047799/ or from/TQ30079/ with the former assuming the 100 km grid square is the same as the current location. Oddly the former may be easier to fit into the regexp, whereas there are many clashes between 100 km grid square names & postcodes (e.g., TQ, SK, NN).

  • David

    You could handle postcodes with no 'space' (+) between the out code and in code, based on the fact that the latter is always 3 characters (in fact it's always /\d[ABDEFGHJLNPQRSTUWXYZ]{2}$/)

  • martin

    Thanks – useful suggestions there. Will get these implemented soon.

    The postcode routine should already handle lack of spaces, but it does need to be tightened up. In fact, another part of the code already uses a proper postcode regexp, so I should transplant into the redirects at webserver level.

  • Pingback: CycleStreets » Blog

Leave a comment