Skip to content

Instantly share code, notes, and snippets.


Andrew Harvey andrewharvey

View GitHub Profile
andrewharvey /
Created Jun 27, 2020
Termux Shortcuts to start/stop LG360 Mapillary Interval Capture. Place contents in termux home .shortcuts directory. You can then add a shortcut to these scripts to the homescreen as a widget.
setoptions=`curl \ -X POST \ --header 'Content-Type: application/json' \ --data '{ "name": "camera.setOptions", "parameters": { "options": { "captureMode": "interval", "captureInterval": 2 } }}' \ | jq '.state'`
startcapture=`curl \ -X POST \ --header 'Content-Type: application/json' \ --data '{"name": "camera.startCapture"}' \ | jq '.state'`
termux-toast -g bottom "$setoptions - $startcapture"
andrewharvey / leaflet-side-by-side.html
Created Sep 5, 2011
Demo web app displaying two web maps side by side in sync with each other based on Leaflet
View leaflet-side-by-side.html
<html xmlns="">
This file is licenced CC0
<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/" /><![endif]-->
<style type="text/css">
andrewharvey /
Created May 2, 2020
Shell script to get the native zoom of a raster
WIDTH=`gdalinfo -json $FILE | jq .size[0]`
MINX=`gdalinfo -json $FILE | jq .wgs84Extent.coordinates[0][0][0]`
MAXX=`gdalinfo -json $FILE | jq .wgs84Extent.coordinates[0][2][0]`
MAXZOOM=`echo "l( ( 360 * $WIDTH ) / ( 256 * ( $MAXX - $MINX ) ) ) / l(2)" | bc -l | perl -nl -MPOSIX -e 'print ceil($_);'`
# 2^n tiles at zoom n
# therefore 2^n * 256 pixels of width for the world at zoom n
# therefore 360 / (2^n * 256) degrees per pixel at zoom n
andrewharvey / 34M_17.bin
Last active Apr 21, 2020
Add 3D model to a Mapbox GL JS map
View 34M_17.bin
This file has been truncated, but you can view the full file.
andrewharvey /
Created Oct 16, 2011
Render a static map using Mapnik given centre, zoom and image width/height.
#!/usr/bin/env python
# This script is like from the OSM Mapnik code,
# but it renders based on a given centre point, zoom and final image pixel size
# Author: Andrew Harvey <>
# License: CC0
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
andrewharvey /
Last active Feb 9, 2020
Airborne Research Australia Bushfire 2020 Imagery processing for OpenStreetMap
andrewharvey / index.geojson
Created Feb 9, 2020
ARA Bushfire Imagery KI/KH Coverage Footprint
View index.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
andrewharvey /
Last active Jan 18, 2020
Maxar 2020 Australian Bushfire Imagery
andrewharvey /
Created Jan 7, 2020
Compare a road network to OpenStreetMap
osmium tags-filter new_south_wales.osm.pbf w/highway -o nsw-roads.osm.pbf
osmium export -o nsw-roads.geojson nsw-roads.osm.pbf
ogr2ogr -f GPKG nsw-roads.gpkg nsw-roads.geojson
ogr2ogr -dialect OGRSQL -sql "SELECT geom FROM \"nsw-roads\" WHERE OGR_GEOMETRY='LineString'" nsw-roads.shp nsw-roads.gpkg

# in QGIS
# Vector > Geoprocessing Tools > Buffer
# buffer distance 0.0005
andrewharvey / index.html
Last active Nov 27, 2019
Mapbox GL JS Marker Offset Example
View index.html
<!DOCTYPE html>
<meta charset='utf-8' />
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='mapbox-gl-dev.js'></script>
<link href='' rel='stylesheet' />
body { margin:0; padding:0; }