Skip to content

Instantly share code, notes, and snippets.

<div>
<strong>{{{au_name}}}</strong><br>
Population: {{{pop2011}}} (2011)<br>
Area: {{{area}}} km<sup>2</sup><br>
Density: {{{popdens}}} per km<sup>2</sup>
</div>
<div class='my-legend'>
<div class='legend-title'>Population density<br/>per km<sup>2</sup> (2011)</div>
<div class='legend-scale'>
<ul class='legend-labels'>
<li><span style='background:#FFFFFF;'></span>None</li>
<li><span style='background:#FFFFE5;'></span>< 1</li>
<li><span style='background:#FFF7BC;'></span>1 - 5</li>
<li><span style='background:#FEE391;'></span>5 - 10</li>
<li><span style='background:#FEC44F;'></span>10 - 50</li>
<li><span style='background:#FE9929;'></span>50 - 100</li>
@line: #226688;
@shade0: #FFFFFF;
@shade1: #FFFFE5;
@shade2: #FFF7BC;
@shade3: #FEE391;
@shade4: #FEC44F;
@shade5: #FE9929;
@shade6: #EC7014;
@shade7: #CC4C02;
@shade8: #993404;
var tour = L.layerGroup([
L.cartoDB('http://thematicmapping.cartodb.com/api/v2/sql?q=SELECT * FROM nz_tour', {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {
icon: L.icon({
iconSize: [27, 27],
iconAnchor: [13, 27],
popupAnchor: [1, -24],
iconUrl: 'icons/' + feature.properties.icon + '.png'
})
@turban
turban / dochuts.js
Last active October 11, 2015 21:28
var huts = new L.MarkerClusterGroup({
showCoverageOnHover: false,
maxClusterRadius: 50
});
var hutTypes = ['Basic Hut/Bivvy', 'Standard Hut', 'Serviced Hut', 'Serviced-Alpine Hut', 'Great Walk Hut'];
huts.addLayers(data.map(function(hut) {
return new L.Marker(new L.LatLng(hut[0], hut[1]), {
title: hut[2],
L.geoJson(springs, {
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, {
fillColor: (feature.properties.temp === 'hot') ? '#f00' : '#00f',
radius: 4,
color: "#333",
weight: 1,
fillOpacity: 1
});
},
// Create map layers
var layers = {
'Seafloor': L.tileLayer('tiles/nz-seafloor/{z}/{x}/{y}.png', {
maxZoom: 9,
attribution: '<a href="http://www.niwa.co.nz/our-science/oceans/bathymetry">NIWA</a>'
}),
'Topographic': L.tileLayer('tiles/nz-topo/{z}/{x}/{y}.png', {
attribution: '<a href="http://data.linz.govt.nz/">LINZ</a>, <a href="http://lris.scinfo.org.nz/">LRIS</a>'
}),
L.cartoDB('http://thematicmapping.cartodb.com/api/v2/sql?q=SELECT * FROM nz_tour', {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {
icon: L.icon({
iconSize: [27, 27],
iconAnchor: [13, 27],
popupAnchor: [1, -24],
iconUrl: 'icons/' + feature.properties.icon + '.png'
})
})
L.CartoDB = L.GeoJSON.extend({
initialize: function (url, options) {
L.Util.setOptions(this, options);
this._layers = {};
var self = this;
if (url) {
this._jsonp(url, function(geojson){
var seafloor = L.tileLayer('tiles/nz-seafloor/{z}/{x}/{y}.png', {
maxZoom: 9,
attribution: 'Map data from <a href="http://www.niwa.co.nz/our-science/oceans/bathymetry">NIWA</a>'
});
var topo = L.tileLayer('tiles/nz-topo/{z}/{x}/{y}.png', {
attribution: '<a href="http://data.linz.govt.nz/">LINZ</a>, <a href="http://lris.scinfo.org.nz/">LRIS</a>'
});
var map = new L.Map('map', {