2014_07_18: breaking the silence (continued)

Following on from last night’s post:

Here’s some results from the CC online presence survey:

  • Still only 22% of CCs have up to date presences. The figures for out-of-date, existent but not online and non-existent CCs are also almost completely unchanged.
  • Moray and East Renfrewshire have the highest percentages of up to date presences, at 65% and 60% respectively. Clackmannanshire, Edinburgh and Falkirk are in the 50%-59% range. The %ages of up to date presences in LAs looks like this:

Community Council Location Finder Continue reading

2014_04_06

So what’s happened over the last month?

Community council location finder project

The final community council location finder code has been submitted to the client. There were a few days delay waiting for up-to-date data to arrive at the client.

I look forward to the site going live. Meanwhile, here are screenshots of the final version:

Current project

I’m doing the literature review for the resurvey of Community Council online presences. This will update the summer 2012 report. To create connections with European research, it’s likely that I will examine how open-ness and transparency are supported by these presences.

Presentations

Peter Cruickshank and I have

I took part in the commission’s panel discussion around digital democracy. Here is the original submission. (Thanks as ever to Peter for making my prose legible.) Here is video of the discussion.

Yesterday, I was a note-taker at From Centre to Community – reclaiming local democracy in Scotland. My personal aim was to learn from others at this event, and this was more than fulfilled. I also met ‘Paddy’ Bort, co-author of The Silent Crisis, and Adam Stewart, secretary to the commission, among many others. Most people I spoke to were very well informed and had a lot to contribute. Others came simply to learn.

Many good points were raised – not just pie-in-the-sky schemes. I’m not optimistic that local democracy will be perfected in my lifetime. In fact, I am certain that nothing in this world can ever be perfect. But I am very optimistic that we can start to improve matters, right here, right now.

 

2014_03_11: it’s progress Jim, but not as we know it

So I spent most of yesterday trying to find what causes my work to crash Safari under iOS7: turns out it’s the gizmo that clusters the CC markers. Not going to cure that in a hurry!

Then I tried for several hours to add the info features from leaflet’s chloropleth/geoJSON example to my script. I got the LAs to highlight on mouseover, but not to de-highlight on mouseout. Nor could I get the data control to pick out data from the LA geoJSON file.

So I reasoned ‘if I can’t add their stuff to mine, can I add my stuff to theirs?’ That is, could I swap in my LA and CC data sets and use leaflet’s code to colour them and pick out data to be displayed in their external control? This seemed to go OK until I added in the geocoder (the bit for entering an address to zoom to that area of the map. This code failed, so everything that should have been processed after it wasn’t even reached.

I went back to trying to add leaflet’s functions to my otherwise functional code. Still no joy.

I refactored my code so it was in a more logical order:

  1. preparatory functions,
  2. drawing basic map
  3. adding scale, geocoder, reset and help controls to map
  4. adding LA data layer
  5. adding CC data layer
  6. adding layers on/off control

and made the reset control call a URL from a simple configuration file, so that when the client actually puts this work online, they only need to update the configuration file, not hack around in the reset script.

I still couldn’t get the mouseout bit to work. I knew this code was being called: if I replaced it with document.write(“rude word”); then rude words were written.

So this evening I revisited leaflet’s example, determined to get it to work. This example has all the functionality built into a script in the html file, not a separate ‘external’ script. Not really the way I want but I’m running out of time…

I realised that the geocoder was being called but just failing somewhere. I’m not sure how I worked it out but the fail point was that geocoder calls a function in my main external script to limit its searches to Scotland – the same bounds as are applied to my map. (Without this search-area limiting, searching for EH10 postcodes shows Walthamstow.) But this script is never invoked, so the function isn’t callable. So instead of calling that function, I’ve copied it into the geocoder. Now that works! And so do all the other bits. I can make the reset script call the configuration file, so long as they are in the right order in the html header (i.e. configuration before the reset function that depends on it – so perhaps the issue was that the geocoder was calling the main script before it was available.

There was another wrinkle adding in the CC marker code. Something doesn’t like a variable called location. Changing that to ccLocation worked.

So here is the whole lot working – but with the javascript embedded in the HTML.

My task for tomorrow is to get the javascript into a separate file, so that this works, cos right now it doesn’t. Then write some documentation, then write a talk for the OKFN meet-up tomorrow.

2014_03_10

Added reset button

It’s another hack down of the OSMGeocoder control, mostly because I don’t have time to understand how to create a control from scratch. The main fault with it is that it relies on

inner.innerHTML = “<a href=\”http://localhost:8888/realISV22\”><img src = \”css/images/reset.png\”></a>”;

The bold bit will need to be replaced with the real URL for wherever the site will be used.

News!

New news

I’m taking part in a digital democracy panel discussion, hosted by the Commission on Strengthening Local Democracy.

Old news 1

Community council location-finder: the subject of most posts on this blog so far

Old news 2

Emergent ICT strategies for local democracy: capturing innovation: updating the survey of CC websites we did in 2012. What has changed? What are the patterns? What are the reasons underlying the patterns?

2014_02_21: even more LA boundary progress

So a good conversation with Napier’s visualisation expert and I’m now more aware of some of the ways to make my code more bombproof – too be implemented this weekend, if paper-writing and having a life allow.

Meanwhile I’ve completed colouring the LA boundaries. Here’s some pretty pictures:

Neither LAs nor CCs switched on

Neither LAs nor CCs switched on

CCs switched on

CCs switched on

LAs switched on

LAs switched on

both switched on

both switched on

I’m not too bothered that this uses 6 colours when there should be a four-colour solution. I’d be more picky about the actual colours used. Changing the colours is easy – just changing up to 6 values in a function in my main script. Changing which LAs each colour is applied to involves opening the huge geoJSON file full of LA data, then finding, say, East Ayrshire, then changing the value of colour_code immediately below it.

2014_02_21: more LA boundary progress

Manually copying and pasting 32 sets of bits of file is fraught with difficulty, as any fule kno.  So there had to be an easier way to assemble the individual LA geoJSON files into one javascript file. I did a lot of comparison of the brackets and guts of the working-so-far leaflet example and my geoJSON files. My file began with 

{
“type”: “FeatureCollection”,
“crs”: { “type”: “name”, “properties”: { “name”: “urn:ogc:def:crs:OGC:1.3:CRS84” } },
                                                                                

We only want one FeatureCollection, with 32 features for the 32 LA boundaries. So in a new laBoundaryData.js file, containing var laBoundaryData = { }; from the first LA file insert

      “type”: “FeatureCollection”,
      “crs”: {
            “type”: “name”,
            “properties”: {
                  “name”: “urn:ogc:def:crs:OGC:1.3:CRS84” } },
 
      “features”: [{
            “type”: “Feature”,
            “properties”: {
                  “NAME”: “Aberdeen City”,
                  “AREA_CODE”: “UTA”,
                  “DESCRIPTIO”: “Unitary Authority”,
                  “FILE_NAME”: “ABERDEEN_CITY”,
                  “NUMBER”: 7.0,
                  “NUMBER0”: 34.0,
                  “POLYGON_ID”: 122136.0,
                  “UNIT_ID”: 30421.0,
                  “CODE”: “S12000033”,
                  “HECTARES”: 20561.013,
                  “AREA”: 1990.394,
                  “TYPE_CODE”: “AA”,
                  “DESCRIPT0”: “CIVIL ADMINISTRATION AREA”,
                  “TYPE_COD0”: null,
                  “DESCRIPT1”: null,
                  “colour_code”:2         //BMR 2014_02_21
            },
            “geometry”: {
                  “type”: “MultiPolygon”,
                                    “coordinates”: [ [ [ [ -2.360870189456887, 57.10919031061777  ….]]]] } },

Note the comma. After it, paste { “type”: “Feature”, “properties”: ….]]]] } } from the next LA file, then add a comma. Then rinse and repeat.

Far from elegant but much easier than isolating wee bits from each file.

2014_02_19: LA boundary progress

With thanks to Leaflet.js forum members Matt and Simon.

I was encouraged to try again to obtain up-to-date LA boundary data from the OS. This time I obtained a set of shape files. The relevant shape file was district_borough_unitary_region.shx. I opened that in QGIS, removed the non-Scottish areas and saved the result as Scotland.qgs. I then selected and saved each LA in turn as a geoJSON vector file (with CRS = WGS84/EPSG4326 as before). So this got me up-to-date accurate LA boundaries. But these are quite large files: averaging 2MB each. (Of course Highland was much bigger than Clackmannashire, for example.)

To obtain simplified files, I selected each LA in turn, then did Vector > Geoprocessing tools > Simplify (options: ‘use only selected features’, tolerance = 50, ‘save to new file’, ‘add to canvas’) so that I had a patchwork of separate LAs:

simplified LAsI then selected each simplified LA in turn and saved them as geoJSON files. The resulting files are about a twentieth of the size of the unsimplified files. Yet zooming right in shows an acceptable (to me) fit to the unsimplified boundaries and coastlines. Yeehah.

We have layers

Screen Shot 2014-02-19 at 14.53.03And now the LA group is off by default, while the locater and layer controls are expanded by default:

Screen Shot 2014-02-19 at 15.32.29