Create a contact sheet of images

On Linux Mint (and just about any other Debian based distro) gThumb has an option to create a contact sheet of images in a directory.  However, on my machine running Mint 14 it crashes every time.  Hit duckduckgo to find an alternative and voila! ImageMagick Montage.  The montage program is part of imagemagick. Install imagemagick.

$ sudo aptitude install imagemagick

Continue reading Create a contact sheet of images

A Prayer For Our Church

Heavenly Father,

We belong to You. We long for You. We want to find You, know You, love You. In our self-sufficiency we so often fail to see your beauty and greatness all around us. We come to worship and glorify you.

We are called to be free. Free to acknowledge our sinful behaviour, free to confess that we are out of step with the Spirit. Help us to stand firm in our Gospel freedom.

gospel-freedom Continue reading A Prayer For Our Church

Optimising Raster For Web Mapping (on Linux)

OS raster colourThe previous post showed how to process panchromatic and colour TIFF images on Windows to optimise them for web mapping.  Here I’ll show you how to do the same thing using bash scripts on Linux.  This assumes you have GDAL installed (gdal-bin and python-gdal on Ubuntu/Debian/Mint).  Continue reading Optimising Raster For Web Mapping (on Linux)

Optimising Raster For Web Mapping

OS rasterI have been working through an exercise to find alternatives to storing raster data in an expensive proprietary database format. We have a lot of raster data in various formats (ECW, jpg, LZW and Packbits compressed TIFF, uncompressed TIFF, GeoTiff) and of different types (historic black and white mapping, full colour aerial photography, panchromatic (greyscale) aerial photography, full colour base mapping tiles at different resolutions). Continue reading Optimising Raster For Web Mapping

Milestone Weekend

On Friday I got British Citizenship. On Saturday went for a bike ride, a swim, a car boot sale, out for lunch with my lovely wife and back for tea (no medals). Today K did poo in the potty and we had our first braai of the summer, complete with a Castle Lager. Top weekend all round, really.

Citizenship hoops – the last one

q-icon-scottish-flag-3

This morning my passport and papers arrived back from the UK Border Agency.  My application for citizenship has been processed and approved.  Which is nice.  And it took less than three weeks.  I posted everything off on the 8th May.  Now I just need to wait for the invitation to the citizenship ceremony to start the next part of the process.  The passport is getting closer…

pgRouting on Windows 7

pgrouting-networkDrive time isochrones with pgRouting and PostGIS on Windows 7 Pro.  I am using Postgresql 9.0, 9.1 and 9.2, PostGIS 2.0.3 and pgRouting 1.0.7-dev.  Anita Graser has some excellent pgRouting resources on her blog  and I used them in conjunction with Jo Cook’s pgRouting with ITN guide to load and build my network dataset.

One of the problems I had while following this post was that I had more than the three airports she used in her example and to manually update the table 116 times for each play park in the county was not an option.

So, how to write a looping function in Postgresql to loop through all the play parks and calculate all the drive times for each facility in one go?

Postgresql docs are a good place to go and this is what worked for me in the end.  Once the table is complete finish up using Anita’s how to.

-- 1. create calculate playpark costs function
CREATE OR REPLACE FUNCTION insertPlayParkCosts() RETURNS INTEGER AS $$
-- NOTE: function returns an integer representing the next play park nearest node id
DECLARE
 nn INTEGER;
BEGIN
-- NOTE: loops through every nearest_node, calculating drive times and inserting records into the table
FOR nn IN SELECT nearest_node FROM osplayparks_pts LOOP
 INSERT INTO catchment_pp (
 SELECT
 id,
 the_geom,
 (SELECT sum(cost) FROM (
 SELECT * FROM shortest_path('
 SELECT objectid AS id,
 source::int4 AS source,
 target::int4 AS target,
 traveltime::float8 AS cost
 FROM angus_routes',
 nn, -- this updates each time with a new value for nearest_node
 id,
 false,
 false)) AS foo ) AS cost
 FROM vertices_tmp);
END LOOP;
END;
$$ LANGUAGE 'plpgsql';

-- 2. run calculate playpark cost function
SELECT * FROM insertPlayParkCosts();