thursday tip day importing uk mastermap data into postgres or shape files
Moving to open source for our GIS packages continues to throw up some interesting challenges- and solutions. In the UK, the most common way for Ordnance Survey vector data to be delivered is in mastermap format, which without going into the technical details is gml, usually served in gz files. Lots of them. There is an additonal add-on for ArcGIS that converts this into a personal geodatabase, but initially there didn’t seem to be a way of doing this using open source.
Along comes the mastermap importer. This does exactly what it says on the box- imports mastermap data into ogr formats such as shapefiles, or into a postgresql database. It’s free for personal or non-commercial use and is a really great programme. I haven’t begun to explore any of it’s more esoteric options, but for simply converting 78 gzipped mastermap files into shapefiles it can’t be beat, even by the commercial importer add-on for ArcGIS.
The only problem I have is that 1 gzipped mastermap file translates to 1 folder containing 8 shapefiles, one for each component of the mastermap data (annotation, topographic area, point, line, etc). So if you have 78 gzipped files then you have 78*8 shapefiles to deal with. I would like to see some way of merging the matching shapefiles together automatically if possible. The only option I have so far tried is geomerge, which works well, but you still have to go through the folders picking the shapefiles you want in the first place. Surely there must be some way of iterating through the folders finding all the shapefiles with the same initial part of their name ( area shapefiles all start with MM_TopographicArea_, for example) and merging them together?
Note that I haven’t tried the postgresql options yet. If they allow you to append all the data of each type into one table, then we’re sorted as I can import them back out into shapefiles if I need to.
The next thing that I have to figure out is how to apply standard Ordnance Survey symbology to the result. That’s a tricky one…