Skip to content

Instantly share code, notes, and snippets.

View johnbaums's full-sized avatar

John johnbaums

  • University of Melbourne
  • Melbourne
View GitHub Profile
@johnbaums
johnbaums / awazon-linux-gdal-installation.sh
Created October 24, 2019 03:55 — forked from hervenivon/awazon-linux-gdal-installation.sh
Install GEOS, PROJ4 & GDAL on amazon linux
export PYTHON_VERSION=3.4.3
export PYTHON_SHORT_VERSION=3.4
export GEOS_VERSION=3.6.2
export GDAL_VERSION=2.2.2
export PROJ4_VERSION=4.9.3
sudo yum-config-manager --enable epel
sudo yum install gdal-python
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
@johnbaums
johnbaums / inset.R
Created June 2, 2017 05:02 — forked from oscarperpinan/inset.R
Inset graphics with rasterVis and grid
library(raster)
library(rasterVis)
library(grid)
r <- raster(system.file("external/test.grd", package="raster"))
## Main graphic
p1 <- levelplot(r)
## Inset graphic
p2 <- levelplot(r,
margin = FALSE,
@johnbaums
johnbaums / multi2single.py
Created November 8, 2016 05:45 — forked from lptorres/multi2single.py
A simple script that converts shapefiles with multipart polygons into singlepart polygons, and copies the fields of the source shapefile. This script is based on a script by Paolo Corti, found here: https://gist.github.com/anonymous/735330 The original script only converts multipolygons by creating a new feature for each part of a multipolygon. …
import os
from osgeo import gdal, ogr, osr
import sys
def initFields(in_lyr, out_lyr):
#Arbitrarily get the first feature
feat = in_lyr[0]
#loop over each field