Skip to content

Instantly share code, notes, and snippets.

@davidvhill
davidvhill / Partition
Created April 5, 2017 18:21
partition code in python
""" Functions to drive algorithm execution in Apache Spark.
All coordinates are handled according to GeoJSON specifications.
http://geojson.org/geojson-spec.html"""
import geojson
import itertools
import math
def bbox(multipoint):
@davidvhill
davidvhill / docker-super-clean
Created December 8, 2016 21:37
Remove all docker containers and images
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@davidvhill
davidvhill / gdal_mmap.py
Last active July 14, 2016 18:31 — forked from jleinonen/gdal_mmap.py
GDAL in memory results
# also: https://pcjericks.github.io/py-gdalogr-cookbook/vector_layers.html#load-data-to-memory
# another, maybe better approach to this is to use the gdal 'MEM' driver and then use
# sds.ReadRaster() and sds.WriteRaster() to get at the bytes.
# >>> from osgeo import gdal
# >>> driver = gdal.GetDriverByName('MEM')
# >>> sds = driver.Create('', 200, 300, 4)
# >>> sds.ReadRaster()
# If specifying gzip encoding and transferring the image results via body this way,