Skip to content

Instantly share code, notes, and snippets.

View kevin-peel's full-sized avatar

Kevin F. kevin-peel

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kevin-peel
kevin-peel / sumfields.js
Last active January 22, 2016 18:47
Sums the values of multiple fields in a GeoJSON into a new field.
/* Functions for use with GeoJSONs */
/*
Pass data like so: var newGeoJson = sumFields(inputFC, inputFields, outputField)
Input FC can be a point, line, polygon. Use the variable name assigned to the GeoJSON, not the L.geoJson variable
inputFields can be a single field or an array of fields, formatted like so: [value1, value2, ..., valueN]
outputField is the name of the output field
*/
/* Sum Fields
These two functions are used to sum multiple columns of data from one GeoJSON together.
@kevin-peel
kevin-peel / SimpleMinify.py
Last active February 2, 2016 09:12
A very short and very simple Python script that removes new lines and extra spaces from text files. I created it to do a simple minify of large JavaScript files that browser-based tools were too slow to do.
file = open("minify1.txt", "w")
with open('test.txt') as f:
for line in f:
newTxt = line.rstrip('\r\n').replace(" ","")
file.write(newTxt)
if 'str' in line:
break
file.close()
@kevin-peel
kevin-peel / tallship1.svg
Last active August 29, 2015 14:13
SVG of a tallship based on a 1688 map of New France (the Canadas)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#########################
# NumPy Raster Calculator
# -----------------------
# Purpose: The purpose of this Python script is to use ArcGIS's arcpy package along with the Python library numpy to convert Landsat thermal bands from digital numbers to Top of Atmosphere (ToA) brightness-temperature values that provide pixel temperature in degrees Celsius.
# Purpose #2: The second purpose is that it allows some work to be done on rasters without the need for the Spatial Analyst extension
#
# Requirements: ESRI ArcGIS arcpy; Python 2.7.x; numpy; Landsat data
# ArcPy takes care of the dirty work of conversions and geospatial stuff and I have ArcGIS installed, hence it's use.
#########################