Skip to content

Instantly share code, notes, and snippets.

View eightysteele's full-sized avatar

Aaron Steele eightysteele

View GitHub Profile
{
"_id":"0-12736",
"_rev":"1-b5615b9a2648d5518be35c9e2d47c42a",
"b":[
[
"-180",
"-16.1333333"
],
[
"-179.9912754",
{
"url": "http://www.cellmapper.net/api/v2/json.php?action=getTowers&data[MCC]=202&data[MNC]=1&data[LAC]=1002"
"action":"getTowers",
"data":[
{
"base":"33",
"visible":1,
"latitude":37.945139540016,
"longitude":23.658307831007
},
@eightysteele
eightysteele / and_it_works.json
Created November 10, 2011 17:42
MOL search JSON response for 'Camelus'
{
"layers":{
"0":{
"name":"Perdix concolor",
"source":"aaron",
"type":"ecoregion"
},
"1":{
"name":"Perdix hodgsoniae",
"source":"cody",
import subprocess
import shlex
import glob
command = "gdal_translate -of GTiff %s %s.tif"
for bil in glob.glob('*.bil'):
subprocess.call(shlex.split(command % (bil, bil)))
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;
# 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)
#!/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)
# npm install mapnik
> [email protected] 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
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: {
<PAMDataset>
<Metadata/>
<Metadata domain="ESRI">
<MDI key="PyramidResamplingType">NEAREST</MDI>
</Metadata>
<PAMRasterBand band="1">
<Histograms>
<HistItem>
<HistMin>-0.5</HistMin>
<HistMax>255.5</HistMax>