Tuesday, 25 January 2011

Surveys

This mapping makes me notice changes that I think would have washed over me before, but I'm sure I would have noticed what has happened to Heron Foods warehouse. They have moved to a shiny new warehouse outside of town and the old one has been demolished, but I'm not sure what the plans are for the site yet.

It will be a while before any of the other maps display the site correctly, for me it is easy, I can just draw the building from the Bing aerials (the one with the mouse cursor on it) and tag it as a brownfield site until I know more. There is a fence around the site, where before there were the walls of the building, so I can add that too.

Rarely does a trip out not reveal something that has been missed or has changed, but not always such a dramatic change as this. Roll on the spring and the chance to do more surveys.

Wednesday, 19 January 2011

Using GB postcodes

As mentioned in the last post I have been looking at the Code-Point Open data supplied as part of the Opendata released by Ordnance Survey. The data describes the centroids for each postcode which is given as a list of post codes for England, Scotland and Wales. There are about 1.7 million post codes in the dataset, broken up into CSV files, one for each top level code such as HU. Each file has a lot of fields with no data or dummy data in them, but the postcode and the easting and northing are what I need. 

I wanted to make an overlay displaying the postcode centroids to see if they would be useful in working out the postcode for OSM addresses. Postcodes are part of the jealously-guarded Royal Mail database, sold as the PAF, which makes a couple of million pounds profit each year for Royal Mail. I would have liked to the detailed address data or at least the polygon that a postcode covers but the centroids are the best we have for now.

The process of making an overlay started by converting the OS eastings and northings to longitude and latitude. The original file is pruned to remove the excess and then I used gdaltransform to make the conversion, using the the OSGB datum EPSG:27700, before loading this into a database table.

Next I set about drawing a transparent set of tiles to use. I wanted to draw a dot for the centroid and the postcode as text beneath it. If I retrieve a list of centroids for the tile then any point close to the edge of a tile would have text that extends beyond the edge. The next-door tile, however, wouldn't know about that centroid so the text would be cut off. The simple way to deal with this is to draw each tile a bit bigger retrieving data for a larger area, draw the centroids and text then trim each tile to it's proper size. That way the text for points close to an edge will appear on tiles either side of the edge.

I rendered a set of zoom level 16 tiles for my local area and took a look to see how useful the centroid information is. It varies. For some roads the postcode is obvious from the centroid, some it is not clear where a postcode changes. I think it is of some use, so I pressed on.

I did not want to fill my on-line disk space with tiles that might not get used, so I decided to try creating the tiles on the fly to see if the response would be good enough. It is pretty good and local caching of the tiles helps too. I did have a small problem with the HTTP headers not wanting to work, but now that is sorted out. I can load the tiles as an overlay http://www.raggedred.net/codepoint/ and they work as a layer in JOSM and Potlatch 2 by using http://www.raggedred.net/tiles/codepoint as the place to get the tiles from.

I have only loaded the HU postcode area so far so, I will need to load areas for other areas if people want them. I do hope no one uses this to enter centroids into OSM, which seems a pointless exercise to me, but it might help people work out post codes for addressing.

Monday, 17 January 2011

Addresses again

Some time ago I started adding addresses for my local area. It was tedious so I didn't continue. Then, along came the Ordnance Survey Opendata followed by Bing imagery which together mean I could trace buildings. The OS data is deliberately crude so OS still have something better to sell and the locations are a bit flaky. I have found it is not all that up-to-date in parts too, but still much better than nothing.

The Bing imagery is fairly good, but about nine years old. It is more detailed by one zoom level over Hull though but for most buildings it is good enough here. For the recent additions not on Bing, OS sometimes helps, for others a camera, GPS and guestimates are the best I can do for now. Today I went out locally to gather the addresses of a few streets and ended up talking to a pleasant chap who uses maps and is interested in maps, but had not heard of OSM. I gave him a leaflet and promised to send him more information about getting OSM data onto his GPS.

Adding addresses to buildings seems far less arbitrary and is easier to survey if the buildings are traced and printed to take out to write on. I have so far not attained the level of detail that blackadder has achieved. Part of my, more modest attempts are here.

The one set of data that are a struggle are postcodes. When the OS Opendata was released it included postcode centroids. These are the centre of the area a postcode covers. I ignored it, but now I'm working on visualising these centroids in an editor to see if the postcode for an area can be reliably discerned. That is going well, but rendering the tiles may produce far too much data for my web site to handle, so I'm weighing up the options: limited coverage, dynamic tile generation or find somewhere else to host the tiles. First though I'm going to see if they are useful.

Tuesday, 11 January 2011

Swords into ploughshare?

Things have been a bit quiet on the mapping front for the past few weeks. Short, dark days are frustrating for surveying, the snow that started to fall at the end of November made getting around more of a problem. Then Christmas came along with visiting relatives being far more interesting than being out in the cold.

I have been fiddling with an idea I have for doing some analysis of OSM files. I have decided to make it browser based, but it is early days yet. I may yet struggle with having only a limited amount of disk space available to me online, but it's fun to try new things.

Heading home from a quick trip into town, we passed the Kingfisher pub that has been up for sale for a while. A new sign caught my eye and I was somewhat surprised to see that the pub had been converted to a church. Now that lots of pubs are closing across the country I have been wondering how the buildings will get reused and now I come to think of it turning it into a church is not as strange as I first thought. It is in the middle of the community, it's a reasonable size, it has rooms that the community might use and it has a car park. I just wonder if they will get more customers than the pub did.