Week Beginning 16th January 2017

I returned to the SCOSYA project this week.  One of the big tasks on my ‘to do’ list was to investigate alternative marker shapes for the Atlas, so we can have markers of different shapes and colours to reflect different combinations of attributes that users have selected, for example a blue circle means attributes A and B are present, while a green triangle means A is present but not B.  A yellow star might be used to mean attribute B is present but not A while a red square could mean neither A nor B.  Linked to this was the issue of the size of the markers.  Gary was concerned that when zoomed out to the point where a user can see the whole of Scotland on screen at once the Atlas markers are currently too small to distinguish the different colours used for them.  This is because currently the markers are not ‘pins’ on the map but are instead geographical areas – when zoomed in each ‘marker’ appears to cover a large area (e.g. the whole of Barrhead), but when zoomed out the area of Barrhead (for example) is a tiny part of the overall map and therefore the ‘marker’ is a small dot.

Rather than experiment on the working version of the Atlas I decided to experiment with different markers and marker sizes using test versions of the Atlas.  This has allowed me to try things out and break things without affecting Gary’s access to the Atlas as he is using it these days.

First of all I made an update that increased the size of the markers only, but otherwise kept things more or less the same, as the following screenshot demonstrates.

As with the ‘live’ atlas, the markers cover a geographical area rather than being exact points, which means when zoomed in the circles and squares now cover a larger area of the Atlas.  This means there is the potential for a lot of overlap and may lead to users making incorrect assumptions about the geographical extent of the survey results.  E.g. the search for ‘imjustafter’ when zoomed in to level 11 for the area around Paisley demonstrates that the highlighted area for Paisley covers a large portion of the Johnstone area too whereas if you do the same search on the ‘live’ atlas the circles for Paisley, Johnstone and Barrhead do not overlap at all.

On the above map I also added in a turquoise triangle.  This is an image based marker that I was experimenting with.  We could have image markers in any shape and colour that we want and can also make them change size at different zoom levels.  This occurs with the triangle when you go from zoom level 11 to 10 and from 9 to 8.  The triangle looks a bit fuzzy at certain zooms because it’s a bitmap image (a PNG) but we could use vector images (SVG format) instead and these scale smoothly.  The downside with using such markers is we need to manually make them, which means every possible permutation would need to be created in advance.  E.g. if a user decides to do a search for 20 attributes we’d need to ensure we have created images for every required shape in every required colour to support such a search.  The other markers are generated on the fly – the script can just keep picking new colours as required.  Also, using an image marker has broken the ‘save map image’ functionality so I’d need to figure out an alternative method for saving the map images if we use image based markers.

My second test was to use the Leaflet DVF (Data Visualisation Framework) plugin (see https://github.com/humangeo/leaflet-dvf).  I used this previously to create the donut / coxcomb markers that were rejected as being too complicated at the last team meeting.  The plugin allows for polygon and star shaped markers.  You can see the results of my experiment in the following screenshot:

For test purposes I’ve updated the ‘Locations’ map so that each ‘number of completed’ level is a polygon of a different number of sides, in addition to being a different colour.  So ‘1 completed’ is a triangle, ‘2 completed’ is a square etc.  You can specify the rotation of the shapes too – so a square shape can be rotated to make a diamond, for example.  Note that these markers are a fixed size rather than covering a geographical area of the map like the markers in the previous map.  This means the markers don’t change size when you zoom in and out.  This means things get slightly cluttered when you zoom out (but the markers are at least big and easy to see).  It also means when you zoom in the marker seems to cover a very specific point on the map.  E.g. in the ‘live’ atlas the square for ‘Cambuslang’ covers all of Cambuslang while the DVF marker at maximum zoom is a specific point to the west of a golf club.  This specificity might be a problem or not.  It probably would be possible to update the radius of the markers automatically when the zoom level is changed, as I did for my triangle test mentioned above.  So, for example, at maximum zoom the marker radius could be larger.

On this test atlas I also changed the circle markers to be a fixed size too, as the following map for ‘imjustafter’ shows.  The same possible issues when zoomed far in and out occur for these too.  Note also that for test purposes I’ve replaced the grey ‘no data’ square with a grey star (see Prestwick – with label hover-over showing too).  You can specify the number of points on the star as well, which is a nice feature.  It should be noted that using DVF also breaks the ‘save map image’ functionality so I’ll need to explore alternatives if we decide to use this plugin.

Also this week I investigated upgrading Leaflet from version 0.7 to the new version 1 that was released in November last year.  I spent a bit of time trying the new version out, but encountered some difficulties with the various plugins I’m using for the Atlas.  For some reason when using version 1 none of the map markers are clickable and the labels don’t work either.  This is obviously a big issue and although I spent a bit of time trying to figure out why the pop-ups no longer worked I ended up just reverting to version 0.7 as there didn’t seem to be any benefit from moving to version 1.  Also, when panning and zooming the markers didn’t animate smoothly with version on but instead stayed where they were until after the base map finished updating and then moved, which looked pretty horrible.  I think I’ll just stick with version 0.7 for now.

Apart from the above SCOSYA work much of the rest of my week was taken up with administrative duties.  I am the fire officer for my building and I had to attend a fire training course on Wednesday morning.  I also spent all of Friday updating the more than 20 WordPress instances that I manage to the most recent version of WordPress, which was a bit of a tedious task but needed doing.  I also prepared a new section of the Burns website for Kirsteen McCue in preparation for Burns Night next week, made another couple of tweaks to the export facilities for the REELS project and had a brief chat with Fraser about the HT OED data merging task. We’re going to meet to make a workflow for this next week.