Wednesday, 19 September 2012

Postcodes to grid references with Code-Point Open

I've recently been playing around with using the NBN Gateway webservice to implement something along the lines of ZipCodeZoo or the Postcode plants database. This project will involve using NBN Gateway data to provide a list of species for a given taxonomic group within a few kilometres of your location (more later).

Smartphones and modern browsers are able to report their current location for use in such services, bit what if you want to check what species are found near your home while you're at work? Being able to use post codes would be an additional  nice to have feature.

As part of the UK Government's Open Data initiatives the Ordnance Survey have released Code-Point Open - which is essentially a series of CSV files with data that allows you to move from a postcode to an OS Grid Reference.

An Aside....
The OS Grid Reference can be converted to OSGB36 latitude and longitude coordinates, which can then be converted to WGS84 coordinates (e.g. to map postcodes on Google Maps). This involves some pretty in depth mathematics, but thankfully people have made a number of libraries available for doing this, such as this JavaScript library and this PHP library.
The download of this data package contains in the Data folder 120 CSV files, named after the first text portion of the postcode (some information of the structure of UK postcodes).



This isn't really ideal (I want to get these into a MySQL database) so first of all I had to merge all of these files into a single CSV file. On a Mac or Linux machine this is as simple as navigating to the Data folder in the Terminal and executing the following command:
cat *.csv > aall.csv
The resulting all.csv file is pretty large (156MB-ish). Calling it aall.csv instead of all.csv just puts it at the top of the list which appeals to my aesthetic sense.

The next step is to create a new table in MySQL:


Then we import our aall.csv into MySQ:


This imports all of the data correctly into MySQL - however some of the fields are enclosed by quotation marks ("). All that remains for us to do is to trim these from the appropriate columns:


Now that the data is all in MySQL we can get the OS Grid Reference (i.e. the northings and eastings columns for a postcode) using the following query:


iOS6 Makes Twitter go a bit crazy


Friday, 7 September 2012

Embedded terminal in gedit (Ubuntu 12.04)

To get an embedded terminal in gedit eneter the following into a Terminal window:


sudo apt-get install gedit-plugins

Open gedit then go:

Edit > Preferences > Plugins
enable 'Embedded Terminal'

To view the embedded Terminal:
View > Bottom Panel (or Ctrl + F9)

The present default configuration of the embedded Terminal on Ubuntu 12.04 uses white text on a white background, which is pretty ridiculous. You can either adjust the font colour of your default Terminal or use the following workaround:

Work around to get gEdit embedded Terminal usable on Ubuntu

Run the following from the Terminal:
sudo apt-get install dconf-tools
dconf-editor

In the Configuration Editor that appears navigate to the required plugin:

org > gnome > gedit > plugins > terminal

uncheck 'use-theme-colors' and then restart gEdit.


Added screenshot on recommendation of Ross:

Thursday, 6 September 2012

Psocoptera Introduction Workshop (September 2012)


Tuesday, 4 September 2012

Science Uncovered 2012



For the third year in a row the NHM will host Science Uncovered as part of European Researchers' Night.

"At Science Uncovered 350 of our scientists and visiting experts will gather across the Museum's galleries and outdoors in a fabulous show of displays, tours, experiments, challenges, discussions and more.  
This is a unique chance to interact with the latest scientific research and experience the Museum in a festival atmosphere. 
We have 6 bars and The Restaurant open on the night. Hot and cold food is available.
Our Museum in Hertfordshire joins in with its own Science Uncovered at Tring event. 
European Researchers' Night is a European Commission initiative. The Museum would like to thank the Commission for the opportunity to participate in this event."


ICZN allows electronic only publication of animal names

"Following four years of highly charged debate, the rules for publication of scientific names of animals have been changed to allow electronic publications to meet the requirements of the stringent International Code of Zoological Nomenclature. In a landmark decision, the International Commission on Zoological Nomenclature (ICZN) has passed an amendment to its rules that means a publication in an electronic-only scientific journal will be ‘legitimate’ if it meets criteria of archiving and the publication is registered on the ICZN’s official online registry, ZooBank."

From ICZN Amendment on electronic publication

Short press release
Long press release

Read the amendment at ZooKeys

ShareThis

Copyright