Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Harvey andrewharvey

View GitHub Profile
@andrewharvey
andrewharvey / SideWalksPlus.mapcss
Created June 28, 2021 11:13
Sidewalks Plus JOSM Map Style, derived from https://josm.openstreetmap.de/wiki/Styles/Sidewalks with enhanced :left :right and separate support.
View SideWalksPlus.mapcss
meta {
title: "Sidewalks Plus";
description: "Visualizes the sidewalk attribute of highways. sidewalk=* is rendered as a thick dashed line, separately mapped sidewalks tagged footway=sidewalk are rendered thicker.";
link: "https://wiki.openstreetmap.org/wiki/Key:sidewalk";
author: "Cobra;Aharvey";
version: "0.7_2021-06-28";
min-josm-version: "4399";
}
meta[lang=de] {
@andrewharvey
andrewharvey / listFontsByStyle.js
Last active April 20, 2021 12:33
Lists fonts used within a Mapbox account, which fonts each Style is using, and which Styles are using each font. Useful for knowing which fonts you can clear out of your account to keep under the 100 fonts limit.
View listFontsByStyle.js
#!/usr/bin/env node
/* eslint-disable */
const MapboxClient = require('.');
const MapboxStyles = require('./services/styles');
const MapboxFonts = require('./services/fonts');
const fs = require('fs');
const fontsService = MapboxFonts({ accessToken: process.env.MAPBOX_ACCESS_TOKEN });
View steer-clear.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrewharvey
andrewharvey / feed.sh
Created July 21, 2020 06:40
ArcGIS Rest Services Listing as FeedJSON
View feed.sh
#!/bin/sh
wget -O - 'http://data.actmapi.act.gov.au/arcgis/rest/services/actmapi/?f=pjson' | jq '{"version": "https://jsonfeed.org/version/1", "title": "data.actmapi services", "home_page_url": "http://data.actmapi.act.gov.au/arcgis/rest/services/actmapi/?f=pjson", "items": [.services[].name | {"id": ., "content_text": .}]}' > feed.json
@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.
View LG360.StartInterval.sh
!/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 / maxzoom.sh
Created May 2, 2020 07:13
Shell script to get the native zoom of a raster
View maxzoom.sh
#!/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 / index.md
Last active February 21, 2022 08:12
Comparison of point and box spatial index libraries for JavaScript
View index.md
Library Static / Dynamic Cartesian / Geographic kNN Index containing points Index containing boxes Within radius
rbush dynamic 🗺️ cartesian ✔️ ✔️
rbush-knn dynamic 🗺️ cartesian ✔️ ✔️ ✔️ ✔️
kdbush static 🗺️ cartesian ✔️ ✔️
geokdbush static 🌏 geo ✔️ ✔️ ✔️
flatbush static 🗺️ cartesian ✔️ ✔️ ✔️ ✔️
geoflatbush static 🌏 geo ✔️ :heavy_che
@andrewharvey
andrewharvey / index.geojson
Created February 9, 2020 00:50
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
andrewharvey / README.md
Last active February 9, 2020 13:26
Airborne Research Australia Bushfire 2020 Imagery processing for OpenStreetMap
View README.md
@andrewharvey
andrewharvey / README.md
Last active January 18, 2020 23:40
Maxar 2020 Australian Bushfire Imagery
View README.md