Skip to content

Instantly share code, notes, and snippets.

View andrewharvey's full-sized avatar

Andrew Harvey andrewharvey

View GitHub Profile
@andrewharvey
andrewharvey / polygon-with-a-hole.geojson
Created March 10, 2018 02:21
A GeoJSON Polygon with a hole
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrewharvey
andrewharvey / index.html
Created February 3, 2024 11:39
Suggested workaround for https://github.com/mapbox/mapbox-gl-js/issues/13067#issuecomment-1925291846 Mapbox GL JS GeolocateControl place marker without initial camera update
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Locate the user</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v3.1.2/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v3.1.2/mapbox-gl.js"></script>
<style>
body { margin: 0; padding: 0; }
@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 / math1081.tex
Created September 15, 2012 06:38
UNSW MATH1801, MATH1231 08s2 cheatsheets
% To the extent possible under law, the person who associated CC0
% with this work has waived all copyright and related or neighboring
% rights to this work.
% http://creativecommons.org/publicdomain/zero/1.0/
\documentclass[a4paper,10pt]{article}
\usepackage{verbatim}
\usepackage{amsmath}
\usepackage{amssymb}
\setlength\parindent{0mm}
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
@andrewharvey
andrewharvey / index.md
Last active May 24, 2023 10:21
Comparison of point and box spatial index libraries for JavaScript
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 / README.md
Created September 29, 2012 02:34
Geoscience Australia - Australian Bathymetry and Topography Grid

About

This package contains a set of tools, utilities and stylesheets for working with the Geoscience Australia Australian Bathymetry and Topography Grid.

Here is a sample rendering of this Geoscience Australia Australian Bathymetry and Topography Grid using the process documented in this repository.

Australian Bathymetry and Topography Grid

License

@andrewharvey
andrewharvey / inplace-mbtiles2osmand.sh
Last active January 13, 2023 16:39
In-place conversion of an mbtiles SQLite3 database into an osmand offline tiles SQLite3 database.
#!/bin/sh
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
# rights to this work.
# http://creativecommons.org/publicdomain/zero/1.0/
SCRIPT_DIR=`dirname $0`
if [ -e $1 ] ; then
@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 / index.html
Last active November 9, 2022 01:45
Mapbox GL JS Marker Offset Example
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='mapbox-gl-dev.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }