Tuesday 25 February 2014

Signed at last

I went out to buy some seeds for the allotment today. On the way home deliberately drove home down Hawthorn Avenue in Hull to see the point where Woodcock Street joins it.

I have written to Hull City Council traffic department a few times in the past about that junction. Woodcock Street runs from Hawthorn Avenue to St Georges Road. Hawthorn Avenue has a 30 mph and St Georges Road has a 20 mph limit. There was no speed limit sign at either end of Woodcock Street nor at any point along it, so from St Georges Road you would assume it to be a 20 mph road but from Hawthorn Avenue you would assume it to be a 30 mph road and if you drove onto St Georges Road you would also expect it to be 30 mph until you see a repeater for 20 mph.

Woodcock Street has been part of the substantial redevelopment in the Hawthorn Avenue area, much of which is still under way though Woodcock Street looks to be pretty complete. The council have put a cherry on it by erecting a 20 mph sign at the Hawthorn Avenue end to remove any doubt.

Well done Hull City Council, eventually.

Saturday 1 February 2014

Visualising changes

When someone edits OSM their changes get rendered quickly so they can see their handiwork. That's really good feedback and is valuable in attracting new mappers. When it comes to checking what has changed in an area, just looking at the rendered map is rarely enough to spot any changes. Looking at changesets is the next option.

Changesets were introduced with the API version 0.6. They group together edits by a mapper made over a short period of time. They can be open for up to 24 hours, but changesets are normally closed within an hour of being created and often changesets are opened, edits uploaded to the API and the changeset closed within seconds. Changesets have a bounding box that covers the area the edits are made in. You can request a list of changesets from the API that cover a specific bounding box. Edits by a mapper are normally wrapped in a changeset that covers a small area, but some edits range across very large areas even across the whole world. These are known as big edits. These are usually some sort of mass-edit or bot edit. These will show up in a request for changesets even though no actual changes are made in the requested area.

Looking at changesets can be useful, but apart from trying to work out which of the so-called big edits to ignore, there's the bigger problem of knowing what has actually changed. If you see an added node or way that's easy, but the modified nodes or ways is a bit harder to understand and looking at some relations can be a long job to work out the changes. Has a node been moved? Has a way's nodes been moved? Has a way had nodes removed or added? Has a node or way had its tags changed? Is there some combination of all this?  Deleted nodes and ways are also a bit of a problem as they no longer render and seeing what has gone can be hard to visualise, especially as some people delete a way and add a new one to replace it, losing the way's history. What would be nice is to see a before and after view of a changeset.

I looked at the problem, initially for nodes and ways, and quickly realised that the way the API delivers information about ways makes things harder than you'd want. When you request the details of a way from the API it returns the way with attributes like ID, version, changeset etc, a list of tags and a list of nodes as node ids. This fine for the current state of the way. The nodes in the list are the most recent version of the node. You need the nodes to find the geometry of the way as longitude and latitude are only stored on nodes. As soon as you look at an older version of a way the list of nodes is suddenly not clear at all. Which version of each node does it refer to?

I think the timestamp on each API object can be used to work out which version of a node matches each version of a way. That assumes that I have, or download, all of the versions of every node in the area I'm interested in. Another idea is to store the data for the area I'm interested in from a snapshot, such as Geofabrik's, and apply every changeset for the area on from there. In that way I could store the geometry of the way with the way rather than in nodes, which sounds much more practical. I can then show the before and after view of every changeset, but only from the date of my snapshot and only if I apply every changeset. I'll think about this some more.