Skip to content

Instantly share code, notes, and snippets.

View kgjenkins's full-sized avatar

Keith Jenkins kgjenkins

View GitHub Profile
@kgjenkins
kgjenkins / hash.py
Created May 3, 2024 17:45
generate hashes for a csv of filepaths
# this script goes through a list of files from Excel "data from folder"
# and computes a hash of the file contents (to be used for deduplication)
import csv
import os
import hashlib
import time
# columns: Name,Extension,Date accessed,Date modified,Date created,Folder Path,Hash
@kgjenkins
kgjenkins / README.md
Created April 19, 2024 16:45
variation across multiple scans

The same image (an illustrated book cover) was scanned on the flatbed scanner (EPSON WF-2630) three times at 300dpi.

Analysis of the variation across the three scans:

band min max mean std dev
red 0 36 4.47 2.59
green 0 36 4.41 2.68
blue 0 37 4.72 2.95
@kgjenkins
kgjenkins / index.py
Created April 17, 2024 20:45
Calculate which city points are within each tif in a directory
# this script goes through a directory of tif files and a shapefile of cities
# and reports which city points are contained within each tif
import os
import fiona
import rasterio
import shapely
from pyproj import Transformer
tifpath = "path/to/tiffs"
@kgjenkins
kgjenkins / gist:ad26a278ecbf745873b8504dd7e217b3
Last active March 1, 2024 21:02
Calculating a raster of the network distance to the nearest park
The limiting factor in terms of the speed of the Iso-areas tool seems
to be the number of starting points. I've tried a number of
variations, trying to reduce the number of points while retaining
enough points that the analysis is still accurate. After several
failed attempts, I think I've come up with a workflow that ends up
keeping just the points along the park perimeters that end up being
the closest points to the road network. Here's the general workflow,
assuming we are starting with 2 layers, "streets" and "parks". I'd
suggest creating temporary outputs for each of these steps, and then
make the final result permanent.
@kgjenkins
kgjenkins / README.md
Last active September 12, 2023 20:45
Reclassifying UrbanWatch rasters using QGIS and Rasterio

Reclassifying UrbanWatch rasters using QGIS and Rasterio

See the video demo at https://youtu.be/t-pb5-1Q_Qg

The files here were used to convert UrbanWatch from RGB images to numeric rasters with simple landcover values 0-9, as follows:

Value Category Color
0 No Data Black
1 Building Red
@kgjenkins
kgjenkins / README.md
Last active September 12, 2023 20:32
Reclassifying UrbanWatch rasters using ArcGIS

Reclassifying UrbanWatch rasters using ArcGIS

See the video demo at https://youtu.be/mdYnBFYqXpg

The files here can be used to convert UrbanWatch rasters from RGB images to numeric rasters with simple landcover values 0-9, as follows:

Value Category Color
0 No Data Black
1 Building Red
@kgjenkins
kgjenkins / README.md
Last active October 12, 2022 14:24
LA 3010 GIS data sources
@kgjenkins
kgjenkins / index.html
Last active December 4, 2023 06:22
Cornell Theses and Dissertations by Academic Discipline
<html>
<head>
<title>Cornell Theses and Dissertations by Academic Discipline</title>
<meta http-equiv='Content-type' content='text/html; charset=UTF-8'>
<meta name='author' content='Keith Jenkins'>
<meta name='dateModified' content='2022-01-11'>
<style>
body { font-family: sans-serif }
h1 { text-align:center ; background: #b31b1b ; color: #fff ; padding: 0.5em ; margin: 0 }
td { white-space: nowrap }
@kgjenkins
kgjenkins / index.html
Last active November 14, 2021 17:55
Stamen Watercolor tiles framed in an HTML table with some CSS style effects
<!-- Stamen Watercolor tiles framed in an HTML table with some CSS style effects -->
<!-- created for Day 14 of the 2021 #30DayMapChallenge -->
<html>
<head>
<style>
img { width:128px ; height:128px }
table { border-spacing: 12px }
td { border:12px ridge #ccc }
</style>
</head>
@kgjenkins
kgjenkins / fgdc2html_simple.xsl
Last active May 25, 2021 23:25
fgdc2html_simple.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
omit-xml-declaration="yes"/>
<!--
A simple XSL stylesheet for displaying FGDC metadata as HTML