Setting up your GDAL and OGR Environmental Variables

Table of Contents

    Windows 11

    Open the start menu, and search for: environment variables

    Choose the Edit the system environment variables

    Choose Environment Variables.

    Edit the Path Variable by adding an entry for you path to ogr2ogr.

    I would recommend installing ogr2ogr using the OSGeo4W network installer and the default path. If you have done this the path is: C:\OSGeo4W\bin

    You also need to add 2 new entries into the base environmental variables, one for:


    With path:


    One for:


    With path:


    Adjust the paths accordingly if you have not used the default install locations.

    Windows 10

    I recently upgraded to Windows 10, and have been setting up my GIS workspace settings.

    Setting up your Windows path environmental variables can easily be done through the command line.

    These commands can be run directly in the command line and don’t require a computer restart to take effect. To run the command prompt, simply open up the windows search (Windows Key + S) and search for “cmd”:


    Then run the command to add the path.

    Update: PROJ_LIB also needs to be set, to prevent “PROJ: proj_create_from_wkt: Cannot find proj.db” errors.

    Determine where your QGIS is installed. I recommend using the OSGeo4W network installer and using the default location. Which would be: C:\OSGeo4W\bin

    If it is installed there, just run:

    setx PATH "%PATH%;C:\OSGeo4W\bin"
    setx GDAL_DATA "C:\OSGeo4W\share\gdal"
    setx PROJ_LIB "C:\OSGeo4W\share\proj"

    In the past a 64 bit install was installed by default into: C:\OSGeo4W64\bin

    If it is installed there run:

    setx PATH "%PATH%;C:\OSGeo4W64\bin"
    setx GDAL_DATA "C:\OSGeo4W64\share\gdal"
    setx PROJ_LIB "C:\OSGeo4W64\share\proj"

    Restart your command prompt.



    No more:
    ‘org2ogr’ is not recognized as an internal or external command, operable program or batch file.

    Multi Ring Buffer – Buffer the Buffer or Incrementally Increasing Distance?

    Does it matter, and who cares?

    Multi-ring buffers can be useful for simple distance calculations as seen in:
    X Percent of the Population of Scotland Lives Within Y Miles of Glasgow
    X Percent of the Population of Scotland Lives Within Y Miles of Edinburgh

    For these I simply created multiple buffers using the QGIS buffer tool. This works for small samples, but was quite frustrating. I had initially hoped to do the whole analysis in SQLite, which worked pretty well initally, but struggled on the larger buffers. It took too long to run the queries, and did not allow for visualisation. I think using PostGIS would however be pretty feasible.

    But creating a multi-ring buffer plugin for QGIS also seemed like a good learning experience. Which got me thinking, does it matter if you create increasingly large buffers around the original feature, or if you buffered the resulting buffer sequentially. My hypothesis was that there would be pretty significant differences due to the rounding of corners.

    I asked on StackExchange but the conversation did not really take off:

    My question is not about the overlapping-ness of the buffers, since I think multi-ring buffers should be “doughnuts” anyway. But rather if smoothing will occur. The only answer was to try it myself.

    Buffer styles:
    Buffer the resulting buffer sequentially: Sequential
    Buffer the original feature with increasing buffer distance: Central
    [table caption=”Speed – In seconds”]
    Features, Rings,Central, Sequential
    1, 5, 0.59, 0.56
    55, 5, 8.06, 6.38
    1, 200, 60.83, 31.76
    3, 200, 62.89, 40.89
    55, 200, 628.38, 586.67
    1, 2000, 203.84, 67.00

    No matter how you do it the sequential style is quicker, but that may be down to my code.


    Interestingly, although understandably, the sequential style results in a lot more vertices in the outer rings. For comparison, for a 500 ring buffer the outermost ring had the following vertice counts:
    Style, Vertices

    We can see this with editing turned on.

    We can also see a smoother profile in the sequential buffer. However the difference is not major, and hard to discern with the naked eye.

    So we have at most about around a 10m discrepancy, with 500 50m rings, so around 25000m of distance from the original feature.
    This impacts rendering time dramatically, an example with our 500 rings:



    So quicker to create but slower to draw. So which one is better, quicker calculation, or quicker rendering? Or should we not do 200+ ring buffers?

    Hard to say. In version 0.2 of the Multi Ring Buffer Plugin. There is an option for either in the advanced tab.

    Please report any issues through GitHub:

    Schiehallion – Contour lines and Maskelyne’s observatory

    In 1774 large science was taking place in the heart of Scotland. Two men were about to weigh the earth. This was done using plumblines and measuring how much the hill in Perthshire, called Schiehallion, displaced them. Schiehallion was chosen for its uniform appearance and relative accessibility.

    The two people responsible for the experiment were the astronomer Nevil Maskelyne and the surveyor Charles Hutton. Charles Hutton, in order to make calculations of the volume of the mountain, pioneered the use of contour lines. These were essential in joining up measurement points to create a continual observation. Maskelyne set up a cabin on each side of the mountain where he could live and take astronomical observations and plumbline readings. The hut on the north side of the mountain famously burned down during the whisky fuelled celebrations of completing the observations, taking with it a local boys precious fiddle. Upon returning to London Maskelyne compensated the boys loss by sending him a replacement fiddle, a Stradivarius.

    A good account of the Scheihallion experiment can be found in Rachel Hewitt’s: Map of a Nation. Which also provides an excellent account of the early days of the Ordnance Survey.

    My goal for the trip was to find the remains of Maskelyne’s ruined observatory, which according to some reports could still be found on the northern slopes of the mountain. The quest was inspired by Simon Ingram. Whose account of climbing Schiehallion in Between the Sunset and the Sea is definitely worth a read. I used the notes found in that book to narrow the search area.

    Also available for free from Audible: Free 30 day trial

    I set off, driving past Dull (Paired with Boring, Oregon), which was not a sign of how the day would turn out.

    Dull and Boring

    The first views of Schiehallion do not show the characteristic conical shape, rather a gradual slope.

    First glimpse

    However the uniformity can be seen in the historic Ordnance Survey maps:

    UK Great Britain, Ordnance Survey one-inch to the mile (1:63,360), ‘Hills’ edition, 1885-1903 National Library of Scotland:

    UK Great Britain, Ordnance Survey (1:1 million-1:10,560), 1900s from the National Library of Scotland:

    UK Ordnance Survey Historical Maps from 1919-1947 National Library of Scotland:

    UK Great Britain, Ordnance Survey One-Inch Seventh Series (1:63,360), 1955-1961 National Library of Scotland:

    At the head of the car park there is a memorial to the observation work that took place on the hill.


    Schiehallion from the car park (parking is £2, and only coins are accepted), with a suggestion of nice weather ahead.


    Unfortunately the weather in Scotland is never predictable. With hail one minute.


    And sunshine the next.


    View from the top of Schiehallion. My goal was to attain the summit, and on the way down break off from the path and head downslope.


    The remains of the Ordnance Survey trig point at the top of Schiehallion.

    OS Trig Point

    The view of the northern slope, so the observatory remains would be somewhere down there. There were a couple of promising piles of rocks that could be seen from up high, but upon closer inspection turned out to be… piles of rocks.


    View back up to the ridge.

    View back

    Northern slope. The terrain was not difficult, but the weather was not ideal.

    View down

    I was just about the give up the search, but after climbing one final rise I saw a suspiciously uniform pile of rocks.


    The remains of Maskelyne’s observatory. One platform was for the cabin, with the other one for the astronomical instruments.

    Maskelyne's observatory

    Backpack for scale.


    A job well done. The way back was very boggy. I took some solace in the fact that I was contouring around the hill that established contour lines. I was also spurred by the success of actually finding the site.

    Happy Mapper

    Final view back to Schiehallion.

    View back

    A successful journey, and excellent adventure.

    If you want to visit the site I would recommend reading the description in Simon Ingram’s: Between the Sunset and the Sea, and baseing your own search on the description provided.

    However I did track my own route, and I had been about to give up my own search before I finally found the site. So my route:


    As seen in Trail Magazines 2015 October issue-

    UK General Election Results

    No GIS in this post, so best to skip if you are not interested in UK election results.

    The data has been released by the electoral commission, so I thought I would run a few queries in PostgreSQL to look at the numbers. These queries are based on the initial results, so may be subject to change.

    The raw data can be found from: the Electoral Commission.

    First lets have a look at the description on the ballot paper (The party name or description used by the candidate on the ballot paper.) and look at a count of each:

    [table file=””][/table]

    Some descripancies to note are extra spaces in the raw data. Overall a good correlation might be to look how many descriptions each party has and election outcome.

    Next what I have found puzzling is some of the analysis based on raw voter numbers. One example by

    Voter percentage

    I find it misleading to say that the SNP only received 5% of the vote. They only revived 5% of the vote overall, but even had they received a 100% vote in Scotland, and voter turnout in Scotland had been 100% they would still only have received 4094784 votes. Had the SNP run in more than the 59 Scottish constituencies, then they would have revived more overall votes. It is useless looking at overall votes compared to seats, the percentage of possible votes provides a better comparison in my opinion with the current electoral format.

    To do this the data needed to be slightly cleansed, with some descriptions combined, for example:
    Lib Dems are made up of:
    “liberaldemocratstrongereconomyfairersociety”, “liberaldemocratsstrongereconomyfairersociety”, “liberaldemocratsdemocratiaidrhyddfrydolcymru”, “liberaldemocrats”, “liberaldemocratfocusteam”, “liberaldemocrat/democratiaidrhyddfrydol”, “liberaldemocrat”

    And conservatives:
    “conservatives”, “conservativeparty/ymgeisyddplaidgeidwadolcymru”, “conservativeparty”, “conservativeandunionistparty”, “conservativeandunionist”

    [table file=””][/table]