RSSAmplifier

Blog

longwayaround.org.uk

taking the scenic route and enjoying the journey

longwayaround.org.ukRSS feed ↗21 posts

Latest posts

Sorting lines in (Neo)Vim

The built-in Vim :sort command supports sorting either all lines in a buffer or a range of lines. For example to sort a range of lines it's possible to visually select those lines then run :sort . Help docs can be accessed via :help :sort and can be viewed online via …

Moving gridref to fly.io

A few years ago I made an effort to learn Clojure , during which time I built a small Clojure library and command-line app GridRef to convert between an Ordnance Survey GB grid reference and British National Grid coordinates. While I was at it I built a web API GridRef Web …

Web Mercator OS Vector Tile API in OpenLayers - Take #2

This is an update to my previous post on the same subject. Thanks to some feedback from Andreas Hocevar and a pull request I made to ol-mapbox-style adding a Vector Tile layer of Ordnance Survey data from the OS Data Hub to an OpenLayers map in Web Mercator is a …

Web Mercator OS Vector Tile API in OpenLayers

Adding a Vector Tile layer of Ordnance Survey data from the OS Data Hub to an OpenLayers map in Web Mercator is a little more work than expected as the JSON style document and associated JSON source document include paths for the default British National Grid tiles. The following is …

Writing small text filters for the shell and Vim

Text filters are command-line programs that take text as input, transform it then output the results. An example of a common built in text filter is sort which when passed newline separated text will sort each line: printf 'b\nc\na' | sort You can write your own text filter scripts …

MapServer PostGIS Performance

Recently I was looking at improving the performance of rendering a Space Syntax OpenMapping layer in MapServer. The openmapping_gb_v1 table is in a PostGIS database with an index on the geometry column. The original MapServer DATA configuration looked like this: DATA "wkb_geometry from (select meridian_class_scale * 10 as line_width, * from openmapping …

Postgres Information Functions

Postgres contains a wealth of functions that provide information about a database and the objects within. The System Information Functions of the official documention provides a full list. There are a huge number of functions covering a whole host of info from the current database session, privileges, function properties. Examples …

OpenLayers 2 Custom Build

A bit of a blast from the past now that OpenLayers 3 has been released but it may be useful for someone who is working on or maintaining an OpenLayer 2 project. Create a list of OpenLayers 2 classes used within a code base suitable for including in a custom …

Testing Python & Postgres

I recently pulled together a project to demonstrate testing Python functions that interact with a Postgres database . I find that this sort of thing crops up occasionally and the project is an attempt to distil the approach. The main points include: Creating a fresh temporary database via testing.postgresql prior …

Read-only Postgres database

There are times when I've needed to effectively make a Postgres database read-only, for example after loading or updating reference data. In the past I've revoked permissions from database roles to achieve this but as this post on the PostgreSQL list states, it's possible to do so by making all …

Loading PostGIS

Notes from a talk at PostGIS Day, London 20th Nov 2014. The options All support basic options such as specifying table names, schema, SRS etc. Graphical shp2pgsql-gui Graphical interface to shp2pgsql tool shipped with PostGIS to load ESRI Shapefiles via pgAdmin III. ogr2gui Graphical interface to ogr2ogr command line utility …

Practical OpenLayers 3 & Leaflet

I ran a 2 hour workshop at OSGIS 2014 introducing OpenLayers 3 and Leaflet. A hands on introduction to using OpenLayer 3 (OL3) and Leaflet to display spatial data on the web. The workshop will introduce the two libraries, the underpinning concepts and strengths of each, and take delegates through …

GNU Parallel all the things!

I've been doing a lot of data processing recently and have been looking for a way of running bulk data loads into PostGIS in parallel to make use of all available cores. The work has mainly revolved around loading national cover of Ordnance Survey OS MasterMap and VectorMap Local for …

First few months of Clojure

I've been learning a bit of Lisp on and off for a few years, I first read (about half of) Land of Lisp , then Practical Lisp then I came across Clojure a modern Lisp that runs on the JVM and since I've been reading Clojure Programming and working through koans …

Custom GeoServer GetFeatureInfo Template

The default GeoServer GetFeatureInfo Freemarker template is a simple table and doesn't work very well when displaying the content in a web map popup. It's a common requirement to change the GetFeatureInfo template to an unordered list, to capitalise the title and attribute names. Here is a sample content.ftl …

Using Leaflet with a custom projection and a MapProxy TMS

Update 2014-09-07 I've just ran a workshop based on the Astun Leaflet & and ol3 examples at OSGIS 2014 , see Practical OpenLayers 3 & Leaflet for details. Update 2014-05-15 For examples of displaying a Web Map Service (WMS) layer in a custom projection (EPSG:27700) within Leaflet and OpenLayers 3 (ol3) see …

Greyscale maps with MapServer

There have been a few times in the past (such as when I was preparing the base mapping for My Wycombe ) when I've wanted to create greyscale base mapping using MapServer . Previously I've experimented with various processing options for raster images (with varying degrees of success), converting the source images …

Disaggregate MultiLineStrings using ST_Dump PostGIS

PostGIS the spatial extension to the PostgreSQL database provides a host of functions for querying, creating and manipulating geometries within the database. ST_Dump allows you to disaggregate collection and multi geometries such as MultiPolygon and MultiLineSting easily. The example below demonstrates starting with a table that contains one row with …

Recursively delete empty directories

To recursively delete all empty directories from the command prompt in Windows. Open command prompt and change to the desired directory then enter the following: for /F "tokens=*" %f in ( 'dir /AD /S /B ^| sort /R' ) do echo rd "%f" This command generates a list of all directories and sub …

Convert a directory of TIFFs to greyscale using ImageMagick

Change to the directory then run the command: mogrify -colorspace Gray *.tif

Build OGR 1.8 with GML, WFS and PostGIS support on Ubuntu 10.04

OGR 1.8 introduces support for reading GML with feature attributes expressed as nested elements as found in Ordnance Survey's OS MasterMap as well as support for accessing WFS. This is a brief script for building OGR (GDAL) 1.8 from source as it's not currently released: Download latest daily …