Archive

Archive for the ‘Uncategorized’ Category

Benford’s Law and the Administrative Geography of Great Britain

July 13, 2014 Leave a comment

Just listened to the latest episode of the Infinite Monkey Cage, and was reminded of Benford’s Law. This states:

Benford’s Law, also called the First-Digit Law, refers to the frequency distribution of digits in many (but not all) real-life sources of data. In this distribution, the number 1 occurs as the leading digit about 30% of the time, while larger numbers occur in that position less frequently: 9 as the first digit less than 5% of the time. Benford’s Law also concerns the expected distribution for digits beyond the first, which approach a uniform distribution.

I was curious if that might emerge in geography (or Ordnance Survey data) somehow. Turns out if we look at the areas (in metres squared) of the polygons in the Boundary Line Product (i.e. the areas of all the counties, wards, consistuencies, districts, parishes etc. in GB) then we get a pretty good fit. In the table below the first column is the leading digit of the polygon area, the second is the percentage of areas starting with that leading digit and the third column is the value Benford’s Law predicts:

1:  30.6   30.1
2:  15.9   17.6
3:  11.3   12.5
4:  9.8     9.7
5:  8        7.9
6:  7.3     6.7
7:  6.3     5.8
8:  5.6     5.1
9:  4.9    4.6

Not bad…

First Signs (For Me) of Linked Data Being Properly Linked…?!

March 25, 2014 Leave a comment

John G:

Tony Hirst blogs about two of my recent blogs…

Originally posted on OUseful.Info, the blog...:

As anyone who’s followed this blog for some time will know, my relationship with Linked Data has been an off and on again one over the years. At the current time, it’s largely off – all my OpenRefine installs seem to have given up the ghost as far as reconciliation and linking services go, and I have no idea where the problem lies (whether with the plugins, the installs, with Java, with the endpoints, with the reconciliations or linkages I’m trying to establish).

My dabblings with pulling data in from Wikipedia/DBpedia to Gephi (eg as described in Visualising Related Entries in Wikipedia Using Gephi and the various associated follow-on posts) continue to be hit and miss due to the vagaries of DBpedia and the huge gaps in infobox structured data across Wikipedia itself.

With OpenRefine not doing its thing for me, I haven’t been able to use that app as…

View original 453 more words

Categories: Uncategorized

How are you using Ordnance Survey Linked Data?

June 5, 2013 1 comment

I might have mentioned (a few times) that the new look Ordnance Survey linked data site is now live. A question I ask from time to time is:

1) Are you using the data, and if so what for (if you don’t mind saying)?

2) Even if you aren’t actively using the data are you linking to it?

Please comment below if you have anything you’d like to share. Thank you in advance!

New Ordnance Survey Linked Data Site not just for Data Geeks

June 3, 2013 1 comment

Ordnance Survey’s new linked data site went live today. You can read the official press release here. One of the major improvements to the site is the look and feel of the site, and as a result of this the site should be useful to people who don’t care about ‘scary things’ like APIs, linked data or RDF.

One key additional feature of the new site is map views (!) of entities in the data. This means the site could be useful if you want to share your postcode with friends or colleagues as a means of locating your house or place of work. Every postcode in Great Britain has a webpage in the OS linked data of the form:

http://data.ordnancesurvey.co.uk/id/postcodeunit/{POSTCODE}

Examples of this would be the OS HQ postcode:

http://data.ordnancesurvey.co.uk/id/postcodeunit/SO160AS

or the postcode for the University of Southampton:

http://data.ordnancesurvey.co.uk/id/postcodeunit/SO171BJ

Click on either of these links you’ll see a map of the postcode – which you can view at various levels of zoom. You’ll also see useful information about the postcode such as its lat/long coordinate. More interestingly you’ll notice that it provides information about the ward, district/unitary authority, county (where applicable) and country your postcode is located in. So for the University of Southampton postcode we can see it’s located in the ward Portswood, the district Southampton and the country England.

Another interesting addition to the site is links to a few useful external sites such as: They Work For You, Fix My Street, NHS Choice and Police UK. This hopefully makes the linked data site a useful location based hub to information about what’s going on in your particular postcode area.

Why not give it a try with your postcode…:)

GeoSPARQL and Ordnance Survey Linked Data

April 26, 2013 3 comments

The Ordnance Survey Linked Data contains lots of qualitative spatial information – that is topological relationships between different regions. We have information about what each region contains, is within and touches (e.g. Cambridgeshire touches Norfolk). These relationships were encoded using an Ordnance Survey vocabulary as there was nothing suitable at the time. Since then a new standard has emerged from the OGC called GeoSPARQL. In the long term we would probably like to migrate the OS data over to the GeoSPARQL standard, but to stop third party applications using the data from breaking we decided not to on this release. However, mappings from the OS vocabulary have been made to the GeoSPARQL vocabulary via ‘owl:equivalentProperty’. So each of the spatial relationships now have a link to their equivalent in GeoSPARQL. Please see: contains, within, touches, equals, disjoint and partially overlaps for more details on which properties they are related to in GeoSPARQL.

 

Announcing new beta Ordnance Survey Linked Data Site

April 25, 2013 1 comment

Ordnance Survey has released a new beta linked data site. You can read the official press release here.

I thought I’d write a quick (unofficial) guide to some of the changes. The most obvious one that is hopefully apparent as you navigate round the site is the much improved look and feel of the site. Including maps (!) showing where particular resources are located. Try this and this for example. Maps can be viewed at different levels of zoom.

Another improvement is the addition of new APIs. The first of these is an improved search function. Supported fields for search and some examples can be found here. The search API now includes a spatial search element.

The SPARQL API is improved. Output is now available in additional formats (such as CSV) as well as the usual SPARQL-XML and SPARQL-JSON. Example SPARQL queries are also included to get users started.

Another interesting addition is a new reconciliation API. This allows developers to use the Ordnance Survey linked data with the Open Refine tool. This would allow a user to match a list of postcodes or place names in a spreadsheet to URIs in the Ordnance Survey linked data.

In the new release the Ordnance Survey linked data has been split into distinct datasets. You could use the above described APIs with the complete dataset or, if preferred, just work on the Code-Point Open or Boundary Line datasets.

For details on where to send feedback on the new site please see the official press release here.

Update: I blogged a bit more about some of the new APIs here.

/location /location /location – exploring Ordnance Survey Linked Data

October 25, 2009 5 comments

Ordnance Survey now have some linked data available here. This data includes information about the local authority and voting regions of Great Britain. Included in this data are the names (and official names as set out by Statutory Instrument where applicable), census code and area in hectares of the region. Also included are topological relationships between the administrative areas. These allow users to do qualitative spatial queries on the data.  So for example, the data contains information about which regions are contained by other regions. Bordering information is given between regions of the same type (e.g. between consituencies). There is one exception to this where additional bordering information is given between counties, unitary authorities, districts and metropolitan districts [1].

So what can you do with the data? First you can simply explore it in your browser. For example look at the URI for The City of Southampton:  http://data.ordnancesurvey.co.uk/id/7000000000037256. As you can see this contains a list of the regions Southampton borders, contains and overlaps [2].

It is possible to perform free text searches on the data here. The results are returned as an RSS feed. Try it out – type the name of the region you are looking for in the first search box. Typing in Southampton gives three results: the unitary authority The City of Southampton and two westminster constituencies Southampton, Test and Southampton, Itchen.

The interesting queries, however, are done at the SPARQL endpoint located here.  I’ll give a handful of SPARQL queries to get you going. You will need to add this at the top of each query:

PREFIX owl: <http://www.w3.org/2002/07/owl#&gt;
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#&gt;
PREFIX foaf: <http://xmlns.com/foaf/0.1/&gt;
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX admingeo: <http://data.ordnancesurvey.co.uk/ontology/admingeo/&gt;
PREFIX spatialrelations: <http://data.ordnancesurvey.co.uk/ontology/spatialrelations/&gt;

So first of all I can ask for a list of the types of the things in the data:

select distinct ?type
where
{
?a rdf:type ?type .
}

Seeing the data mentions Unitary Authorities I can ask for a list of all unitary authorities and their official names:

select ?a ?name
where
{
?a rdf:type admingeo:UnitaryAuthority .
?a admingeo:hasOfficialName ?name .
}

I can now issue a topological query: find me all westminster consituencies contained by the unitary authority Southampton:

select ?a ?name
where
{
<http://data.ordnancesurvey.co.uk/id/7000000000037256&gt; spatialrelations:contains ?a .
?a rdf:type admingeo:WestminsterConstituency .
?a foaf:name ?name .
}

or find me the regions (and their names) that contain the district of Winchester:

select ?a ?name
where
{
?a spatialrelations:contains
<http://data.ordnancesurvey.co.uk/id/7000000000017754> .
?a foaf:name ?name .
}

This query finds me the regions (and their name and type) that border Winchester:

select ?a ?name ?type
where
{
<
http://data.ordnancesurvey.co.uk/id/7000000000017754 > spatialrelations:borders ?a .
?a rdf:type ?type .
?a foaf:name ?name .
}

This query returns me a list of counties, and the county electoral divisions contained within them along with the names of the county and county electoral division:

PREFIX owl: <http://www.w3.org/2002/07/owl#&gt;
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#&gt;
PREFIX foaf: <http://xmlns.com/foaf/0.1/&gt;
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX admingeo: <http://data.ordnancesurvey.co.uk/ontology/admingeo/&gt;
PREFIX spatialrelations: <http://data.ordnancesurvey.co.uk/ontology/spatialrelations/&gt;

select ?ced ?county ?cedname ?countyname
where
{
?county rdf:type admingeo:County .
?ced rdf:type admingeo:CountyElectoralDivision .
?county spatialrelations:contains ?ced .
?ced rdfs:label ?cedname .
?county rdfs:label ?countyname .
}

One final note for people wanting to do mashups with this data. If you wish to see the boundary on a map then the area code and unit ID attributes can be used in the OS OpenSpace API to display the boundary.

So for example, for Southampton (http://data.ordnancesurvey.co.uk/id/7000000000037256) the area code is UTA (for unitary authority) and the unit ID is 37256. These values can be used as follows:

/*here we set-up the our variable called ‘boundaryLayer’ with the strategies that we require.
In this case, it is its ID and type i.e. Unitary Authority */
boundaryLayer = new OpenSpace.Layer.Boundary(“Boundaries”, {
strategies: [new OpenSpace.Strategy.BBOX()],
admin_unit_ids: ["37256"],
area_code: ["UTA"]
});
//then we add the bounadry to the map
osMap.addLayer(boundaryLayer);
//this effectively refreshes the map, so that the boundary is visible
osMap.setCenter(osMap.getCenter());

to display the Southampton boundary using the OS OpenSpace API. See http://openspace.ordnancesurvey.co.uk/openspace/support.html for more details. An example of the output can be seen here.

Happy SPARQLing…

[1] – if you are (rightly) confused about the geography of Great Britain then there is a handy glossary here.

[2] – the regions that contain Southampton will be added shortly.

Reblog this post [with Zemanta]
Follow

Get every new post delivered to your Inbox.

Join 2,189 other followers