Tales of Hyperlocal Development in Horsham, West Sussex

Independent Hyperlocals: Time to unite and start sharing?

by DotNetWebs 3. April 2011 20:25

Having just returned from the excellent Talk About Local 'unconference' I have been giving some thought to the two main themes that continually cropped up during the various conversations I had throughout the day:

  • What can independent hyperlocals do to help each other?
  • How can non-developers make use of data that is published in raw formats?

I have also recently blogged about my idea of a Common Hyperlocal Data Model and the success I have had in obtaining and processing Hyperlocal Car Park Data.

So to get the ball rolling I thought I would offer to share my work with car park data and attempt to make it available to non-technical users.

Here's the idea: If other hyperlocals can obtain Datex2 car park data from their own local authorities - I will attempt to process if for them and make it available as a JavaScript 'widget' that can be simply cut and pasted into their own websites / blogs etc.

Initially I would be happy to try this as a 'proof of concept' using my own resources. Obviously once the overhead started affecting the performance of my own sites I would not be able to continue to meet the demand, but then perhaps we could consider setting up a jointly owned server with contributions coming from those that use it.

Anyway this is just an idea to 'kick things off'. Hopefully other independent hyperlocals have some thoughts of their own...

Tags:

Hyperlocal Data Model

by DotNetWebs 13. March 2011 21:00

Visit Horsham Data Model

The much-simplified data model at the core of Visit Horsham is shown below:

The Zones in the model correspond to the coloured zones on the map below

The coloured zones visible on the map represent distinct area within the town centre.

Two additional zones are included in the text-only links. These extra zones represent the Horsham Suburbs and Horsham District.

A Common Hyperlocal Data Model?

We have been thinking about how we could apply this model to adjacent or complimentary towns. The obvious thing to do would be to have an additional level above the 'Zone' that represented the town itself.

If other towns were to share a similar data model then our searches could be extended beyond our own data to that of neighbouring towns.

If independent hyperlocal developers could agree on a common data model then perhaps they could also agree on a common API to exchange data between disparate hyperlocal applications.

Tags:

Hyperlocal Car Park Data

by DotNetWebs 10. March 2011 13:56

Why Car Park Data?

In addition to its obvious uses, one of the things that interested me about car park data was the fact that it can be used as a rough indicator of the level of current activity within the town centre.

Was the Data already available elsewhere?

West Sussex County Council had for some time displayed live car park data on their Travel Information website but the "Car Parks" page defaulted to Crawley and would only display Horsham data if a dropdown list and submit button were actioned.

Consequently the Horsham data was virtually hidden from the search engines whereas searching for "Horsham Parking" on Google would return Visit Horsham as the top result.

It made sense to try and get the data displayed on Visit Horsham where it would be much easier to be found.

So how did you go about obtaining the data?

We had previously requested access to the data some years ago and let's just say our request foundered due to 'red tape'.

But hey, we were now in the era of the "Big Society" and we thought we would put it to the test!

By a fortunate coincidence, Horsham's MP is non other than Francis Maude: the cabinet minister in charge of delivering much of the Big Society agenda.

I sent an email to Francis Maude's office explaining our previous request and requested his help, and to his credit, within a few weeks had access to a new feed set up for 3rd party access.

What format is the data in?

The data is in DATEX II format which is a standard developed for information exchange between traffic information centres and service providers.

DATEX II is formatted as XML and the significant [car park data] fields of interest in this case are:

  • <latitude>
  • <longitude>
  • <carParkIdentity>
  • <carParkOccupancy>
  • <carParkStatus>
  • <occupiedSpaces>
  • <totalCapacity>

How did you parse the data?

The elements listed above are relatively deeply nested within the DATEX II document but it is a fairly straight forward job to parse them using ASP.NET and LINQ.

The image below shows how little code is required for the significant part of the main function I wrote to achieve this.

The basic steps are:

  • Retrieve the XML file by using a WebRequest and a HttpWebResponse
  • Create a XDocument by parsing the XML file
  • Create a IEnumerable<XElement> collection by calling the .Element() method on the XDocument
  • Once you have an IEnumerable<XElement> collection you can simply loop through it to extract the individual elements and convert them into your own types

Is that it?

Well not quite, but once you have a IEnumerable<XElement> collection of your own types you can easily run other LINQ queries to obtain specific results.

As well as the obvious properties that directly relate to the DATEX II element my 'CarPark' class also contains a static method that calculates the total occupancy of all the car parks combined. It is this method that drives the "Parking Status" box that is on every page of Visit Horsham

Conclusion

Finally getting live car park data onto Visit Horsham was a small but significant step.

Small: because technically it was not that challenging (thanks to the simplicity of LINQ!)

Significant: because it was obtained via a 'Big Society' request - hopefully setting a precedent for similar requests in the future

Link

visithorsham.co.uk/parking.aspx

Tags: , , ,

Hyperlocal Developer's Blog

I have frequently been asked "how did you go about that?" in relation to Visit Horsham features.

I thought it was about time I shared my experiences - and so this blog was born!