Skip to content

Instantly share code, notes, and snippets.

View andrewharvey's full-sized avatar

Andrew Harvey andrewharvey

View GitHub Profile
@andrewharvey
andrewharvey / tilecache_cache_size_
Created August 28, 2011 02:07
Munin Plugin to monitor the disk usage of a TileCache Disk Cache
#!/bin/bash
# This is a Munin plugin to report the disk usage of TileCache disk caches.
# Use it by linking with the name tilecache_cache_size_LAYERNAME
# The "standard" way to install this script for Munin is to place it in /usr/share/munin/plugins/
# and then run (replacing LAYERNAME with the TileCache layer name as in tilecache.cfg)
# ln -s -T /usr/share/munin/plugins/tilecache_cache_size_ /etc/munin/plugins/tilecache_cache_size_LAYERNAME
# Author: Andrew Harvey <andrew.harvey4@gmail.com>
@andrewharvey
andrewharvey / 3d-nearmap.html
Created September 4, 2011 11:18
A web map based on Polymaps delivering a 3D experience for viewing NearMap aerial imagery
<!--
This page licensed CC0 http://creativecommons.org/publicdomain/zero/1.0/
Some of the javascript code based of examples at http://polymaps.org/ex/
This is just a prototype/technology test. It probably isn't the cleanest solution...
TODO:
* Ctrl + click and drag should rotate the map just like the keys do
* add perspective option
-->
@andrewharvey
andrewharvey / leaflet-side-by-side.html
Created September 5, 2011 11:11
Demo web app displaying two web maps side by side in sync with each other based on Leaflet
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
This file is licenced CC0 http://creativecommons.org/publicdomain/zero/1.0/
-->
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Leaflet Maps Side by Side</title>
<link rel="stylesheet" href="/javascript/leaflet/leaflet.css" type="text/css" />
<!--[if lte IE 8]><link rel="stylesheet" href="/javascript/leaflet/leaflet.ie.css" /><![endif]-->
<style type="text/css">
@andrewharvey
andrewharvey / configure.py
Created September 14, 2011 11:02
Carto stylesheet; Cycle focused overlay based on OSM data
#!/usr/bin/env python
# Copyright (c) 2011, Development Seed, Inc.
# 2011, Andrew Harvey <andrew.harvey4@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
@andrewharvey
andrewharvey / mapnik_render_static_map.py
Created October 16, 2011 10:31
Render a static map using Mapnik given centre, zoom and image width/height.
#!/usr/bin/env python
# This script is like generate_image.py from the OSM Mapnik code,
# but it renders based on a given centre point, zoom and final image pixel size
# Author: Andrew Harvey <andrew.harvey4@gmail.com>
# License: CC0 http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
@andrewharvey
andrewharvey / osm-wireframe-bw.mml
Created October 23, 2011 09:10
A wireframe stylesheet written in carto for OSM data
{
"bounds": [
-180,
-85.05112877980659,
180,
85.05112877980659
],
"center": [
0,
0,
@andrewharvey
andrewharvey / fullsql2singleline-noas.sh
Created October 29, 2011 09:49
Converts a multi-line formatted SQL query into an escaped single line string for inclusion in a JSON based MML file.
#!/bin/sh
# Converts a multi-line formatted SQL query into an escaped single line string
# for inclusion in a JSON based MML file.
# Reads from stdin and writes to stdout.
sed '{:q;N;s/\n/\\n/g;t q}'
@andrewharvey
andrewharvey / bom-radar-fetch.pl
Created November 5, 2011 00:48
Fetches BOM.gov.au radar images giving us a local mirror, including historical data.
#!/usr/bin/perl -w
# Fetches BOM.gov.au radar images giving us a local mirror, including historical
# data.
#
# Radar images are updated every 10 minutes, but the BOM only keep the last
# hour and 10 minutes worth of radar images on their FTP server. With this in
# mind I would recommend running this script anywhere from minutely to hourly.
#
# This script is licensed CC0 by Andrew Harvey <andrew.harvey4@gmail.com>
@andrewharvey
andrewharvey / Makefile
Created November 27, 2011 10:38
Given a list of OSM meta-tiles, render the meta-tile using Mapnik, and chop up the tile using ImageMagick.
CXX = g++
CXXFLAGS = $(shell mapnik-config --cflags) $(shell Magick++-config --cxxflags --cppflags) -Wall
LDFLAGS = $(shell mapnik-config --libs --dep-libs --ldflags) $(shell Magick++-config --ldflags --libs) -lboost_program_options -lpthread
OBJ = mapnik_osm_metatiles.o
BIN = render_mapnik_osm_metatiles
all : $(BIN)
@andrewharvey
andrewharvey / logrotatecat
Created December 15, 2011 09:34
cat's a bunch of log rotate log files in correct order
#!/bin/bash
# using,
#
# ./logrotatecat access.log
#
# inside a directory of log rotate logs in a form like
#
# access.log
# access.log.1