mySociety

Home

mySociety Blog

Keeping up to date with mySociety developments

A big thankyou to Google.org – fabulous funding news

Written by on in Components, News

 

 

Growth by KayVee INC

We’re starting the year with some really wonderful news: Google.org is granting us a fantastic $1.6m, to be spent over two years.

Clearly, this is a significant sum of money, which will really turbo-charge our efforts to build technologies to help groups like mySociety in countries around the world. 

We will be using the money to provide developers with open source technologies to help them to more easily and quickly launch new civic apps and services. We will also be working with lots of other groups to promote greater knowledge and technology sharing amongst civil society groups of all kinds, especially in the accountability sector.

What’s the problem being tackled?

Currently, it can take a great deal of work to launch even relatively simple sites or apps with civic purposes, because the sector is not rich with mature, sector-specific tools and technologies. This high barrier to getting started has a bad effect on the range and strength of popular, impactful civic sites and apps online, globally.

Working with international partners we plan to develop some common, open source components that will reduce the effort required to launch new services in a broad range of areas: including accountability, legal, environmental, political, and more.

mySociety will work with local partners in various targeted regions to help those partners make the greatest possible benefit from using these new, common, collaboratively-developed open source components. And we’ll be working to help them contribute back, both in terms of shared code and shared knowledge.

The project will also develop new approaches to bringing together the global civic-technology community, so that it can collaborate more easily on new projects.

We’re really excited to see where this project will take us next – and we are very grateful to Google.org for the increased opportunities their funding brings us.

Photo by KayVee INC (CC)

Open311 – What is it, and why is it good news for both governments and citizens?

Written by on in Commentary, FixMyStreet, Local government

Open by Rupert Ganzer

The Internet has thrown up a host of challenges for governments, large and small. Most people are familiar with the problems presented by issues like hacking, but there is another challenge which probably worries local governments just as much.

The challenge is this – how can a local government cheaply and efficiently cope with the fact that the public wants to request many services through a rapidly expanding plethora of different channels – phones, websites, email, apps, and Twitter? And how can it keep control of costs when new channels are being invented all the time?

The good news is there’s an answer that can prevent each new channel leading to ever-greater costs – a free technology called Open311. The bad news is not many people know it exists, let alone how to use it, or how it works.

In this post, and two more to follow, we’ll explain how Open311 can help governments (and citizens), how it functions, and what mySociety is doing to make Open311 work a bit better.

Background – the status quo

At mySociety, we’ve been running services for years that send messages of different kinds to government bodies, on behalf of our users. Since the very beginning we’ve always been keen that any public servant or politician who receives a message via one of our systems gets it in a familiar form that doesn’t require any special knowledge or training to read or reply to. That’s why for the first few years FixMyStreet sent all its problem reports via email, WhatDoTheyKnow sent all its FOI requests via email, and WriteToThem sent all its letters to politicians via email and fax (remember fax?).

However, despite the fact that reading and responding to emails doesn’t require governments to procure any new technology or any new skills, these days this approach can clearly be bettered. Today, an email report of a broken paving slab will typically be received by a public servant working in a call centre. This person will normally cut and paste text from the email into a new database, or into a new email, before dispatching it for someone else to consider, and action.

Now, imagine that instead of this, a problem report about a broken paving slab could be sent directly from a citizen and placed into the electronic to-do list for the local government team who fix paving slabs. This would do more than just cut costs – it would make it much easier for the citizen to get sent a notification when their problem is marked as ‘resolved’ in the official database.

This is not an original idea. The team at mySociety are not the only people who think that enabling citizens to directly slot requests, messages and problem reports into local government ‘to do’ databases is desirable. In the USA a group of civic minded technologists at OpenPlans were concerned by the same issue. They decided to do something about it – and they launched a project under the banner of Open311.

Why ’311′?

In the USA a number of cities have non-emergency government telephone helplines, accessible at the phone number 311. As a consequence ’311′ has come to refer to more than just a phone line – it has come to mean the entire process of handling service requests from citizens around a whole range of non-emergency issues, from garbage to noisy neighbours.

To the ears of some American public servants the name ‘Open311′ consequently conjures up an image of a better, nicer more ‘open’ way of handling such non-emergency requests from citizens.

So what is Open311?

Beyond a brand, what is Open311? The answer is simple: Open311 is standardised way for computers to report problems (like potholes or fallen trees) to the computers run by the bodies that can fix them (like local governments or city departments). It’s an open standard that was started by the lovely people at OpenPlans, and which is now slowly iterating with the help of people inside and outside of governments.

In other words, Open311 is the mechanism through which citizens can slot their service requests directly into the computerised ‘to do’ lists of local government staff, and the way they those citizens can get back progress updates more quickly and easily.

Why is an Open Standard a good thing?

An open standard is just a way of communicating that anyone can implement it, without paying any money for permission to use the technology. The good thing about open standards is that once several technology systems start using the same ones, different systems from different manufacturers can talk to each other. When you phone someone else’s telephone, you are using an open standard – this means you don’t have to have the same brand of phone as the person at the other end.

What this means for a government is that if you can make your database of pothole reports speak to the outside world using Open311 then you don’t have to worry if reports are coming from two, ten or a thousands different websites or apps. You just run one system and it copes with all of them. This is not actually a new idea at all – local government call centres don’t worry what telephone network people are phoning from, or what brand of phone they are using.

However, it is a new idea in the realm of government IT systems for storing things like pothole repair requests, or school-admission applications. Traditionally these systems have not been set up to speak a common language with the outside world. Unfortunately, this failure to speak a common language has not always been by accident. Unscrupulous suppliers will sometimes intentionally set up systems so that the government has to pay extra money if they want any new channels to be added. Using Open311 is both a way to lower your future costs, and a way to make sure your current supplier can’t lock you into expensive upgrades.

Isn’t opening our systems to the outside a security nightmare?

Open311 is not about opening up private data, such as exposing the home addresses of vulnerable children. Open311 can be configured to open up government systems where that is appropriate, and everything that needs to stay private will stay private. There are no fundamental security problems to using an Open311 system.

Is this just about pothole reports?

No. Open311 isn’t limited to street-fixing services like FixMyStreet, even though that kind of problem is where Open311 started. As more and more public bodies offer their services online, they all face the same problem of spiralling costs as the public demands access through more and more diverse channels. In the future it should be possible to renew parking licenses, pay local taxes and do other complex transactions via Open311. But for today we encourage everyone interested to start at the simpler end of the scale.

How does mySociety use Open311?

When a local government anywhere in the world contracts mySociety to deliver a version of FixMyStreet for them (like BromleyBarnet and Stevenage ) we recommend Open311.

We will still happily connect FixMyStreet to systems that don’t use Open311, but we always explain to clients that Open311 is the most desirable way of connecting their new FixMyStreet deployment with their current problem databases. We even offer lower prices to governments who use Open311.

We offer lower prices this partly because our costs go down, but also because we want to leave local governments with street-fault reporting systems that can connect not just to FixMyStreet, but to any new services in this area that emerge in the future. If Google maps or Twitter suddenly add street fault reporting, why should the local governments have to pay more money to handle those problems, when it could get them for free using Open311?

In short, we see Open311 as a solid foundation for building local government services without locking our clients into a relationship with mySociety as suppliers. In future we will also recommend the use of Open311 for services like ‘Please send me a new recycling bin’, ‘Please tell me what jobs you have open’ and ‘Please answer this FOI request’.

In the next post we’ll cover how Open311 works in a bit more detail (but still as clearly as we can), and in a third post we’ll explain how our work with FixMyStreet for Councils has led us to propose some improvements to the Open311 standard.

Photo by Rupert Ganzer (CC)

New vacancies at mySociety

Written by on in Job adverts

Now Is A Good Time To Explore by Minivan Ninja

What’s on your Christmas wishlist? If ‘a meaningful job’ is high on the list, then we’ve got important news for you. We’re looking for talented, passionate and diversely skilled people to join our team.

In 2013, we’ll be pushing out internationally, improving our core UK sites and doing more commercial business. And we need some more lovely, dilligent people to help us.

All the details are on our jobs page. There’s plenty of time to get your application in, so why not give it some thought over the mince pies?

Not quite for you? Then please tell your nicest friends!

Photo by Minivan Ninja (CC)

Looking back: our experience of the Google Summer of Code

Written by on in Components, Developers

Summer may seem like a long time ago, but despite the cold outside, we’ve been looking back over our participation in Google’s Summer of Code project. It’s almost enough to warm us up!

This post is an attempt to record the process from our point of view. We hope it will be useful for other organisations considering participating next year, and for students who want to know more about how the scheme works.

What is Google Summer of Code?

It’s a programme sponsored by Google’s philanthropic arm, giving students the chance to experience real-life coding on open source software.

The scheme is open to students all over the world, who are then paired up with open source organisations like us. The students gain paid work experience and mentoring; the organisations gain willing workers and some fresh new perspectives; the world gains some more open source code to use or develop further.

Everyone’s a winner, basically.

The beginnings

2012 was our first year on the programme: once we had been accepted on the scheme, we were given two student slots – the maximum allowed for a first-time organisation.

Given mySociety’s wide suite of codebases, there were several projects that could have benefited. We listed all our ideas, and let people apply for the ones they found appealing.

Goodness, there were a lot of applicants! It was very heartening to discover that there is such an enthusiastic community of young coders all around the world – even if it did take us a long time to sift through them all and make our choices.

You might remember our post back in May, when we announced that we’d made our choices. We were delighted to get working with Dominik from Germany and Chetan from India.

The project

As things turned out, our students ended up working on a project that wasn’t even on our original list: PopIt, our super-easy ‘people and positions’ software.

That’s because once we spoke to our chosen students, we realised they had the skills that could really help us forge ahead with this project – and once we discussed it with them, they were keen. So PopIt it was.

Logistics

Germany and India are a bit of a commute away, but fortunately development work can be managed remotely. We know this particularly well at mySociety: our core team work from home and are scattered across the UK.

The only difference here was the 6+ hour time difference between us and India: it was important to be rigorous about checking in at times when Chetan would be awake!

We communicated via IRC (instant chat), email, and occasionally Skype, and it all worked well.

Edmund, the team member chosen to be mentor, broke the required tasks down into big pieces so that the students would have realistic work units of several days each.

What was achieved

PopIt is primarily a tool for helping people create and run parliamentary monitoring websites (like TheyWorkForYou) with minimal coding knowledge/effort, though we anticipate that it will have many other uses too.

Our students spent the first half of the summer learning and improving the PopIt codebase. Once they were confident in it, they created their own sites using PopIt as a datasource to test the API, and, hopefully, create a valuable reference resource for the community.

Dominik added a migration tool to PopIt, which lets you upload data as a CSV. This means that you can start a site with a database of names, positions and dates at its heart – within seconds.

His test site was a professors’ database (the code is here and the site is here). Dom also wrote some helpful posts on the dev blog like this one.

Chetan created an image proxy that lets us serve images in a smart way that makes sense for APIs. His test site was for Indian representatives (here’s the code, and the site is here).

Neither site is being maintained now, which just confirms that it is harder to run a site than to start it. This is not a failing, though. The creation of these sites, along with Chetan and Dom’s feedback, helped us understand where improvements needed to be made. In the course of one summer, PopIt became much more mature.

Looking back on the Summer of Code

Edmund attended a follow-up ‘mentors’ summit’ at the Googleplex in California – he found it very helpful to compare notes with other organisations and find out what had worked best for them all, and he made some good contacts too.

Assuming we get the chance again, would we participate in 2013? Our experience was very positive, but as yet we are undecided, purely because of the fluid nature of our workflow: we don’t yet know whether time and resources will permit.

Obviously, we have enjoyed great benefits from the scheme, but that has depended on quite a bit of input from our side, and we need to be sure that we can ensure that happens again.

Edmund has compiled a list of advice, from the practical (ask students to treat the placement like a full-time job; test coding skills before acceptance) to the desirable (a weekly blog post from participants; make sure you over-estimate the time you’ll spend mentoring). If you’re thinking of participating next year, he’d be happy to pass on his tips for ensuring that you, and your assigned students, get the best out of the Google Summer of Code. Just drop him a line.

mySociety Christmas Pub Meet

Written by on in Events

Inside the Prince Edward, Bayswater, London W2 by Kake Pugh

We hope friends, supporters and indeed anyone who fancies it will join us for a festive drink at the Prince Edward pub in London’s Notting Hill.

When? 7.30pm onwards, Tuesday 11th December.

Where? 73, Prince’s Square, W2 4NY. Google Map

Who? Everyone’s welcome.

Why? Come and chat about any of our projects, becoming a volunteer, new ideas you have – or just enjoy a drink.

You can add your name, and see who else is planning on coming, on our Lanyrd page.

 

Image (CC): Kake Pugh

mySociety is inviting people to become trustees of its parent charity

Written by on in News

Summary

mySociety is looking to recruit new trustees to help us, as we transition from being a small digital non-profit into a mature international social enterprise.

If you are interested in helping to guide one of the earliest ‘digitally native’ charities through to its next stage of growth, this may be an opportunity of interest to you.

Our mission is to discover how technology can (or cannot) help make people more powerful. As a team and a community we are driven by a desire to build tools that help people exert a little control over the world around them – especially people who have never tried to do so, and who don’t think they would succeed if they tried.

If that is a goal that motivates you in the way it motivates our staff and volunteers, we should have a conversation.

What is a trustee?

Trustees oversee charities to ensure that they are well-run, solvent, operating within the law, and making the right strategic decisions. These are unpaid roles with an ultimate legal responsibility for the charity. To understand more about what being a trustee means legally, please see this introduction from the charities commission.

mySociety is the public brand of the registered charity UK Citizens Online Democracy: the positions we are advertising for today are trustees of that charity.

As a UKCOD trustee, you will advise on the organisation’s priorities, help with the approval of budgets and staffing, and assess legal matters. In concrete terms, that means attending meetings in London every three months, and dealing with the associated emails and documents – a commitment of about six hours per month.

History

Between 2003 and the present day, mySociety has built and grown a series of British democratic and civic websites and apps, including FixMyStreet.com, WhatDoTheyKnow.com, WriteToThem.com and TheyWorkForYou.com.

In the last two years our organisation has experienced a great deal of growth, with our staff tripling in number (to nearly 20) and our objectives becoming ever more international. This is largely due to major investments by groups like the Omidyar Network and the Open Society Foundation, as well as an increase in our commercial software and consultancy services, which generate about half our revenues.

Future Challenges

We have numerous challenges to face as we approach our 10th birthday, in late 2013.

  • How do we balance the need to maintain and improve the quality of UK services, whilst working increasingly in other countries?
  • How do we ensure that the people trying to build copies of the services we run in other countries succeed in adapting them to very different environments?
  • How do we become a successful, substantial social enterprise that can drive quality improvement and higher ethical standards across the entire government IT sector?
  • How do we do all this whilst ensuring that the high standards of talent – and niceness – of the people within our organisation do not slip?

What we’re looking for in trustees

mySociety is still small enough that it often needs very practical support from the trustees, such as opinions on legal matters. This means we need trustees equally comfortable with big questions and small ones.

We are interested in acquiring trustees from a range of different occupational backgrounds. If you have skills in any of the disciplines listed below, you could really help us.

  • Marketing
  • Campaigning and community organising
  • International development
  • Human resources
  • Legal
  • Governance structures
  • Digital product development
  • Finance
  • Local Government
  • Advertising
  • Quality assurance

We also welcome applications from mySociety volunteers, whether past or present.

Timelines

We will be happy to meet people and arrange phonecalls for no-commitment discussions up to 21st December 2012. Please contact abi@mysociety.org if you would like to book in a conversation with someone who could tell you a bit more about the role.

If you would actually like to apply, please send a CV and covering letter, explaining why becoming a trustee is of interest, to abi@mysociety.org by 5th January 2012 latest.

We will conduct interviews on Monday and Tuesday 21st and 22nd January – we can arrange them in the evenings if that is necessary.

We will notify applicants of our appointment decisions on Monday 28th January.

Dear Ninja Campaigner Geek: Why I work on non-partisan tech, and why I encourage you to take a look

Written by on in Commentary

The last few weeks since the US election have seen an explosion in articles and blog posts about how Obama’s tech team pulled out the stops in their race against the Republicans. It’s been an exciting time to learn about the new techniques dreamed up, and the old ones put to the test.

For those of us who develop non-partisan services to help people report broken street lights or make Freedom of Information Requests, such stories certainly seem unimaginably glamorous: I don’t think any of my colleagues will ever get hugged by Barack Obama!

But it has also been an interesting time to reflect on the difference between choosing to use tech skills to win a particular fight, versus  trying to improve the workings of the democratic system, or helping people to self-organise and take some control of their own lives.

At one level there’s no competition at all: the partisan tech community is big and economically healthy. It raises vast amounts of cold hard cash through credit card payments (taking a cut to pay its own bills) and produces squillons of donors, signers, visitors, tweeters, video watchers and so on. The non-partisan tech community is much smaller – has fewer sustainable organisations, and with the exception of some big online petitions, doesn’t get the same sort of traffic spikes. By these metrics there’s absolutely no doubt which use of tech is the most important: the partisan kind where technology is used to beat your opponent, whether they are a political candidate, a policy, company, or an idea.

But I am still filled with an excitement about the prospects for non-partisan technologies that I can’t muster for even the coolest uses of randomized control trial-driven political messaging. The reason why all comes down to the fact that major partisan digital campaigns change the world, but they don’t do it in the way that services like  eBay, TripAdvisor and Match.com do.

What all these sites have in common – helping people sell stuff they own, find a hotel, or a life partner – is that they represent a positive change in the lives of millions of people that is not directly opposed by a counter-shift.  These sites have improved the experience of selling stuff, finding hotels and finding life partners in ways that don’t attract equal and opposite forces, driven by similar technologies.

This is different from the case of campaigning tech: here a huge mailing list is pitted against another even huger mailing list. Epic fund-raising tools are pitched against even more epic fund-raising tools. Orca vs Narwhal. Right now, in US politics, the Democrats have a clear edge over the technology lined up against them, and I totally understand why that must feel amazing to be part of. But everything you build in this field always attracts people trying to undo your work by directly opposing it. There is something inate to the nature of partisanship which means that one camp using a technology will ultimately attract counter-usage by an opposing camp.

This automatic-counterweighting doesn’t happen with services that shift whole sectors – like TripAdvisor did. In the hotel-finding world, the customer has been made stronger, the hotel sector weaker, and the net simply doesn’t provide tools to the hotel industry to counter what TripAdvisor does.

It is this model – the model of scaleable, popular technology platforms that help people to live their lives better – that I aspire to bring to the civic, democratic and community spheres in my work. Neither I nor mySociety has yet come up with anything even remotely on the scale of a TripAdvisor, but there remains the tantalising possibility that someone might manage it – a huge, scaleable app of meaningful positive impact on democratic, civic or governance systems*. Our sites are probably about as big as it gets so far, and that’s not big enough by far.

If someone does manage to find and deliver the dream – some sort of hugely scalable, impactful non-partisan civic or democratic app & website, it is unlikely that the net will instantly throw up an equal and opposite counterweight. There is a real possibility that the whole experience of being a citizen, the whole task of trying to govern a country well will be given a shot in the arm that won’t go away as soon as someone figures out how to oppose it. I’m not talking Utopia, I’m just talking better. But what motivates me is that it could be better for good, not just until the Other Team matches your skills.

And that – in rather more words than I meant to use – is why I am still excited by non-partisan tech, and why I really hope that some of the awesome technologists who worked in the political campaigns of 2012 get involved in our scene.

I’m on Twitter if anyone wants to talk about this more.

*  You can certainly make an argument that Twitter and Facebook sort-of represent non-partisan democracy platforms that have scaled.  But some people disagree vehemently, and I don’t want to get into that here.

 

 

 

Mapumental’s Secret Sauce: A Map Overlay Rendering Technology You Might Find Interesting

Written by on in Free Data, Mapumental, Technical, Travel Time Maps

I am Duncan Parkes,  a developer for mySociety, a non-profit full of web geeks. One of the things we try to do well here is to take complicated data and turn it into really usable tools – tools which are attractive to people who aren’t web (or data) geeks.

For some considerable time I’ve been working on Mapumental – a project that is about turning public transport timetable data into pretty, interactive maps featuring isochrones, shapes that show people where they can live if they want to have a commute of a particular time. You can play with the new version we just launched here. That particular map shows the commuting options to where the Queen lives. Slide the slider for full effect.

There are a couple of hard problems that need solving if you want to build a service with an interactive journey times overlay like this. You need to be able to calculate a *huge* number of journeys extremely quickly, and you need to be able to make custom map layers so that it all looks nice. But what I think might be most interesting for you is the way in which the contours get rendered on top of the maps.

It all started about three years ago, when the first version of the app – co-developed with the geniuses at Stamen – used Flash/Flex to draw contours on the maps, and to let people play with them. You can still play with a couple of versions of that technology from way back in 2007, that is, unless you’re using an iPad or iPhone, which of course don’t do Flash.

Colour Cycling

What was going on inside this Flash app was as follows. We needed to show the user any one of hundreds of different combinations of journey times (5 minutes, 12 minutes, 56 minutes, etc) depending on where they set the slider. Sending each one from the server as a tiled map overlay would be dead slow. Even Google – who have chosen to send new tiles each time – end up with a service which is surprisingly slow (try choosing a different time on this map).

With some help from Stamen, we decided that the way of making it possible to show many different contours very quickly was send the client just one set of tiles, where each tile contained all the data for a variety of journey times. What does that mean? Simple: each colour in the tile represented a different number of minutes travelling on the map. So a batch of pixels that are colour X, all show places that are 15 minutes from the centre of the map.

So, in this old Flash system, when you slide the slider along, the Flash app makes some of the coloured pixels opaque, and the others transparent. It was, in short, a form of colour cycling, familiar to lovers of 8 and 16 bit computer games.

However, from about 2010 onwards, the march of iOS spelt the end of Flash. And that meant that we couldn’t launch a shiny new site based on this technology, as lovely as it was. We had to work out some approach that would use modern web standards instead.

The Death of Flash Makes Life Difficult – for a while

How do we replicate the experience of dragging a slider and seeing the map change like in the original Mapumental demo, but without Flash? One of the things that made the original Mapumental nice to use was how smooth the image changes were when you dragged the slider. Speed really matters to create that sort of organic effect that makes the demo so mesmerising.

So as we started to tackle the question “How do we make this work in a post-Flash world?”. And the first thought was “Let’s do away with those map tiles, filled with all that journey time data!”. After all – why send any tiles to a modern browser, if it can just render nice shapes on the fly?

So we had a go. Several goes. At first we tried rendering SVG circles around each public transport stop – but that was too slow, particularly when zoomed out. Then we tried rendering circles in Canvas, and whilst that was OK in sparsely populated places it sucked in the cities, where people would actually want to use it.

Eventually, we decided that as wonderful and powerful as modern web rendering techniques are, if you exclude WebGL (on the grounds that so few people have it still), all the current techniques result in pages that just hammer your browser, whilst producing an experience which isn’t up to our previous Flash-based standards. To see this in action, see the wonderful Mapnificent site, developed by the super talented Stefan Wehrmeyer. He’s a great guy and a friend of mySociety, but the Javascript circle rendering just grinds, and that’s with far, far fewer data points than we have in our system. (Sorry for potentially crashing your browser there. This is in the interest of Science.)

Back to Colour Cycling – Using Web Standards

So, we thought, why not look again at colour cycling the pixels within pre-rendered map tiles? After all, there are some examples out there, like this waterfall, all in Javascript.

So, I had a bit of a look at the waterfall. It seems to work by holding in memory a structure which has all the pixels which change and all the colours they should change to and when. This works beautifully for the waterfall picture, but only a limited number of the pixels in that image actually change colour, and the image is quite small. For a full screen web browser with a big map in, this didn’t seem promising, although I’d love to see someone try.

Then I thought: browsers have always been very good at displaying images quickly – that’s sort of vital. Perhaps we could get our tile generating server to output PNG images where, as before, the colours represent travel times, but using a palette. Then by putting this in a canvas layer in the JavaScript mapping framework Leaflet, and by changing the palette of the images on the canvas as the slider is dragged, we could get our animation.

Unfortunately, there is no way to change the palette of an image that you’ve put on the canvas. In fact, there’s no way to change the palette of an HTML img element: all you can do is assign it a new src attribute.

But this gets back to the original problem – we don’t want to download new mapping for every different position on the time slider. We definitely can’t afford to have the client downloading a new image source for every tile whenever the slider is moved, so we had to find a way to make that src at the client end and get that into the src attribute.

The Breakthrough – Data URIs and Base64 encoding

So we started trying data URIs. For those of you not familiar, these allow you to put a whole object into your HTML or CSS, encoded in Base64. They’re commonly used to prevent pages having to make extra downloads for things like tiny icons.

So I thought, “Here’s a way we can set an image src in JavaScript to something we’ve calculated, rather than something we’ve downloaded.” And this turned out to be the key insight that allows for the relatively smooth, attractive overlays you see in Mapumental today.

My new plan was that the client, having downloaded each palette-based image, would make a Base64 encoded version of it, which it could then use to build a version with the right palette and assign this as a data URI of the tile.

However Base64 encoding all these images in the JavaScript seemed like unnecessary processing to do there, so the final evolution of this technique was to do the Base64 encoding at the tile server end, and while we’re at it, not to bother sending over the parts of the image that we always replace at the client end.

So in summary, what we built does this:

  1. The server calculates the journey times and renders them to palette-based tiles.
  2. It sends these to the client, encoded in Base64, and with the initial bits up to the palette and transparency chunks removed.
  3. At the client end, we have a pre-prepared array of 255 ‘starts’ of PNGs that we combine with the later parts of the ’tiles’ from the tile server to make data URIs.
  4. When you drag the slider it combines the appropriate ‘start’ of a PNG with the bulk of the tile that has been downloaded from the server, and assigns that to the src attribute of the tile.

And that’s how the nice overlays on Mapumental work. But as so often in coding, the really interesting devil is in the detail – read on if you’re interested.

Diving into Base64 and the PNG file format – The Gnarly Bits

So – why are there 255 of these ‘starts’ of these PNGs, and what do I mean by a ‘start’ anyway?

PNG files are divided up into an 8 byte signature (the same for every PNG file) and a number of chunks, where each chunk consists of 4 bytes to tell you its length, 4 bytes of its name, some data, and 4 bytes of cyclic redundancy check. In this case, what I call a ‘start’ of a PNG is the 8 byte signature, the 25 byte of the IHDR chunk, and the PLTE (palette) and tRNS (transparency) chunks. The PLTE chunk has 12 bytes of overhead and 3 bytes per colour, and the tRNS chunk has 12 bytes of overhead and 1 byte per colour.

Base64 encoding is a way of representing binary data in text so that it can be used in places where you would normally expect text – like URIs. Without going into too much detail, it turns groups of 3 bytes of binary gumpf into 4 bytes of normal ASCII text without control characters in it, which can then be put into a URI.

Why do we have 255 colours, rather than the maximum 256 which are available in a palette? Because we need the break between the end of the tRNS chunk and the start of the IDAT chunk in the PNG file to align with a break between groups of three bytes in the Base64 encoded image. We need the length of these starts to be a multiple of 3 bytes in the original PNG format, which translates into a multiple of 4 bytes in the Base64 encoded version, so we can cut and shut the images without corruption.

Which just goes to show that even though web GIS technologies may feel like they are approaching a zenith of high level abstraction, there’s still some really gnarly work to be done to get the best out of current browsers.

Mapumental Property Launches

Written by on in Launches, Mapumental, News, Travel Time Maps

If you’ve been following mySociety for a while, you’ll know that we have been interested in making maps that show commuting times for several years.

However, we’ve never made public a simple, free, useful version of our slidy-swooshy Mapumental journey times technology. Until today.

Today we pull the wraps off Mapumental Property , a house-hunting service covering England, Scotland and Wales, designed to help you work out where you might live if you want a public transport commute of a particular maximum duration. Have a go, and we guarantee you’ll find it an oddly compelling experience.

We think it’s a genuinely useful tool – especially since unlike some of the other players in this space, we’ve got all the different kinds of public transport, right across the whole of Great Britain. We hope that some of you will find it helpful when deciding where to live.

However, this launch doesn’t mean mySociety is bent on taking over the property websites sector. Mapumental Property isn’t a challenger to the likes of Rightmove, it’s a calling card – an advertisement for our skills – which we hope will help mySociety to attract people and organisations who want beautiful, useful web tools built for them.

In particular we’d like people interested in Mapumental to note that:

  • We like to build attractive, usable web tools for clients of all kinds.
  • We know how to use complex data to make simple, lovely things.
  • We can do some mapping technology that others haven’t worked out yet.

If any of that is of interest, please get in touch, or read about our software development and consulting services.

I’d like to thank quite a few people for helping with this launch. Duncan Parkes was the lead developer, Matthew Somerville ably assisted. Jedidiah Broadbent did the design. The idea originally came from the late Chris Lightfoot, and me, Tom Steinberg. Francis Irving built the first version, and Stamen came up with the awesome idea of using sliders in the first place (and built some early tech). Kristina Glushkova worked on business development, and Zoopla’s API provides the property data. I’m also grateful to Ed Parsons of Google for very kindly giving us a hat tip when they built some technology that was inspired by Mapumental.  Thanks to everyone – this has been a long time coming.

We’ll follow up soon with a post about the technology – and in particular how we got away from using Flash. It has been an interesting journey.

mySociety Launches FixMyStreet Platform Version 1.0 – Testers and Translators Sought

Written by on in FixMyStreet, Launches, Technical

FixMyStreet logo (square)Today sees the official launch of FixMyStreet’s open source codebase as a proper tool that we hope people will want to deploy in cities and countries around the world. It is based on FixMyStreet.com which we believe is the most usable, most mature street problem reporting tool in the world, but which is only available to British users.

We’re shouting about this launch a bit because we need your help to make the service ever better. First, we need feedback from programmers about whether we’ve got the install process right – whether it’s as easy and clear as we want it to be. And for non-coders who want to get involved, we want to ask for help with the process of translating the site’s text into different languages.

Over the years there have been many copies of FixMyStreet set up in many countries, often using the site’s original name, but always written by developers from scratch. We’re delighted to have inspired people, but all too often the people trying to build copies have stumbled as they realise just how hard it is to build a tool like this with the polish that users expect. We think that people everywhere would be better off if they could have a local FixMyStreet that was really usable, and really connected to the right people.

So we’re very happy to be able to open up a codebase that has been extensively modified in the last year, to help users around the world manage easy, successful deployments. Steps we have taken include:

  • Putting the translation text into Transifex, so that non-technical translators can get started whenever they feel like it
  • Developing Amazon Machine Images so people who want to tinker can get started in the minimum possible time
  • Rewriting the entire codebase in order to make it a less confusing installation
  • Building a global version of our MapIt political boundaries web service, so you can get going without having to wrestle administrative data out of your government before you get started.

Plus with the help of the wonderful OpenStreetMap, you can get maps without licensing hassles too.

Calling it version 1.0 is our way of saying two things. First, that the tool still has a lot of evolution left to do, and a long way to go before it is as good as we want it to become. But more ambitiously, calling it 1.0 is also our way of saying that it’s no longer just a codebase dumped into Github. It’s a real open source project, which we plan to support, and which we hope will make a real difference in the lives of ordinary people. Check it out.

RSS feeds

Categories

Recent Posts