Skip to content

Instantly share code, notes, and snippets.

{
"timestamp": "Wed Feb 11 16:10:24 EST 2015",
"goalie": [
{
"position": "Goalie",
"id": 8475883,
"twitterURL": "https:\/\/twitter.com\/f_andersen30",
"weight": 236,
"height": "6' 3\"",
"imageUrl": "http:\/\/3.cdn.nhle.com\/photos\/mugs\/8475883.jpg",
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Tiles as Canvas Images in Leaflet</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<!-- Load Leaflet from CDN-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/0.7.7/leaflet.css" />
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Tiles as Canvas Images in Leaflet</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<!-- Load Leaflet from CDN-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/0.7.7/leaflet.css" />
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Filtering Pixels in Leaflet</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<!-- Load Leaflet from CDN-->
@mappingvermont
mappingvermont / decode_date.js
Created June 14, 2016 20:32
Given an rgb value, return date, confidence, and intensity for GLAD alerts
var decode_date = function(rgba) {
// find the total days of the pixel by
// multiplying the red band by 255 and adding
// the green band to that
var total_days = rgba[0] * 255 + rgba[1];
// take the total days value and divide by 365 to
// get the year_offset. Add 15 to this (i.e 0 + 15 = 2015)
// or 1 + 15 = 2016
@mappingvermont
mappingvermont / multi_thread_example.py
Created June 21, 2016 20:21
Example of multi thread with arcpy process
import random
import time
from Queue import Queue
from threading import Thread
print 'Starting script!'
q = Queue()
entity_id ksm_ref Mill Name Longitude Latitude
1499 KSM1439 Murini Sam-Sam 2 (Pelintung) 101.593 1.5848
1429 KSM1008 PT MUSTIKA AGUNG SAWIT SEJAHTERA Jl 101.2424 1.29
1473 KSM1380 Sawit Anugrah Sejahtera 101.2767 1.1517
@mappingvermont
mappingvermont / osm_boundingbox.py
Created July 21, 2016 21:49
Use geopandas to extract south/west/north/east bounding box from a gridded shapefile
import geopandas as gpd
import pandas as pd
shp = gpd.GeoDataFrame.from_file('lossdata_footprint/lossdata_footprint.shp')
# BBox order
# minimum latitude, minimum longitude, maximum latitude, maximum longitude
# (or South-West-North-East).
bbox_dict = {}
import overpass
import csv
import sys
api = overpass.API(timeout=900)
coords = []
with open('bbox.csv') as theFile:
csvReader = csv.reader(theFile)
csvReader.next()
@mappingvermont
mappingvermont / filter_glad.html
Created August 25, 2016 13:11
Load GLAD tiles into Leaflet canvas, decode RGB value and filter by date
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Filtering Pixels in Leaflet</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<!-- Load Leaflet from CDN-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/0.7.7/leaflet.css" />