Skip to content

Instantly share code, notes, and snippets.

@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:6e257c20138360a9f622
Created August 20, 2015 05:48
Visible atmospherically resistant index for Raster Calculator
("Green" - "Red")/("Green" + "Red" - "Blue")
@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:b1991a57cd59ec6a265c
Created May 28, 2015 22:50
Adding transition to polygon fill in leaflet
.leaflet-container path{
transition: fill .75s;
}
@nohe427
nohe427 / downloadZipArcGIS.py
Created November 25, 2014 17:39
downloadZipFilesFrom ArcGIS Online
import requests
urlToGoTo = 'URLOfServiceOnAGOL'
r = requests.get(urlToGoTo, allow_redirects=True)
with open(r"FileLocation.ZIP", "wb") as f:
for chunk in r.iter_content():
f.write(chunk)
@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 / 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 / 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>
@dpapathanasiou
dpapathanasiou / dst.py
Created August 16, 2014 15:42
How to tell if Daylight Savings Time is in effect using Python
from datetime import datetime
import pytz
def is_dst ():
"""Determine whether or not Daylight Savings Time (DST)
is currently in effect"""
x = datetime(datetime.now().year, 1, 1, 0, 0, 0, tzinfo=pytz.timezone('US/Eastern')) # Jan 1 of this year
y = datetime.now(pytz.timezone('US/Eastern'))
@klokan
klokan / arcgis.html
Last active September 3, 2016 06:58
ArcGIS MapTiler
<!DOCTYPE html>
<html>
<head>
<title>ArcGIS JavaScript API viewer</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css">
<style>
html, body, #map {width:100%; height:100%; margin:0; padding:0; }
</style>
<script src="http://js.arcgis.com/3.8/"></script>