Showing posts with label QGIS. Show all posts
Showing posts with label QGIS. Show all posts

Sunday, 4 June 2017

Computer troubles and further updates to TaklowKernewek tools

My desktop computer is currently incapacitated, it has for the past day and a half been resizing a NTFS partition after I made the decision, after breaking my QGIS installation while attempting to upgrade it to 2.18, to go back to a dual-boot system rather than a Windows virtual machine running in Ubuntu. Meanwhile I had also broken my netbook because it crashed while trying to upgrade to Ubuntu 17.04. I fixed this by doing a reinstall from a bootable USB stick using the UbuntuMATE iso, formatting only the root partition leaving data in /home intact.

This shouldn't deter anyone from using QGIS, or Ubuntu, just that I was doing odd things with GDAL and kealib, making myself able to use multiband .kea files  in QGIS running with the system environment variables, but use conda to run RSGISLib in Python 3, and also conda to run the European Space Agency's SNAP toolbox to process Sentinel 2 images.
There was a resulting mismatch between different versions of GDAL which caused problems when I tried to update to QGIS 2.18, which failed due to conflicting dependencies, and then trying to revert to 2.14 also failed, so therefore QGIS no longer worked at all.
With my netbook, I had installed so much on it that the root partition was close to full and I think that was what started causing problems.

Fortunately all data is backed up on external drives.

However it is not so easy to do much mapping work on my netbook, although I do now have QGIS 2.18 installed on it, but I have done a bit more on TaklowKernewek, including making the netbook mode work for more of the apps, and developing the mathematics quiz app.

The netbook modes were modified to allow the corpus statistics app, and a couple of others to fit the screen of my netbook (EeePC 1005HA), by adjusting font sizes as well as some input/output box heights.
Inflecting the verb 'covhe' (in SWF Tradycyonal) - Cornish for 'remember'



Inflecting the verb 'covhe' (in SWF Tradycyonal) - Cornish for 'remember'


Basic translation memory using Skeul an Yeth 1 example sentences. The font size of three of the four buttons has been shrunk a little so that labels do not grow bigger than the box itself.

more of the output

some further output of the translation memory


word frequency table for words of 5 or more letters in 'Origo Mundi'. The font sizes are quite small to read to make sure that the boxes do not fall off the bottom of the screen.
The word frequency bar chart has been tweaked as to not use white as a colour, since matplotlib may not always outline the bars.

counting syllables


Transliterating from Kernewek Kemmyn to Standard Written Form. It is possible that goelann should instead go to goolan in SWF, it certainly did in 2008 SWF, and may still do so despite being a multisyllable word.

Mathematics Quiz app

A new difficulty level allow input numbers up to 100, and the GUI has been adjusted to work better on smaller screens (though further work on this may be needed).
The options radio buttons have been consolidated into one column in the GUI

The program now reports back the answer to the previous question that you gave if you were correct as well as if you were wrong. This still looks a little confusing since the question now in the upper box is the second question whereas the answer is for the first. If you get a question right, you get 1 point. The bonus for speed has been reduced compared to earlier versions, to get any speed bonus at all you need to answer within 10 seconds.

'Pur gales' allows the computer to choose numbers up to 100, in this version the addition and subtraction are shown as symbols, due to possible confusion with 'ha' internal to the number such as 'dew ha dew ugens' (42). 'tri ha dew ugens marnas dew ha dew ugens' might be interpreted as 43 - 2 + 40 = 81 rather than 43 - 42 = 1.

There is a need to make some further adjustments to the Tkinter GUI code since at present the widgets aren't filling the window after it is maximized.

Sunday, 16 October 2016

An atlas of Wales in Welsh - data on OpenStreetMap

I recently saw a tweet by @mikeparkerwales about a new atlas of Wales in Welsh being prepared by @dafyddelfryn.

A Gaelic map of Scotland has also recently been produced by Paul Kavanagh.
As well as my own work, there is also Justin Cozart's map of Cornwall in Cornish.

I have produced a set of cycling maps of Wales where I used the placenames from OpenStreetMap. My procedure was to prefer the Welsh name, i.e. use the name:cy tag where it existed, otherwise the name tag.

I couldn't actually remember how I had got the Welsh names, since they are not on the standard shapefile downloads from geofabrik.de that I usually have used.

However the full set of tags are available by using the .pbf file available at download.geofabrik.de/europe/great-britain.html which needs a little more work, firstly to convert to the full XML by osmconvert, and then to turn that into SpatialiteDB format. The tutorial here explains a little of how this is done.
This process can be horribly inefficient, since a large .pbf file is downloaded, which is processed into an even larger XML. I think there are other ways to do it which avoid this which I may look into in future.

For the Welsh names, it is necessary to look for the name and name:cy tags, and maybe also name:en tags, which exist for some places, though this is usually just a duplication of name. A very few places have an alt_name:cy tag, where there is more than one Welsh name current for a particular place.





See also WikiProject Wales on the OpenStreetMap wiki. Unfortunately neither the Welsh language OpenStreetMap rendering at http://brasskipper.org.uk/cyosm or the multilingual test page by Jochen Topf currently seem to be working.

Here are some basic renderings of placenames in QGIS, using the places.shp from the geofabrik.de shapefile of Wales, and 'joining' this to the name:cy, name:en and alt_name:cy tags from the Spatialite version.

Mid-Wales. Most names only have the name tag, and where a separate name:cy tag exists, the name tag is generally the English name, although in the case of Ffwrnais, it is a bilingual form. Where name:en exists, it is usually a duplicate of name, but in one case (Pontfaen /  Forge), name:cy and name:en tags but no name. Barmouth has an alt_name:cy tag of "Y Bermo" defined.

Holyhead. Similarly where name:cy exists, name is sometimes the English version and sometimes a bilingual form.
Cardiff. Many bilingual names are in evidence, the general practice here seems to be to use name:cy for the Welsh name and name for the English name, and where name:en exists, it is usually simply a duplicate of name.

Bridgend. The remaining two places in the populated places shapefile that have an alt_name:cy defined are here.




Friday, 5 August 2016

Using QOSM to provide OpenStreetMap basemap in QGIS for my slopelines project

In previous posts I have described how I have used a segmented DEM with RSGISlib, a method originally developed as part of my MSc dissertation on Martian glaciers, for visualising slopes on Earth.

I have been looking at these again, and have produced a few maps with the QOSM plugin, which dynamically loads OpenStreetMap tiles into QGIS.

These maps below were produced with the Thunderforest Outdoors rendering. The slopelines are as previously, red for convex slopes, blue for concave, with thicker lines denoting steeper slopes.

Previous versions of this had used a version of OpenStreetMap that I was preparing myself from the source data within QGIS. Using the basemap tiles I can focus on adapting the visualisation of the slope lines themselves a bit more.

Bodmin Moor

Camborne and Redruth, including Carn Brea and Portreath

Penzance

Truro

A close up of Truro
For a while I thought the QGIS bug I found had recurred which meant that the arrows had disappeared. However it was something wrong in my data dependent styling, not sure how it happened. Once fixed, I show the slope direction with arrows, which is only possible up to about 1:10,000 otherwise the rendering struggles:

Indicating the downslope direction with arrows.

Delabole, showing the slate quarry.
St. Ives

Aberystwyth, Wales

Cadair Idris, Wales

A wider view of Cadair Idris, too small a scale to allow plotting the arrows.


Pen y Fan, Brecon Beacons, Wales


Saturday, 23 July 2016

Retrotopia draft map

The author John Michael Greer has been publishing a speculative fiction series currently on his blog, The Archdruid Report called 'Retrotopia'. It is set in around 2065, in a North America that has undergone some changes after the breakup of the USA.


Here is a draft map, based on his descriptions in the comments to a recent post, showing the approximate borders of the successor states to the USA and Canada. I have yet to deal with states that are split between more that one nation in 2065.

The nations of the Retrotopia stories, not including at this time states that are split between more than one Retrotopia nation. No account of sea level rise is made, which is assumed to be 6 feet above present day levels.
I used a map of US counties from here, and US state, and Canadian province shapefiles from here. Update - I switched to using this map of Canadian provinces which includes Nunavut.

I have also used the ETOPO1 bedrock relief topographic map as a background, which shows the elevation of Greenland without the ice sheet. It is perhaps a century or two too early to assume complete deglaciation of Greenland. The portion of Greenland below sea level is not actually connected to the sea here, it would be at a +50 metre sea level as assumed in the 25th century setting of Star's Reach.

Update

I have made some updates based on further descriptions based on John Michael Greer's comments, which account for the states that are divided:

The borders of the Retrotopia nations can be seen by the colours, with present-day US states and counties shown as lines.
The Lakeland Republic is not labelled since the Free City of Chicago label has prevented it from appearing.


In this case the Lakeland Republic label wins out.

These are the borders of the western areas, as far as I understand JMGs comments.


Close-up of the north-east former USA and adjacent part of Canada.
Black and white version.


The shapefile itself containing all of the Retrotopia nations in North America I have made available here.

It is also available as a KML file suitable for use with Google Earth.

Showing 2 meters of sea level rise in blue, with 2-4 metres shaded in lighter blue.

Monday, 27 June 2016

Mapping the result of the EU referendum

Since the results of the UK EU referendum were published, a number of maps have been published of the results across the UK.

I have mapped these in QGIS, with the aid of the OS Boundary Line map of local authority boundaries in Great Britain, and Westminster constituencies in Northern Ireland. Both of these sets of boundaries are available as government open data.

I have used data dependent styling in the maps below, which used the following formula:

case when "pc_leave"  >= 50.0 then color_rgba( 127,0,255, scale_linear( "pc_leave" ,50,80,20,255))
else color_rgba( 255,255,0, scale_linear( "pc_remain" ,50,80,20,255)) end


This makes places that had a majority of votes cast for leave shaded in purple, with transparency varied as the percentage who voted leave rises from 50% to 80%. Similarly remain is shaded in yellow under the same scaling. Unlike in General Elections, where parties generally have an established colour scheme, the EU referendum doesn't have a universally accepted colour scheme. I used purple because UKIP uses purple, and yellow because pro-Remain parties LibDems and SNP use it.

Most of my maps retain the geographic rather than a cartogram representation.  It is a point of open debate which is better, but I also add another alternative, which is to represent the absolute size of the majority by crosses, by placing a point at a random place within each polygon for each 1000 votes of majority. The other difficulty with these kind of maps is the varying impact based on the visual impact of different colours.

With a white background
With SRTM elevation overlaid (because I can).
With a black background.
Using QGIS's random dots feature to represent each 1000 voters of majority abs(leave-remain) with a cross. These are not very visible at this scale.

Crosses to represent each 1000 votes of majority, using random dots in QGIS.

Same as above, but remain is now red, which makes it more visible.
With a black background, going back to purple/yellow.

A cartogram with the QGIS cartogram plugin, sized by votes cast (not electorate) since this was the data more easily to hand.






Thursday, 2 June 2016

False colour composite of Sentinel 2 - 30.05.16

After using the script in the previous post to create a layerstacked .kea file for each "granule" within the Sentinel 2 images I downloaded, I created a false colour composite mapping band 11 (SWIR 1610nm) to red, band 8 (NIR, broadband centred around 842nm) to green, and band 4 (red 665nm) to blue.

See https://sentinel.esa.int/web/sentinel/user-guides/sentinel-2-msi/resolutions/spatial for a description of the bands available in Sentinel 2.

Here is a mosaic made in Tuiview:

After some issues with opening .kea files in QGIS (due to having reinstalled Ubuntu recently and needing to recompile KEAlib and then finding that due to being compiled against GDAL 2.1 libraries it didn't work in QGIS which was using GDAL 1.11),  I sorted this out, and have a QGIS project file showing the image. I also show some placenames from OpenStreetMap, and hill names from www.hill-bagging.co.uk for context.

Some screenshots of QGIS are shown below:

Aberystwyth area

Bodmin Moor, Cornwall. Road construction can be seen at the lower left.

Falmouth and surrounding area.

Snowdon

Truro area.
Plymouth, Saltash and Torpoint and the Rame peninsula