Skip to content

Instantly share code, notes, and snippets.

robinkraft /
Created Jun 24, 2014
compile and install GEOS, PROJ4 and GDAL from source on Ubuntu 12.0.4
# Compile/install GEOS. Taken from:
cd /tmp
bunzip2 geos-3.4.2.tar.bz2
tar xvf geos-3.4.2.tar
cd geos-3.4.2
robinkraft /
Created Dec 12, 2014
get the area in square meters of a polygon using shapely and pyproj
import pyproj
from shapely.geometry import shape
from shapely.ops import transform
geom = {'type': 'Polygon',
'coordinates': [[[-122., 37.], [-125., 37.],
[-125., 38.], [-122., 38.],
[-122., 37.]]]}
s = shape(geom)
minikube stop; minikube delete &&
docker stop $(docker ps -aq) &&
rm -rf ~/.kube ~/.minikube &&
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
launchctl stop '*kubelet*.mount' &&
launchctl stop localkube.service &&
launchctl disable localkube.service &&
sudo rm -rf /etc/kubernetes/ &&
docker system prune -af --volumes
robinkraft /
Last active Oct 24, 2021
Simple python script to calculate size of S3 buckets
import sys
import boto
# based on
# assumes you've already configured your access id & secret key
s3 = boto.connect_s3()
robinkraft / gist:4d1807fb8f9c246b2d21
Last active Jan 16, 2021
installing opencv 2.4.10
View gist:4d1807fb8f9c246b2d21
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev
robinkraft / gist:1413347
Created Dec 1, 2011
the easy way to install GDAL 1.8.0 on Ubuntu
View gist:1413347
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin
sudo apt-get -y install python-gdal
robinkraft /
Last active Apr 20, 2020
Unofficial client for the satellite image catalog and API, originally part of Planet's quickstart guides.
#!/usr/bin/env python
import argparse
import os
import requests
import json
import sys
import logging
import datetime
robinkraft /
Created Feb 10, 2012
Load hdf file with GDAL and Python, get NDVI
from osgeo import gdal
import os
layer_dict = {"reli":"reliability", "qual":"Quality", "ndvi":"NDVI", "evi":"EVI"}
def print_data(layer, data):
print data
print "data:", layer
print "type:", data.dtype
print "mean:", data.mean()
robinkraft / domino_event_log_5c777df946e0fb0008ada92c_condensed.json
Created Feb 28, 2019
cat ~/Downloads/domino_event_log_5c777df946e0fb0008ada92c.json | jq ".[].description"
View domino_event_log_5c777df946e0fb0008ada92c_condensed.json
"Request to deploy app with id 5c777df946e0fb0008ada92c"
"Deploying app with id 5c777df946e0fb0008ada92c"
"Deployment created: run-5c777df946e0fb0008ada92c"
"Pod created: run-5c777df946e0fb0008ada92c-6794d486b8-sxsp4"
"Scaled up replica set run-5c777df946e0fb0008ada92c-6794d486b8 to 1"
"Successfully assigned run-5c777df946e0fb0008ada92c-6794d486b8-sxsp4 to"
"Pod updated: run-5c777df946e0fb0008ada92c-6794d486b8-sxsp4"
"Deployment updated: run-5c777df946e0fb0008ada92c"
"Deployment updated: run-5c777df946e0fb0008ada92c"
"Pod updated: run-5c777df946e0fb0008ada92c-6794d486b8-sxsp4"
robinkraft /
Last active Jan 16, 2019
Burn scar algorithm for Google Earth Engine, derived from Elvidge and Baugh (2014).

Set up for update

  1. Go to fires download page -
  2. Zoom to Sumatra. It doesn't have to be perfect. We do some screening in EE to make sure there are no fires in Malaysia used.
  3. Submit the download request (2013-03-30 to present) - csv is easiest - then wait for it to complete (usually < 30 minutes)
  4. Upload the CSV file to Fusion Tables. Go here, then just click "new table" under the File menu and follow the instructions.
  5. Get the docid from the url. For example, for docid=1SzJl73nj5IPVEOGqhGc8uv5Vkwb504uqK_YTnVGh just grab 1SzJl73nj5IPVEOGqhGc8uv5Vkwb504uqK_YTnVGh
  6. Update dates in this script when you run it on EE - the second date in the POST variable may need to be extended.
  7. Update the FIRES variable to equal to "ft:". You'll see how it is in the code.

Run + export