Skip to content

Instantly share code, notes, and snippets.

View nickdos's full-sized avatar

Nick dos Remedios nickdos

View GitHub Profile
@nickdos
nickdos / index.html
Last active September 28, 2026 03:59
HTML full example for ALA occurrence map in HTML5 Canvas
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ALA Static Species Map Generator</title>
<style>
body { font-family: sans-serif; padding: 20px; background-color: #f4f4f9; }
#map-container { margin-top: 15px; }
img { border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
#status { font-weight: bold; color: #555; }
@nickdos
nickdos / ala_wms_canvas_example.js
Created September 28, 2026 03:16
WMS Canvas example for ALA occurrence map
async function generateStaticMapImage(speciesName) {
const width = 800;
const height = 700;
const bbox = "112,-44,154,-9"; // Australia bounding box
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext('2d');
@nickdos
nickdos / minimal-grey-osm-style.json
Last active August 9, 2026 23:47
OSM vector tile style
{
"id": "transportation",
"type": "line",
"source": "openmaptiles",
"source-layer": "transportation",
"filter": [
"!in",
"class",
"path",
"footway",
@nickdos
nickdos / caab_names_images_merge.py
Last active May 26, 2020 02:46
CAAB names and images from ALA
import urllib.request
import json
import csv
# pull out names, imageID, image URL, etc., from ALA occurrences API
url = "https://biocache-ws.ala.org.au/ws/occurrences/search?q=data_resource_uid:dr660&pageSize=5000"
req = urllib.request.Request(url)
r = urllib.request.urlopen(req).read()
content = json.loads(r.decode('utf-8'))
counter = 0
@nickdos
nickdos / Dwc_terms_biocache.sh
Last active May 14, 2020 09:29
Shell scripts for biocache using JQ
# find all DwC terms in index/fields
curl -s https://biocache-ws.ala.org.au/ws/index/fields | jq -r '.[] | select(.dwcTerm != null) | .dwcTerm '
curl -s "https://biocache-ws.ala.org.au/ws/index/fields" | jq -r '.[] | select(.dwcTerm != null) | "\(.name)|\(.dwcTerm)" '
#!/usr/local/bin/bash
#
# Script to generate distinct values and counts for DwC fields in the ALA (CSV output)
# Requires the jq tool to be installed - see https://stedolan.github.io/jq/
# Requires BASH v.4+
#
# Author: Nick dos Remedios <nick.dosremedios@csiro.au> 2018-07-04
#
# requested fields:
#
@nickdos
nickdos / collectory-doi-counts.sh
Last active April 22, 2020 00:22
Collectory GBIF DOI citations lookup
#!/usr/local/bin/bash
#
# Iterate over list of GBIF DOI keys from data_resource table and get a count of the
# distinct publication citations via GBIF API by storing each citation DOI (ID) in an
# associative array and then reading the length of the this array.
#
# Requires BASH version > 4 and JQ command line tool (https://github.com/stedolan/jq)
#
# SQL: select gbif_registry_key from data_resource where gbif_registry_key <> '';
#
@nickdos
nickdos / collectory-sql-script-1.sh
Last active December 18, 2019 10:07
BASH script to analyse data in Collectory
#!/bin/bash
# https://unix.stackexchange.com/a/295528
# get list of fields:
# mysql -u root -ppassword -D collectory -s -e "describe data_resource;" (paste into Excel and copy first column)
#
# run as ./collectory-sql-script-1.sh data_resource_fields.txt > data_resource_fields.csv
TABLE="data_hub"
USER="root" # change to your DB user
@nickdos
nickdos / index.html
Last active August 25, 2019 02:32
ALA WMS with Google Maps API 2018
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
@nickdos
nickdos / .block
Last active September 2, 2020 01:10
Demo ALA map
license: apache-2.0
height: 800