Skip to content

Instantly share code, notes, and snippets.

View andrewharvey's full-sized avatar

Andrew Harvey andrewharvey

View GitHub Profile
@andrewharvey
andrewharvey / LG360.StartInterval.sh
Created June 27, 2020 14:36
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.
!/bin/sh
setoptions=`curl \ -X POST \ --header 'Content-Type: application/json' \ --data '{ "name": "camera.setOptions", "parameters": { "options": { "captureMode": "interval", "captureInterval": 2 } }}' \ http://192.168.43.1:6624/osc/commands/execute | jq '.state'`
startcapture=`curl \ -X POST \ --header 'Content-Type: application/json' \ --data '{"name": "camera.startCapture"}' \ http://192.168.43.1:6624/osc/commands/execute | jq '.state'`
termux-toast -g bottom "$setoptions - $startcapture"
@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 / maxzoom.sh
Created May 2, 2020 07:13
Shell script to get the native zoom of a raster
#!/bin/bash
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
andrewharvey / 34M_17.bin
Last active April 21, 2020 09:15
Add 3D model to a Mapbox GL JS map
This file has been truncated, but you can view the full file.
@andrewharvey
andrewharvey / README.md
Last active February 9, 2020 13:26
Airborne Research Australia Bushfire 2020 Imagery processing for OpenStreetMap
@andrewharvey
andrewharvey / index.geojson
Created February 9, 2020 00:50
ARA Bushfire Imagery KI/KH Coverage Footprint
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrewharvey
andrewharvey / README.md
Last active January 18, 2020 23:40
Maxar 2020 Australian Bushfire Imagery
@andrewharvey
andrewharvey / README.md
Created January 7, 2020 07:05
Compare a road network to OpenStreetMap
wget http://download.openstreetmap.fr/extracts/oceania/australia/new_south_wales.osm.pbf
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
andrewharvey / index.html
Created November 12, 2019 10:27
Mapbox GL JS Workshop Custom Layer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/three@0.106.2/build/three.min.js'></script>
<script src="https://unpkg.com/three@0.106.2/examples/js/loaders/GLTFLoader.js"></script>
@andrewharvey
andrewharvey / index.html
Created November 12, 2019 03:53
Mapbox GL JS Workshop
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.css' rel='stylesheet' />
<style>
body {