Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Harvey andrewharvey

View GitHub Profile
@andrewharvey
andrewharvey / index.html
Created Nov 12, 2019
Mapbox GL JS Workshop
View index.html
<!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 {
@andrewharvey
andrewharvey / index.html
Created Sep 27, 2019
Mapbox GL JS look at elevation example
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Look at Elevation</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.3.2/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.3.2/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
View polygon-with-a-hole.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View polygon-clipping-bug.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Display a map</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@andrewharvey
andrewharvey / mbgl-offline-geojson-tiles
Created Mar 4, 2019
Inspect an mbgl-offline pack and generate a GeoJSON of the containing tiles
View mbgl-offline-geojson-tiles
#!/bin/sh
sqlite3 -separator ',' offline.db 'select x,y,z from tiles;' | sed 's/^/[/' | sed 's/$/]/' | mercantile shapes --indent 2 > offline.tiles.geojson
View index.html
<!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 / Makefile
Created Jan 2, 2019
Dargans Creek Reserve
View Makefile
query.sql: parcels.txt
cat parcels.txt | sed 's/Lot /(lotnumber = \'/' | sed -E 's/ DP ?/\' and plannumber = /' | sed 's/$/) or /' | tr -d '\n' | sed 's/ or $//'> query.sql
reserve.geojson:
wget -O reserve.geojson 'https://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Cadastre/MapServer/9/query?where=%28lotnumber+%3D+%272%27+and+plannumber+%3D+778317%29+or+%28lotnumber+%3D+%277014%27+and+plannumber+%3D+1020484%29+or+%28lotnumber+%3D+%277311%27+and+plannumber+%3D+1154270%29+or+%28lotnumber+%3D+%277312%27+and+plannumber+%3D+1154269%29+or+%28lotnumber+%3D+%277313%27+and+plannumber+%3D+1154269%29+or+%28lotnumber+%3D+%277301%27+and+plannumber+%3D+1123766%29+or+%28lotnumber+%3D+%277033%27+and+plannumber+%3D+1051528%29+or+%28lotnumber+%3D+%277015%27+and+plannumber+%3D+1051527%29+or+%28lotnumber+%3D+%271%27+and+plannumber+%3D+778317%29+or+%28lotnumber+%3D+%277018%27+and+plannumber+%3D+1051736%29+or+%28lotnumber+%3D+%277019%27+and+plannumber+%3D+1051736%29+or+%28lotnumber+%3D+%27266%27+and+plannumber+%3D+7516
View elvis_1m_dem_bbox.sh
wget -O - https://elvis-ga.fmecloud.com/fmedatastreaming/elvis_indexes/ReturnDownloadables.fmw | jq -r '.available_data[].downloadables.DEMs."1 Metre"[].bbox' | xargs -I '{}' turf bboxPolygon "[{}]" | tr -d '\n ' | sed 's/}{/},{/' | sed 's/^/{"type": "FeatureCollection", "features": [/' | sed 's/$/]}/' > elvisBBOX.geojson
You can’t perform that action at this time.