Skip to content

Potlatch 2 – vector background layers

Most people will have seen the Potlatch 2 post over at OpenGeoData a couple of months ago.

Work is progressing at a cracking pace and I think we had seven people hacking away at it in one way or another during WhereCamp EU (which was a really great event). The WhereCamp wiki has slides from the Potlatch 2 talk and notes from the hacking session.

Lots of great stuff has been added recently: really comprehensive relations support, more of the geometry basics, more UI, better stylesheets and presets, and so on. And of course two of the major new features, the user-friendly tagging system and the WYSIWYG renderer, have been up and running for a while and we’re continuing to refine them.

Today, I committed the majority of the work for the third big new feature, vector background layers. The idea behind these is to give people a better way of doing imports. Rather than importing everything direct to the server and expecting people to tidy it up afterwards, the idea is that map editors open a chunk of the imported data in Potlatch 2, then manually bring it in, taking the same amount of care that they would if mapping an area by hand. (Big chunk of code here if you like reading code.)

Thus far it allows you to open shapefiles hosted on the web: it’ll eventually let you open local files, .osm files, GPXs, all that sort of thing. As yet all the rendering/data model stuff is done, but not yet the ‘bring this into the editable layer’ function, which is the next task.

Loads more to come in the very near future, so do download the source and have a play – it’d be great to welcome you on board.


Streaming downloads

I’ve not been very good at keeping this blog up-to-date. The last posting was about Potlatch 0.11. In the five months since then, we’ve moved onto 1.2c, with some pretty massive improvements: offline editing, POI icons, online help, one-way arrows, a fix for the infamous Linux Flash Player Unicode bug, photo-mapping, the ‘inspector’ panel, a roundabout button and a whole load else. (You can see the full list over at the changelog.) And then there’s Potlatch 2, but that’s a whole other story.

But sometimes things change under the surface, and today was one of those days.

Potlatch doesn’t talk XML like other OpenStreetMap applications; it uses an efficient Flash protocol called AMF (Action Message Format) instead. AMF has some very cool features, and one of these is that it can stream data.

So we’re now using this. When Potlatch previously asked for data from the OSM server, the server would assemble it into one big chunk before sending that back. Now, it sends each way back as it fetches it from the database. The same goes for uploads; the server now responds to each uploaded way in turn, rather than waiting until the last one is done.

Sadly Flash Player still waits until the download is complete before displaying the ways. (It would be much cooler if ways were displayed one-by-one.) But there are still a couple of advantages.

Firstly, uploads in particular should be less likely to hang if there’s a regular flow of information back. Secondly, the server needs to keep less information in memory at any one time – quite a lot less if you’ve asked for a densely-mapped city at zoom level 14. This is a Good Thing for everyone as it makes the server faster.

Potlatch 0.11a

And another ‘behind-the-scenes’ update which is a big change technically but shouldn’t affect users much.

Potlatch itself now keeps track of nodes you’ve deleted. Previously, when you deleted some nodes from a way using Potlatch and then saved the way, Potlatch would just say to the server “here’s the new way with these nodes”. The server would then work out which nodes were in the way beforehand, and delete any that weren’t used.

Now, Potlatch says “here’s the new version of the way, and by the way could you delete these nodes please?”. So Potlatch is doing more and the server is doing less.

It should hopefully make things a little faster, as there’s now less for the server to do every time you write a way. But as ever there might be teething problems, so if you get an error message, do report it!

Potlatch 0.11

First post on this blog for a while – not so much as a result of inactivity, but rather, because OpenStreetMap has just moved to API 0.6 and that’s meant a lot of work for Potlatch to keep up.

Most of this is behind the scenes and won’t make any visible difference to the user. In particular, the “version number” of each node and way is now communicated back and forth between Potlatch and the server, to make sure that changes can’t get out of sync if two people are editing the same thing at once. It might sound simple, but it’s been quite a lot of work to mash that into Potlatch.

Then there was the problem where the server started storing relation members as ‘Node’, ‘Way’ and ‘Relation’ – rather than ‘node’, ‘way’, and ‘relation’. It’s at times like this that you want to hit the computer round the head and say “look, you know what I mean, just get on with it”.

However, it’s not all boring internal stuff, so here are some of the changes in the most recent Potlatch – 0.11. There’ve been various improvements over the last week so if you didn’t see them to begin with, look again; and there’ll continue to be more tweaks over the days and weeks to come.


Here’s the really good news!

Redrawing the map is now a lot faster in areas with relations – which is a lot of the world. In brief, when Potlatch 0.10 (and earlier) drew a way, it would look through all the loaded relations to see which ones the way was in. And then it would do the same for every node on the way.

It doesn’t do that any more. Each way now has a list of the relation it’s in; so does each node. The difference this makes to the speed is immense.

There are a couple of other speed improvements, too. Of course, Potlatch is still dependent on the speed at which the server sends map data; the new server has improved this, but times when lots of people are editing are still best avoided if you can.


An improvement in OpenStreetMap’s new API is that your work is grouped into “changesets” – a grouping of all the editing you do in one session. You can add a comment to the changeset, so that others can see what you did easily. To add a comment using Potlatch, once you’ve finished your edits, press ‘C’. Type your comment and click Ok.

This feature could be (and will be) further refined but it’s a good start for now.

“You have unsaved changes”

Firefox and Safari users have long been prompted if they close Potlatch while changes are unsaved, but this now works for Internet Explorer users, too.


The history feature (‘H’) is smarter, and can now detect small changes – typically just moving a node or two – made in other editors.

In particular, it now looks at the history of all the nodes in a way, not just the way itself. As a related improvement, Potlatch no longer saves a new version of the way itself to the database if only the nodes have changed.

Background layers

The options dialogue box has been improved for a clearer layout of background layers.

In addition, you can specify your own, custom layer if you have a set of ‘900913’ (spherical Mercator) tiles somewhere on the web. To do this, specify the full URL (including http://), replacing the z, y and x co-ordinates – in that order – with exclamation marks. For example,!/!/!.png – but don’t try to trace from Google, it won’t let you. (This was actually added in 0.10f.)

Error messages

Error messages from the OSM server are now shown to the user, rather than just blinking the warning icon. So if there’s a problem, you get to know about it (and can e-mail me in case it indicates a bug in Potlatch!).

More presets!

Most of the Potlatch development work recently has been updating it to cope with API 0.6, which is why there’s nothing very much visible right now.

But, hoorah hoorah, a slightly updated new version is now live.

The main change is that there’s more presets. Lots of them: addressing, landmarks, sports, and so on. Better still, the preset ‘group’ icon doesn’t reset itself every single time, so you don’t have to keep paging through. (Funnily enough, the hardest work was drawing the icons. I’m still not that happy with the lighthouse for ‘landmark’ – it’s ok if you know what it is, but probably not otherwise…)

Another change that UK mappers will appreciate is that NPE is now offered at zoom levels 13 and 15, not just 14. (Thanks to TomH for this one.)

And, as ever, there’s a couple of little fixes in there. Nothing major enough to merit a new version number though!

NPE – and that’s the lot

NPE coverage is now complete for England & Wales at zoom level 14. Just select Potlatch’s out-of-copyright map layer and it’s all there. Zoom levels 13 and 15 will follow next week courtesy of Tom Hughes.

Still more NPE

Potlatch’s out-of-copyright layer now has New Popular Edition maps for the whole of the south of England.

That means I’ve now finished rectifying all the NPE scans, though a few areas in the North haven’t uploaded, and there are a bunch of rogue tiles hither and thither (e.g. Cardiff, Somerset). I’ve started work on fixing those and they’ll be done in forthcoming weeks.

The Scottish Popular Edition, with Mike Calder’s excellent scans, is the next challenge! At Andy Allan’s suggestion I think it might be worth opening this up for people to help with the rectification and will be considering how best to do this.