gTraffic: Down perhaps not out.

Some of you may have come to this site from my UK road traffic site gTraffic.info. You will have noticed that there is no longer any traffic incidents available. This is because the TPEG feed which was the source of incident data has been cut by the BBC. I am fairly philosophical about this. It wasn’t like the feed was going to be there forever. I got about four years out of it which isn’t bad.

I have just shifted the URL to a different provider so I am not quite ready to kill off the site just yet. Technically I could probably put a script together which generates data from the HA rss feed. I have other stuff to get on with so that may or may not happen.

 

 

GWT: gTraffic Usage

I have Google stats activated for some of my websites including gTraffic the UK traffic Google map mashup. The site ticks over with fairly low stats of about 20 people a day (I salute you fellow traffic junkies). Occasionally when there is a bank weekend or a public holiday the stats jump to some fairly respectable figures. For example, there is a monday holiday coming up in the UK this weekend, check out the stats. Both spikes are holiday weekends:

gTraffic usage

This is interesting in all sorts of ways if you are into road traffic websites. Basically (and I can back this up from the commercial sites I have worked on), noone gives a hoot about the traffic on the road until they have to make a journey. Then they want to know if they are likely to get held up as the pack the kids into the 4×4 and make the journey down to Dover or north to the Lake District. For those of you who use gTraffic I thank you and have good holiday.

GWT: gTraffic Timeline

I occasionally have a look at my GWT traffic mashup to make sure it’s still working. I was looking at it again tonight and was struck by how many good ideas it seems to have. Good ideas that no one else seems to have bothered to pick up on. As an example take a look at the view (as of tonight) for the Berkshire area.

gTraffic

I was clicking around to make sure that the data seemed up to date and kept clicking on long running Roadworks. If you only had that view then it would be a chore to determine what was new and what was long running except that you have the ability to flick over to the time-line. Looking at that I could see right away what the latest events were. The time-line view is not perfect but I am still amazed no one else has copied this idea cos I think this is genuinely useful.

gTraffic timeline

Another one is the zoom-in/zoom-out buttons on the infowindow. My implementation jumps down to the street view and then back up to the last selected zoom level. I know this has been used elsewhere in sites connected to me but I would have thought this would be more widespread as, again, it’s a useful functionality.

gTraffic zoom

Maybe it’s just me but I think there are some good ideas here which are not represented in current traffic web sites.

Blog: Opera

I am looking at this blog in Opera 9.25 and I have to say it looks miles better that Firefox or IE8. The screenshots are way sharper and it’s actually rendering the bullet points which Firefox seems to have stopped doing. My spelling is no beter though.

I like Opera but it doesn’t render Google Maps very well (slow). Also I have had some flaky experiences with Flash 9 although it was pretty zippy when I tried out the Modest Maps demo.

I have updates to make to the iFrame courtesy of ‘Max’ who has added the ability to render to a div (thanks Max). Also I recieved an email saying the Modest Maps demo wasn’t deleting markers which I discovered is a bug in the MM code. I fixed this but if you have access to Flex Builder you will discover it anyway You have to change:


public function putMarker(id:String, location:Location, marker:DisplayObject=null):void
{
if (marker)
{
marker.name = id; // ***THIS IS MISSING LINE***
//if (marker.name != id) throw new Error("marker name must match id");
markerClip.attachMarker(marker, location); // calls grid.putMarker as well
}
else {
grid.putMarker(id, __mapProvider.locationCoordinate(location),
location);
}
}

According to Sinisa the deletion is ‘dog’ slow which is not good news if you need to plot and replot lots of markers.

Merry Christmas to everyone who reads this blog. I know there are a few who drop in from time to time as I look at the stats.

gTraffic is due an update maybe I’ll find the get up and go to get back into GWT and fix it’s shortcomings.

flexTraffic was a bit of an experiment. I would retire the GWT version of the site if the web stats weren’t so high. What I need to do is to recompile with a link to the Flash version. I spent a lot of time on the Python scripts..lots of time..being totally bloody minded and attempting to wrestle the TPEG xml down to something usable. More time than I spent writing the sites (html initially).

Python was my first exposure to a dynamic scripting language. I had used javascript before but I was using it in a way like a glue around what I was doing with html. If you are a java only or C++ programmer time to steer away from the shore and find yourself a project to try this stuff out. I may expand on this mibbe on later posts.

gwt-yui-ext is to be retired (as in deleted from Google Code) on 1st Jan 2008. It was fun and a good learning experience but it quickly turned into land of the ‘edge-case’ nightmares. My advice…don’t try and wrap a large javascript library with GWT it can’t be done successfully without a massive effort to chase a moving target. Better to try a small component like the Simile timeline. Good luck to the next guy. You will need it.

gTraffic: Problems

Aaaargh. I have just checked out gTraffic and there seems to be a problem. There are no events on the map! The weekend is upon us so I hope to find time to see what the problem is. In the meantime if you want to know what’s happening with UK traffic then checkout this.

Simile Timeline : Update

Well it’s been a while but I have finally got around to making an update to the gwt simile timeline. I had a request back in Dec last year (06) to add in the ability to load XML directly from a text string instead of having to use the AJAX loading mechanism. I thought it would be easy but when I went to look at it it turned out to be a bit involved.

Basically the event source object, which is the object which holds the data for a timeline, expects an XML document object to be supplied to load the data from. The AJAX call back mechanism automatically generates such an object in the request.responseStream of HTTPRequest object. Generating one of these from xml text isn’t straightforward as each browser has a different way to do it and you don’t have access to whatever magic the HTTPRequest is doing under the covers to create one.

I have had to add in a couple utility functions (see TimelineHelper.js in the code). This has been tested with Firefox, IE7 and Opera. I have no idea if it will work with Safari, I suspect not.

So, there are new calls to the EventSource object


public void loadXMLText(String xmlText)
{
    EventSourceImpl.loadXMLText(xmlText, GWT.getModuleBaseURL(), this);
}

and


public void loadJSON(String json) 
{
    EventSourceImpl.loadJSON(json, GWT.getModuleBaseURL(),this);
}

The loadJSON was a user contrubution from the Google Code site (thanks jdwyah whoever you are).

I started off writing a fancy JSON callback implementation then I realised that there are enough AJAX callback frameworks out there to handle however you want to get your data into the application so I haven’t put anything like that in. It just clutters up the interface anyway.

Look at the function processTextData in the DataHandler.java class to see an example of calling loadXMLText. It really couldn’t be easier.

I have bundled the latest MIT Simile timeline javascript code in with the source code zip. Keeping this locally makes the timeline boot up faster. Just be aware of this in case you have your own altered version.

gwt-yui-ext #3

I see that there are a number of issues building up around the gwt-yui-ext library. I am going to try and spend some time this weekend addressing them.

I am going to stop working on the edit grid for now as I can’t find a way to implement the localised editor functions for the cells. Not a way that GWT can do it in a java fashion anyway. This is most annoying as there is a fair bit of the usage done.

There is a push on just now over at the yui-ext site to get Ext out the door. I have recieved requests as to whether I will be wrapping this and I have to say for now, no. It will have to get to a stable condition before I could attempt it and even then I think it will be too much work for me to take on.

The existing yui-ext library as far as gwt-yui-ext is concerned will forever be 0.3.3. This doesn’t discount it’s usefulness though there are limitations which I am starting to see now that people have been using the trunk code.

Project Updates #1

After getting gwt-jsviz out the door I feel it’s time to take stock of my current list of on-going projects.

    gwt-jsviz

The gwt-jsvix API wrapper was something that I had been putting some time into on and off for quite a while so I am glad to have the first revision up and running. Already I have found stuff that I want to put into it. It’s just a case of getting round to it. The first version is purely a wrapper for the existing code, nothing else. I have a tabbed version of the demos but there is issues with this that I can see are going to take a wee while to resolve so anyone who wants to use this with GWT will have to stick with the vanilla version for now. It might seem a strange thing to bring to GWT but as soon as I saw Kyles demo of the music mashup I could see the potential for applying this to a combination of the Yahoo REST search API and the Timeline.There, I have given the game away and now someone will beat me to it. I am not surpised that Kyle Scholtz has been snapped up by Google as he is clearly a clever guy.

    gwtsimiletimeline

I am quite proud of this as it was my first open source project and it’s probably the most complete. The core javascript ‘widget’ is beautifully written by the guys at MIT and it’s no surprise that it was relatively easy to wrap up and slots into GWT with very little effort. I have received a request to enable the timeline to read it’s XML from a text string and this is what I hope to put some time into. My gut feeling is that it’s ‘doable’ and will extend the core component in pure GWT fashion.

    gwt-yui-ext

This is the most interesting (and time consuming) of all the GWT wrapper API’s I have attempted. I had a look at the source javascript, at the time I was writing the timeline stuff, and concluded that it was ‘doable’. In reality this has the the most real GWT code of them all as the way that it works involves manipulating the RootPanel DOM to hook into GWT.

I started off with the most complex of the demos the BorderLayout. This proved a good idea as a lot of what I gleaned from doing this went into the BasicDialogPanel and LayoutDialogPanel.

I have focussed on the original demos as this is the acid test for wrapping them to the GWT platform. There is still work to do on the current list of demos which is why I haven’t put them into a new release. Anyone wanting the code for these should just go to the source trunk and get the latest source image.

I am a bit undecided on the targets for this library. There are a a few bugs in the current demos which need addressing so I think I will try to get those fixed for now.

    WORK IN PROGRESS

– gwtsimiletimeline: Timeline to read text XML

– gwt-jsviz: JSViz to have tabbed example.

– gwt-yui-ext:
. DialogPanel and LayoutDialog have bug where the background can become the focussed view stopping any further interaction with the main dialog.
.There are issues with the resizable component namely, the transparent handles doesn’t work under IE and the animation for the control doesn’t work at all. I might drop some of this stuff from the next release.
.The grid need a better example of inserting data.
.The dialog examples need to show non-modal dialogs.

Not too onerous a list.

    Other Stuff

I had started to look at integrating Flex with GWT using the FABridge. I have big ideas for this but little time so we’ll see how it goes.

Also, I knocked together an example of integrating MapBuilder with GWT which I will get around to adding to the links on the top right in due time.

    In conclusion

I think that probably the best way to proceed will be to try and incorporate as much of this technology into the gtraffic site. It’s a great test bed and I can see ways that all this stuff could fit into it (yes even gwt-jsviz, just you wait and be amazed/baffled).

gwt-jsviz

I am pleased to announce that version 0.0.1 of th gwt-jsviz GWT Wrapper API has gone online.

JSViz is a javascript library which lets you create visualisations of data as a 2D graph of nodes.

The gwt-jsviz library is a GWT Wrapper API around the JSViz javascript.

You can find it here.

    Background

I had started a version of the GWT wrapper classes for a previous version of Kyles JSViz library but I was also working on a wrapper for the Simile Timeline control here.

I had a feeling I could integrate the timeline into the GWT Road traffic site I had developed so I was focusing on that.

Every time I came back to look at the JSViz wrapper code I was having to get my head around how it hung together again and it was slow going.

What kick-started development was when 0.3.3 of the JSViz library came out. I had a look over the code and realised that Kyle had redesigned it to separate the graph rendering into a few rtns. It was obvious to me that I could ditch most of the existing wrapper code I had generated and focus on hooking in the GWT layer into these callbacks. If you examine the source code you will see that each graph type only has to implement the IGraphRender interface i.e.

public interface IGraphRender
{
        public Layout create(JSVizWidget widget);

        public void render(JSVizWidget widget);

        // ------------------------------

        public NodeConfig model(DataGraphNode dataNode);

        public Element view(DataGraphNode dataNode, 
                   SnowflakeNode modelNode);

        public EdgeProperties viewEdgeBuilder(DataGraphNode dataNodeSrc,
                   DataGraphNode dataNodeDest);

}

The tricky bit was hooking into the javascript to install the callbacks. Have a look at ‘ForceDirectedLayoutImpl’ and ‘SnowflakeLayoutImpl’ classes to see how this works.

Not only was the design simpler but I though it would be cool if you could use GWT widgets instead of just pure ‘img’ elements. If you can make the nodes widgets then you can get all sort of goodies associated with GWT like tooltips, popup dialogs etc. The issue here was that I would have to write my own drag and drop handler for the widgets to track them on the view and update the JSViz data structures. This final code looks straightforward but it was probably the one piece of code I poured most of my time into getting to work and I think it’s still a little flaky.

    Demos

The ‘Random Circuit’ and ‘Snowflake’ demos are re-implementations of the ones from Kyles blog but done in GWT. The ‘Random Circuit – GWT Image Widget uses GWT Image objects for the graphics. It has an tooltip listener hooked into it which will display the image url when you pass the mouse over an image. The tooltip could be anything really I just used the url for the demo.

The important point about these demos is not that they are just fun to try out but in imagining what you can do with this sort of visualisation. The point of this project (in case you hadn’t got the point yet in all my rambling) is that you can put together a force directed or snowflake type graph in JAVA by implementing the rtns in
‘IGraphRender’ and deploy it as a web application. You can do it using a great tool like Eclipse where you can run and debug your application just like you would a normal app.

The demos are also linked to on the project page:

The original JSViz site is here.

gwt-yui-ext #3

There is a big update in the offing. I am working to get this into shape.

I really like the Google Code interface but can I just complain that it is ridiculously slow. The svn interface is like using a 56k modem and the web interface isn’t much better. I don’t know what sourceforge is like but attempting to use the svn interface is a frustrating experience.

Next Page →