Skip to content

Instantly share code, notes, and snippets.

@conorsg
conorsg / geocode-a-csv.py
Created October 1, 2014 21:30
makes calls to Google's geocode API down a column of addresses in a csv, writes the lat long on back
#!/usr/bin/env python
import json
import urllib2
import csv
api_key = 'YOUR_API_KEY'
with open('FILE.csv', 'rU') as f:
reader = csv.reader(f)
@jczaplew
jczaplew / README.md
Last active August 29, 2015 14:19
Rolling tiles with mapnik + tilestache instead of Tilemill

Rolling tiles sans Tilemill

Perhaps you've had problems programmatically creating tiles with Tilemill, or are concerned about the future stability of project (or you just like playing with geo software).

Install mapnik and TileStache

brew install mapnik --with-gdal --with-postgresql
sudo pip install -U PIL modestmaps simplejson werkzeug
git clone https://github.com/TileStache/TileStache.git TileStache
cd TileStache
@jccovey
jccovey / import_tumblr_to_jekyll.rb
Created October 20, 2009 23:31 — forked from julesfern/import_tumblr_to_jekyll.rb
Quick script to import tumblr posts to jekyll markdown'd posts
#!/usr/bin/env ruby
# Script to import tumblr posts into local markdown posts ready to be consumed by Jekyll.
# Inspired by New Bamboo's post http://blog.new-bamboo.co.uk/2009/2/20/migrating-from-mephisto-to-jekyll
require 'rubygems'
require 'open-uri'
require 'nokogiri'
# Configuration
@dwins
dwins / find_nulls.py
Created March 28, 2011 19:18
test geoserver config using gsconfig.py
#! /usr/bin/env python
from geoserver.catalog import Catalog
cat = Catalog('http://host/geoserver/rest', 'user', 'password')
def internal_name(s):
return s.startswith("__") and s.endswith("__")
def check(x):
@springmeyer
springmeyer / mapnik2.rb
Created May 20, 2011 21:42
mapnik2 homebrew formula
require 'formula'
class Mapnik2 < Formula
head 'http://svn.mapnik.org/trunk/', :using => :svn
homepage 'http://www.mapnik.org/'
depends_on 'pkg-config' => :build
depends_on 'scons' => :build
depends_on 'libtiff'
depends_on 'jpeg'
@iandees
iandees / gist:1215596
Created September 14, 2011 00:53
A script to keep an osm2pgsql database running with minutely diffs and osmosis.
#!/bin/bash
set -e
# Initialize timestamp with day of latest planet dump
# Setting to midnight ensures we get conistent data after first run
# osmosis --read-replication-interval-init
OSMOSIS_PATH=/home/iandees/osmosis-SNAPSHOT-r25995
OSMOSIS_WORKDIR=/home/iandees/.osmosis
OSM2PGSQL_PATH=/home/iandees/osm2pgsql
@ingenieroariel
ingenieroariel / geonode_restrict.py
Created November 22, 2011 19:40
Make all maps and layers private in a GeoNode
from geonode.core.models import AUTHENTICATED_USERS, ANONYMOUS_USERS
def restrict(item):
"""Works with GeoNode Map and Layer objects to disable unauthenticated access.
"""
item.set_gen_level(ANONYMOUS_USERS, item.LEVEL_NONE)
item.set_gen_level(AUTHENTICATED_USERS, item.LEVEL_READ)
def publish(item):
"""Works with GeoNode Map and Layer objects to enable unauthenticated access.
@frewsxcv
frewsxcv / simple_convert_image.sh
Created January 11, 2012 19:34
Taken from ami-07db196e to assist in OpenAerialMap workflow
#!/bin/sh
export GDAL_TIFF_INTERNAL_MASK=YES
nearblack -co TILED=YES -setmask -nb 0 -of GTiff -o ./prewarp.tif $1
gdalwarp -co TILED=YES -dstalpha -t_srs EPSG:4326 prewarp.tif warped.tif
rm prewarp.tif
gdal_translate -co TILED=YES -co JPEG_QUALITY=80 -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -b 1 -b 2 -b 3 -mask 4 warped.tif final.tif
rm warped.tif
gdaladdo final.tif 2 4 8 16 32 64 128 256
mv final.tif ${1}_converted.tif
@frewsxcv
frewsxcv / gist:1628357
Created January 17, 2012 19:33 — forked from oeon/oam.sh
OAM batch script
#!/bin/sh
export GDAL_TIFF_INTERNAL_MASK=YES
for f in /media/LAR_HD/6Inch/*.tif
do
nearblack -co TILED=YES -setmask -nb 0 -of GTiff -o ./prewarp.tif $f
gdalwarp -co TILED=YES -dstalpha -s_srs EPSG:2229 -t_srs EPSG:4326 prewarp.tif warped.tif
rm prewarp.tif
gdal_translate -co TILED=YES -co JPEG_QUALITY=80 -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -b 1 -b 2 -b 3 -mask 4 warped.tif final.tif
Building GDAL 1.9 with MDB (PGeo) support on OS X Lion
- Download and install the "Java for Mac OS X 10.7 Update 1 Developer Package" from https://developer.apple.com/downloads/index.action
- Download jackcess-1.2.6.jar from http://sourceforge.net/projects/jackcess/files/jackcess/1.2.6/jackcess-1.2.6.jar/download
- Download http://mdb-sqlite.googlecode.com/files/mdb-sqlite-1.0.2.tar.bz2 to get commons-lang-2.4.jar and commons-logging-1.1.1.jar. They will go alongside jackcess in the $CLASSPATH after it builds.
- In the GDAL source root, edit the configure.in and replace it with https://gist.github.com/1975654