Donate using PayPal

CycleStreets blog

News from CycleStreets

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

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 Responses to “New ‘cycle to us’ links – techy work in progress”

  1. SK53 Says:

    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).

  2. David Says:

    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}$/)

  3. martin Says:

    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.

  4. CycleStreets » Blog Says:

    […] modes, promotional flyers you can order, clickable icons for the London Cycle Hire website, a ‘cycle to us’ link facility, an integrated map editor […]

We welcome your feedback, especially to report bugs or give us route feedback.

My comments relate to: *






Your comments: *
URL of page: * https://www.cyclestreets.net/footer.html
How did you find out about CycleStreets?:
Your name:
Our ref: Please leave blank - anti-spam measure

* Items marked with an asterisk [*] are required fields and must be fully completed.