Skip to content

Instantly share code, notes, and snippets.

View eightysteele's full-sized avatar

Aaron Steele eightysteele

View GitHub Profile
@eightysteele
eightysteele / gist:1201349
Created September 7, 2011 18:39
Patch for caching OAuth 2.0 credentials
Index: src/ftclient.py
===================================================================
--- src/ftclient.py (revision 22)
+++ src/ftclient.py (working copy)
@@ -15,6 +15,12 @@
import authorization.oauth
except: pass
+import httplib2
+from oauth2client.file import Storage
Build failed:
-> task failed (err #1):
{task: cxx mapnik_geometry.cpp -> mapnik_geometry_1.o}
-> task failed (err #1):
{task: cxx mapnik_image.cpp -> mapnik_image_1.o}
npm ERR! error installing mapnik@0.5.5 Error: mapnik@0.5.5 install: `node-waf -v configure build`
npm ERR! error installing mapnik@0.5.5 `sh "-c" "node-waf -v configure build"` failed with 1
npm ERR! error installing mapnik@0.5.5 at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing mapnik@0.5.5 at ChildProcess.emit (events.js:45:17)
npm ERR! error installing mapnik@0.5.5 at ChildProcess.onexit (child_process.js:171:12)
$ npm install Windshaft/
> hiredis@0.1.12 preinstall /home/eighty/Dropbox/windshaft/node_modules/windshaft/node_modules/grainstore/node_modules/hiredis
> make || gmake
cd deps/hiredis && make static
make[1]: Entering directory `/home/eighty/Dropbox/windshaft/node_modules/windshaft/node_modules/grainstore/node_modules/hiredis/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
> srs@0.2.7 install /home/eighty/Dropbox/windshaft/node_modules/windshaft/node_modules/grainstore/node_modules/srs
$ node examples/readme_server.js
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'tilelive-mapnik'
at Function._resolveFilename (module.js:290:11)
at Function._load (module.js:242:25)
at require (module.js:318:19)
at Object.<anonymous> (/home/eighty/Dropbox/windshaft/Windshaft/lib/windshaft/render_cache.js:9:1)
<PAMDataset>
<Metadata/>
<Metadata domain="ESRI">
<MDI key="PyramidResamplingType">NEAREST</MDI>
</Metadata>
<PAMRasterBand band="1">
<Histograms>
<HistItem>
<HistMin>-0.5</HistMin>
<HistMax>255.5</HistMax>
var Windshaft = require('../lib/windshaft'),
config = {
base_url: '/database/:dbname/table/:table',
req2params: function(req, callback)
{
req.params.geom_type = 'multipolygon';
callback(null, req);
},
grainstore: {
datasource: {
# npm install mapnik
> mapnik@0.5.5 install /usr/local/src/Windshaft/node_modules/mapnik
> node-waf -v configure build
Setting srcdir to : /usr/local/src/Windshaft/node_modules/mapnik
Setting blddir to : /usr/local/src/Windshaft/node_modules/mapnik/build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
#!/usr/bin/env python
import csv
import tempfile
def generator(reader):
"""Generates dictionaries from a DictReader that contain only 'a' and 'b' keys."""
cols = ['a', 'b']
for row in reader:
yield dict((key,val) for key,val in row.iteritems() if key in cols)
# Rename .dbf file temporarily
dbf_filename = '%s.dbf' % sf
dbf_filename_temp = '%s~' % dbf_filename_temp
os.rename(dbf_filename, dbf_filename_temp)
# Create the .dbf blank (it has no fields)
w = shapefile.Writer(shapefile.POLYGONM)
w.poly(parts=[[[1,5],[5,5],[5,1],[3,3],[1,1]]])
w.save(dbf_filename)
SELECT rid, band, (stats).* FROM (SELECT rid, band, ST_SummaryStats(rast, band) As stats FROM bioclim10_29 CROSS JOIN generate_series(1,3) As band WHERE rid=2) As foo;