Skip to content

Instantly share code, notes, and snippets.

@darrenwiens
darrenwiens / aws_terrain.py
Created April 25, 2022 22:44
Blender AWS Terrain tiles add-on
import bpy
import morecantile
import os
import requests
url = "https://elevation-tiles-prod.s3.amazonaws.com/v2/geotiff"
def get_tile(x, y, z):
src_path = f"{url}/{z}/{x}/{y}.tif"
dst_path = f'/tmp/{z}_{x}_{y}.tif'
@darrenwiens
darrenwiens / read_combine.ipynb
Created March 30, 2022 01:57
Rasterio: Read bands, combine bands
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darrenwiens
darrenwiens / main.py
Created March 21, 2022 01:33
Blender script for animating countries by area
import bpy
import json
from shapely.geometry import shape
with open("/path/to/sorted_countries.geojson", "r") as f:
fc = json.load(f)
buffer = 0.1
cur_zero = 0
total_frames = 1400
@darrenwiens
darrenwiens / country_area.ipynb
Created March 21, 2022 01:14
Jupyter notebook to add area to calculate country geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darrenwiens
darrenwiens / main.py
Created March 19, 2022 00:28
STAC assets in Blender
import bpy
import datetime
import json
import numpy as np
import requests
import rasterio
from PIL import Image
from pyproj import CRS, Transformer
url = "https://earth-search.aws.element84.com/v0/search"
@darrenwiens
darrenwiens / bc_topo_rayshader.ipynb
Created March 18, 2022 02:59
Jupyter notebook, demonstrating how to create a rayshader animation for BC Topo data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darrenwiens
darrenwiens / main.py
Created March 14, 2022 22:54
Climate spiral, Blender
import bpy
import math
import pandas as pd
df = pd.read_csv(
bpy.path.abspath("//HadCRUT.4.6.0.0.monthly_ns_avg.txt"),
delim_whitespace=True,
header=None
)
@darrenwiens
darrenwiens / index.html
Created March 13, 2022 22:10
GLTF playground, Mapbox
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>glTF Playground</title>
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<script src="https://api.mapbox.com/mapbox-gl-js/v2.3.0/mapbox-gl.js"></script>
@darrenwiens
darrenwiens / index.html
Last active March 13, 2022 00:08
Gourdle web app
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Gourdle</title>
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<style>
@darrenwiens
darrenwiens / index.html
Created March 3, 2022 00:35
FMV Example, Mapbox
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>FMV Demo</title>
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<link