Skip to content

Instantly share code, notes, and snippets.

View kapadia's full-sized avatar
💭
eating a pecan bar

Amit Kapadia kapadia

💭
eating a pecan bar
View GitHub Profile
import click
import rasterio as rio
@click.command()
@click.argument('src_path', type=click.Path(exists=True))
@click.argument('dst_path', type=click.Path(exists=False))
def to_png(src_path, dst_path):
with rio.drivers():
@kapadia
kapadia / getpreview
Last active August 29, 2015 14:13
Generate preview images and upload to S3
#!/bin/bash
set -eou pipefail
function usage() {
echo ""
echo "Utility for generating preview images and uploading to S3. This script is meant to be"
echo "used in a remote environment (e.g. EC2). The environment variable WORKING_BUCKET must be"
echo "defined to an S3 bucket, of which you have access."
echo ""
var gdal = require('gdal');
module.exports = {};
module.exports.reproject = reproject;
var dstwkt = "PROJCS['WGS 84 / Pseudo-Mercator', GEOGCS['WGS 84', DATUM['WGS_1984', SPHEROID['WGS 84',6378137,298.257223563, AUTHORITY['EPSG','7030']], AUTHORITY['EPSG','6326']], PRIMEM['Greenwich',0], UNIT['degree',0.0174532925199433], AUTHORITY['EPSG','4326']], PROJECTION['Mercator_1SP'], PARAMETER['central_meridian',0], PARAMETER['scale_factor',1], PARAMETER['false_easting',0], PARAMETER['false_northing',0], UNIT['metre',1, AUTHORITY['EPSG','9001']], EXTENSION['PROJ4','+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], AUTHORITY['EPSG','3857']]";
var proj4wm = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs";
function reproject(srcpath, dstpath, callback) {
@kapadia
kapadia / compare_geotiffs.py
Last active August 29, 2015 14:14
Compare geotiffs
import sys
import numpy as np
import rasterio as rio
def compare(srcpath1, srcpath2):
with rio.drivers():
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env node
var turf = require('turf');
function usage() {
console.log('Usage: ./buffer-point [lat] [lng] [distance]\n');
}
process.argv.shift();
process.argv.shift();