Skip to content

Instantly share code, notes, and snippets.

View barryrowlingson's full-sized avatar

Barry Rowlingson barryrowlingson

View GitHub Profile
@barryrowlingson
barryrowlingson / p.R
Created January 3, 2019 09:48
st_intersection failure
structure(list(structure(list(structure(c(313618.72893863, 313576.734104046,
313534.739269463, 313513.741852171, 313492.744434879, 313450.749600295,
313429.752183003, 313408.754765711, 313387.75734842, 313387.75734842,
313366.759931128, 313366.759931128, 313366.759931128, 313366.759931128,
313366.759931128, 313366.759931128, 313366.759931128, 313366.759931128,
313366.759931128, 313366.759931128, 313366.759931128, 313387.75734842,
313387.75734842, 313387.75734842, 313387.75734842, 313387.75734842,
313387.75734842, 313387.75734842, 313387.75734842, 313387.75734842,
313408.754765711, 313408.754765711, 313429.752183003, 313429.752183003,
313471.747017587, 313471.747017587, 313471.747017587, 313471.747017587,
@barryrowlingson
barryrowlingson / load_xyz_sources.py
Created February 27, 2018 16:00 — forked from ThomasG77/load_xyz_sources.py
PyQGIS script to save/load/wipe XYZ sources in Browser Panel in QGIS3
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : XYZ manager
Description : Script to save/load/wipe WYZ sources in QGIS 3.0
Date : February 27, 2017
copyright : (C) 2017 by Thomas Gratier
email : thomas.gratier@webgeodatavore.com
@barryrowlingson
barryrowlingson / tmap.rmd
Created October 13, 2017 17:32
R markdown that has a problem with tmap_arrange..
> packageVersion("tmap")
[1] ‘1.8’
> packageVersion("rmarkdown")
[1] ‘1.5’

Keybase proof

I hereby claim:

  • I am barryrowlingson on github.
  • I am barryrowlingson (https://keybase.io/barryrowlingson) on keybase.
  • I have a public key ASD1X0bEweQRNCUeS6Tv534W0w5idfd2lbqZNzERGoR2vgo

To claim this, I am signing this object:

from functools import wraps
# create an empty dict for the registry.
registry = {}
# a decorator that adds a dict entry 'path': handler_function to the
# registry
def register(path):
def qregister(handler_function):
docker run --rm rocker/ropensci uname -a > install_numpy.txt
Linux bfde0c78b98c 3.19.0-65-generic #73~14.04.1-Ubuntu SMP Wed Jun 29 21:05:22 UTC 2016 x86_64 GNU/Linux
docker run --rm rocker/ropensci pip install -v numpy >> install_numpy.txt
Downloading/unpacking numpy
Ignoring link https://pypi.python.org/packages/32/66/cb46f2b9af0f7e25af51b4ba72d7ebf27626add5b8faefd452eb438da2c3/numpy-1.11.2rc1.zip#md5=dc6351ae9b5b4fa7365d80a7c1d570f1 (from https://pypi.python.org/simple/numpy/), version 1.11.2rc1 is a pre-release (use --pre to allow).
Ignoring link https://pypi.python.org/packages/48/c2/7de8225df3863a0478f7a029e4f81749c58a71ff76f9e5fee6227bfee9e5/numpy-1.11.0rc2.zip#md5=a97d4a0fb32876f1e1857cef87cccc8a (from https://pypi.python.org/simple/numpy/), version 1.11.0rc2 is a pre-release (use --pre to allow).
Ignoring link https://pypi.python.org/packages/48/c6/05229df054c43f2415347fb4039f403ae043fd9e5519c2c2c535855a8da8/numpy-1.11.0rc2.tar.gz#md5=5cacb742522b42ae695ec4e30c21bc12 (from https://pypi.pyth
@barryrowlingson
barryrowlingson / ggfail.R
Last active January 29, 2018 15:50 — forked from anonymous/ggfail.R
polygon clipping in ggplot
library(sp)
library(rgdal)
library(ggplot2)
library(spdep)
library(ggpolypath)
usq = data.frame(x=c(0,1,1,0),y=c(0,0,1,1))
pts1 =
structure(list(x = c(-0.380226816911908, -0.368506824640174,
@barryrowlingson
barryrowlingson / topdf
Last active August 29, 2015 14:22
convert a bunch of docs to pdf
#!/bin/sh
for f in $* ; do
libreoffice "-env:UserInstallation=file:///tmp/LibO_Conversion" --headless --invisible --convert-to pdf "$f"
done
rm -rf /tmp/LibO_Conversion
@barryrowlingson
barryrowlingson / nn.R
Created April 15, 2015 15:33
computing nearest neighbours with RANN
## lets use this nearest neighbour package:
require(RANN)
## create a village as a cluster of houses around x,y:
village <- function(x, y, n, id, sd){
## return a data frame of x, y, and id values:
data.frame(x=x+rnorm(n,0,sd),
y=y+rnorm(n,0,sd),
id=id
)
@barryrowlingson
barryrowlingson / fixmap.R
Last active May 16, 2016 14:41
Save leaflet maps to one place and use LiveReload
'''
Maps...
Normally when using the leaflet package you do:
leaflet(data) %>% addTiles() %>% addPolygons()
and the html is saved in a new place and your web browser gets another tab appear.
After the 26th attempt to get the map right I have 25 tabs to close.