Skip to content

Instantly share code, notes, and snippets.

/Users/zacmcc/.vim/
▸ autoload/
▸ backup/
▸ bundle/
▸ colors/
▸ tmp/
"
" Author: Zac McCormick
" https://github.com/zhm/macvimhax
" https://github.com/brentd/vimfiles
"
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
set nocompatible
"
" Author: Zac McCormick
" https://github.com/zhm/macvimhax
" https://github.com/brentd/vimfiles
"
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
set nocompatible
function long2tileX(lon, zoom) {
return Math.floor((lon + 180.0) / 360.0 * Math.pow(2.0, zoom));
}
function lat2tileY(lat, zoom) {
var googleY = Math.floor((1.0 - Math.log(Math.tan(lat * Math.PI/180.0) + 1.0 / Math.cos(lat * Math.PI/180.0)) / Math.PI) / 2.0 * Math.pow(2.0, zoom));
var tmsY = Math.pow(2.0, zoom) - googleY - 1;
return tmsY;
}
@zhm
zhm / RubyMakefile.mk
Created November 30, 2011 05:17
GDAL RubyMakefile for Ruby 1.9.x SWIG bindings
# This makefile generates 4 Ruby extensions - one each for
# gdal, ogr, osr, and gdalconstants. There are two important
# things to note:
#
# * It makes multiple calls to Ruby to discover the Ruby version,
# location of header files, libraries, etc. Thus Ruby must
# be on your path.
#
# * By convention Ruby method names are lower case with underscores,
# thus methods such as "GetFieldName" need to be mapped to
@zhm
zhm / RubyMakefile.mk
Created November 30, 2011 06:11
GDAL RubyMakefile for Ruby 1.9.x SWIG bindings
# This makefile generates 4 Ruby extensions - one each for
# gdal, ogr, osr, and gdalconstants. There are two important
# things to note:
#
# * It makes multiple calls to Ruby to discover the Ruby version,
# location of header files, libraries, etc. Thus Ruby must
# be on your path.
#
# * By convention Ruby method names are lower case with underscores,
# thus methods such as "GetFieldName" need to be mapped to
@zhm
zhm / gdal_ruby.i
Created November 30, 2011 06:17
GDAL Ruby 1.9 fix gdal_ruby.i
/*
* $Id$
*
* ruby specific code for gdal bindings.
*/
/*
* $Log$
* Revision 1.2 2005/09/26 08:18:55 cfis
* Copied over code from the Python version of gdal_ruby.i. Will have to port the code to Ruby.
@zhm
zhm / typemaps_ruby.i
Created November 30, 2011 06:20
GDAL Ruby 1.9 fix typemaps_ruby.i
/******************************************************************************
* $Id$
*
* Name: typemaps_ruby.i
* Project: GDAL Ruby Interface
* Purpose: GDAL Core SWIG Interface declarations.
* Author: Charles F. I. Savage
*
@zhm
zhm / gist:1414632
Created December 1, 2011 07:25
merge GeoJSON quick&dirty
var fs = require('fs');
var files = process.argv.slice(2);
var output = { type: 'LineString', coordinates: [ ] };
for (var i = 0; i < files.length; ++i) {
output.coordinates.append(JSON.parse(fs.readFileSync(files[i])).coordinates);
}
fs.writeFileSync('output.json', JSON.stringify(output, null, '\t'));
for file in ~/postgres_backups/*
do
dbname=$(basename $file | sed s/\.gz//g)
createdb $dbname
gunzip -c $file | sed 's/Library\/PostgreSQL\/9.0\/lib\/postgis-1.5/usr\/local\/Cellar\/postgresql\/9.1.3\/lib\/postgis-1.5/g' | psql $dbname
done