Skip to content

Instantly share code, notes, and snippets.

View rowanwins's full-sized avatar
🌐
Making maps

Rowan Winsemius rowanwins

🌐
Making maps
  • Canberra, Australia
View GitHub Profile
@rowanwins
rowanwins / Leaflet Layer Toggle
Last active January 23, 2022 00:11
Add/remove leaflet.js layer
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Demo</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:600' rel='stylesheet' type='text/css'>
<style>
@rowanwins
rowanwins / Limiting Leaflet.draw to a single feature
Last active September 3, 2016 06:08
Limiting Leaflet.draw
<!DOCTYPE html>
<html>
<head>
<title>Leaflet.draw drawing and editing tools</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link rel="stylesheet" href="js/leaflet.draw.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
@rowanwins
rowanwins / gist:abec8d7aebeb27db49df
Created November 23, 2014 10:01
Creating a time slider with leaflet.js
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Time slider data</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
@rowanwins
rowanwins / gist:b1991a57cd59ec6a265c
Created May 28, 2015 22:50
Adding transition to polygon fill in leaflet
.leaflet-container path{
transition: fill .75s;
}
@rowanwins
rowanwins / gist:120bf64470c89cd191a2
Created June 10, 2015 10:37
Use ogr2ogr to import shp to MySQL
ogr2ogr -f "MySQL" MYSQL:"dbName,host=localhost,user=root,port=3306" -nln "tableName" -a_srs "EPSG:4326" shpName.shp -lco ENGINE=MyISAM
@rowanwins
rowanwins / gist:6e257c20138360a9f622
Created August 20, 2015 05:48
Visible atmospherically resistant index for Raster Calculator
("Green" - "Red")/("Green" + "Red" - "Blue")
@rowanwins
rowanwins / gist:60d8bac05a28c2874909
Created September 2, 2015 23:32
NVDI Raster Calculator
(Float("NIR.TIF") - Float("RED.TIF")) / (Float("NIR.TIF") + Float("RED.TIF"))
@rowanwins
rowanwins / gist:fae3bd7e6f9831e27b72
Created February 3, 2016 23:26
Tile server load testing results
//NODE, MBTILES AND EXPRESS TILE SERVER WITH 200 CONCURRENT REQUESTS FOR 20seconds
Target URL: http://localhost:7777/scene/tiles/15/29987/19801.png
Completed requests: 7568
Total errors: 0
Total time: 20.001499538 s
Requests per second: 378
Total time: 20.001499538 s
Percentage of the requests served within a certain time
50% 518 ms
90% 556 ms
@rowanwins
rowanwins / gist:97188a36a10ea3143b13
Created March 22, 2016 22:09
Layer toggle with layer group
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Demo</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:600' rel='stylesheet' type='text/css'>
<style>
@rowanwins
rowanwins / index.js
Created September 20, 2016 10:01
WOF post code script
var shp = require('shpjs');
var walk = require('walk')
var fs = require('fs')
var turfArea = require('turf-area')
var turfBbox = require('turf-bbox')
var turfCentroid = require('turf-centroid')
var newSrcData = fs.readFileSync(__dirname +"/src/ABS_Postcodes.geojson", 'utf8');
newSrcData = JSON.parse(newSrcData);