Skip to content

Instantly share code, notes, and snippets.

View danwild's full-sized avatar

Dan Wild danwild

View GitHub Profile
@danwild
danwild / extent.py
Created May 1, 2019 04:38
Get GeoTIFF extent
import gdal
from gdalconst import GA_ReadOnly
data = gdal.Open('C:/Temp/myimage.tif', GA_ReadOnly)
geoTransform = data.GetGeoTransform()
minx = geoTransform[0]
maxy = geoTransform[3]
maxx = minx + geoTransform[1] * data.RasterXSize
miny = maxy + geoTransform[5] * data.RasterYSize
print (minx, miny, maxx, maxy)
@danwild
danwild / settings.json
Created November 28, 2019 22:13
Dump of some VSCode settings for eslint + prettier auto linting/formatting
{
"editor.tabSize": 2,
"editor.formatOnSave": true,
"workbench.colorTheme": "Darkula",
"workbench.editor.enablePreview": false,
"eslint.run": "onType",
"eslint.autoFixOnSave": true,
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.donotShowInfoMsg": true,
"javascript.updateImportsOnFileMove.enabled": "always",
@danwild
danwild / geojson time
Last active July 13, 2020 06:24
GeoJSON with time example
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"id": 0,
"age": 1,
"time": "2005-08-22T09:01:00Z"
},
@danwild
danwild / KML test
Created July 13, 2020 06:13
KML example for animation
<?xml version="1.0"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name>1</name>
<TimeStamp>
<when>2005-08-21T09:01:00Z</when>
</TimeStamp>
<Point>
<coordinates>147.8641248483198,-41.20691100053718,650.3999223664766</coordinates>
@danwild
danwild / BIG_GISTS.md
Created September 11, 2020 03:12
Gist about making gists (large files from bash)
This file has been truncated, but you can view the full file.
var keyframes = {"2015-12-20T00:00:00.000Z":[{"type":"Feature","geometry":{"type":"Point","coordinates":[227.539003,-38.071779,0.25]},"properties":{"id":227,"decay_value":1,"time":"2015-12-20T00:00:00.000Z","age":0}},{"type":"Feature","geometry":{"type":"Point","coordinates":[227.539393,-38.07169,0.25]},"properties":{"id":227,"decay_value":1,"time":"2015-12-20T00:00:00.000Z","age":1}},{"type":"Feature","geometry":{"type":"Point","coordinates":[227.539784,-38.071602,0.25]},"properties":{"id":227,"decay_value":1,"time":"2015-12-20T00:00:00.000Z","age":2}},{"type":"Feature","geometry":{"type":"Point","coordinates":[227.540175,-38.071512,0.25]},"properties":{"id":227,"decay_value":1,"time":"2015-12-20T00:00:00.000Z","age":3}},{"type":"Feature","geometry":{"type":"Point","coordinates":[227.540566,-38.071422,0.25]},"properties":{"id":227,"decay_value":1,"time":"2015-12-20T00:00:00.000Z","age":4}},{"type":"Feature","geometry":{"type":"Point","coordinates":[227.540957,-38.071332,0.25]},"properties":{"id":227,"decay_v
We couldn’t find that file to show.
@danwild
danwild / plotty-test.html
Created October 1, 2020 04:05
Testing plotty color domain
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GistRun</title>
<script src="https://unpkg.com/plotty@0.4.3/dist/plotty.js"></script>
</head>
<body>
<h1>Plotty domain vs display ranges</h1>
<p>Testing if plotty correctly scales color domain across a clipped display range?</p>
@danwild
danwild / L.CanvasLayer.js
Created October 1, 2020 23:54
Repro for plotty color scale domain issue (eliminating leaflet-geotiff-2 as the culprit)
/*
Generic Canvas Layer for leaflet 0.7 and 1.0-rc,
copyright Stanislav Sumbera, 2016 , sumbera.com , license MIT
originally created and motivated by L.CanvasOverlay available here: https://gist.github.com/Sumbera/11114288
*/
// -- L.DomUtil.setTransform from leaflet 1.0.0 to work on 0.0.7
//------------------------------------------------------------------------------
if (!L.DomUtil.setTransform) {
@danwild
danwild / index.html
Created October 2, 2020 00:26
Testing plotty domain scaling
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Plotty test</title>
<script src="https://unpkg.com/plotty@0.4.3/dist/plotty.js"></script>
</head>
<body>
<h1>Plotty domain</h1>
<p>Testing if plotty correctly scales color domain across a clipped range?</p>