Just tried out gTraffic on the latest version of Opera (8.51). The map works okay but as I guessed the XSL panel does not.
The winter solstice has come and gone (21st). This means the year has turned so we can look forward to lighter nights again (despite whacky British summer time messing with our heads). I would like to wish everyone who uses the gTraffic site a Merry Christmas and a Happy New Year!
A second person on stumbleupon has mentioned that gTraffic doesn’t work on Firefox. I am starting to get worried. What is it that they are seeing? It works perfectly for me!
Going to fix IE colour problem today, I promise.
I have been suffering with analysis paralysis over the redesign of the list panel on the main page of gTraffic.info. I knew what I wanted to do but was unsure as to how to go about it. One of the main changes was to add the ability to sort the elements of the panel depending on the cell e.g severity, road, description.
My initial thought was to use something like mochikit. I had a play about with this but found it was difficult to just ‘drop’ in. This was partly because of my use of an iframe to hold the panel but also because it was a pretty non-trivial(understatement) to work up something that could do what I wanted based on the example given. I’m not knocking it though I think it is pretty clever and might yet go back to it.
Instead I decided to do what I had been putting off and have a ‘closer look’ at XSL. The original XSL code I used was ‘adapted’ from Dom Ramseys site here. Dom is a very clever guy and was one of the first people (possibly _the_ first) to use XSL for this in a Google maps ‘mashup’. I knew his site from the bbc backstage prototypes list as he posted his up the day after mine much to my chagrin as his was miles better than my inital effort. I can’t tell if he is still doing things this way as his site is presently stuffed. Anyway, I had a loose understanding of what was going on and in a way it was a perfect fit in the sense that all you had to do was paste the XML into the iframe along with the XSL to format it.
And so to now. I have rewritten the panellist.xsl file to ‘sort’ the elements based on a road tag in the XML. This wasn’t easy and I spent a good few hours on it even though the resulting file itself is small. Anyone interested in the file can find it here. I am pretty chuffed with this as it uses some more advanced features of XSL in particular the ‘sort’ and some fairly whacky parameter passing code to get the element ‘id’ passed down though the XSL templates.
Using this also meant updating the Python code which builds the XML files for traffic, roadworks and VMS to include a ‘road’ tag. I used Pythons regular expression library to extract this from the appropriate feeds.
patternRoad = re.compile('[a-z]+\d+', re.IGNORECASE)
match = patternRoad.match(description)
road = match.group()
Now when you look at the panel you should see that the elements where the road is mentioned are sorted in alphabetic descending order. I have done it this way to ensure that motorways (M-roads) are always mentioned first.
This is only a first step. The next is to redesign the panel to have a header which will trigger the ordering when the appropriate column is clicked. There is a sample of something to do this here. As a developer you always have a feel when you have cracked a problem and I think I have finally got the measure of this one.
I notice that I have broken the background colour for the panel under I.E. I. Have patience I.E users I will fix this tomorrow when I have more time.
I notice this morning that there is a comment on the ‘stumbledupon’ complaining that gTraffic doesn’t work under Firefox 1.5. I have been using 1.5 since it came out and the site renders perfectly, better in fact than under I.E.
The only browser I know it has problems with is Opera because it doesn’t implement XSL fully (though this might be fixed now). I will test this.
So, to reiterate. gTraffic works perfectly under i.e and firefox!!
I just noticed yesterday that the London West traffic cams were not in the pull down list! Haven’t a clue how they got dropped from the list. It’s back in now.
Here is very Christmassy view of the Albert Bridge.
Also layout of footer has been altered.
Go a nice mention on the stumbledown site here which is maybe why the number of hits on the site has shot up.
This is ‘M41 Northern Roundabout – Whitstable House” which looks really futuristic under the motorway lights.
Massive fire at a fuel depot just outside of London. Northbound section of the M1 has been closed. Here is screencap. Red icons indicate severe incident.
This is described in the traffic advisory as a ‘serious fire’ which is bit of an understatement to say the least.
I see Microsoft have finally got their act together and added the UK street and road info to their map control.
I had a look at Microsoft Earth when it was launched and was quite impressed (especially since they were playing catch up to Google). I am toying with the idea of developing a gTraffic site which lets you switch between the two map types.
The yahoo map here is also mighty impressive.
The QMISS VMS xml feed is down. Let’s hope it’s back up tomorrow.
Still looking into a radical redesign of the site. If anyone has any ideas then I would love to hear them. Email me at email@example.com.