Skip to content

Instantly share code, notes, and snippets.

View zacharyDez's full-sized avatar

Zac Deziel zacharyDez

View GitHub Profile
@zacharyDez
zacharyDez / activity.json
Created August 30, 2023 20:12
example_strava_stac
{"id": "1150471868", "type": "Feature", "stac_version": "1.0.0-beta.2", "stac_extensions": [], "collection": "collection.json", "geometry": {"type": "LineString", "coordinates": [[-71.938633, 45.386387], [-71.938732, 45.386252], [-71.938696, 45.386433], [-71.938727, 45.386456], [-71.938702, 45.386479], [-71.938701, 45.386452], [-71.938739, 45.386414], [-71.938766, 45.38639], [-71.938816, 45.386366], [-71.938866, 45.386345], [-71.938903, 45.386337], [-71.938944, 45.386331], [-71.93899, 45.386322], [-71.93907, 45.386325], [-71.939115, 45.386326], [-71.939162, 45.38632], [-71.939208, 45.38631], [-71.939254, 45.386301], [-71.939304, 45.386286], [-71.939346, 45.386278], [-71.939386, 45.386276], [-71.939426, 45.38627], [-71.939465, 45.386268], [-71.939504, 45.386267], [-71.93958, 45.386259], [-71.939632, 45.386257], [-71.939681, 45.386268], [-71.93972, 45.386267], [-71.939762, 45.386266], [-71.939837, 45.386267], [-71.939877, 45.386263], [-71.939916, 45.386258], [-71.939992, 45.38626], [-71.94004, 45.386264], [-71.
create table chief_loop_bounds_out as
with world as (
select st_makeenvelope(-180, -90, 180, 90, 4326) geom
),
env as (
select st_transform(st_minimumboundingcircle(st_collect(t.geom)), 4326) geom from dbt.chief_three_peaks_loop t
)
select st_makepolygon(st_exteriorring(w.geom), Array[st_exteriorring(t.geom)]) geom from world w, env t;
create table chief_loop_bounds_in as
on-run-end: [
"GRANT USAGE ON SCHEMA {{target.schema}} TO project_reader",
"GRANT SELECT ON ALL TABLES IN SCHEMA {{target.schema}} TO project_reader"
]
@zacharyDez
zacharyDez / imagery_folder.sh
Created January 16, 2022 14:21
imagery folder tree
data/raw/2019_aout/
└── 25cm
├── 244-5054_aout19_rgb_25cm.tif
├── 244-5054_aout19_rgb_25cm.wld
├── 244-5055_aout19_rgb_25cm.tif
├── 244-5055_aout19_rgb_25cm.wld
├── 244-5056_aout19_rgb_25cm.tif
├── 244-5056_aout19_rgb_25cm.wld
├── 244-5057_aout19_rgb_25cm.tif
├── 244-5057_aout19_rgb_25cm.wld
FROM osgeo/gdal:ubuntu-full-3.2.2 AS builder-image
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt-get install --no-install-recommends -y \
python3.9 python3.9-dev python3.9-venv python3-pip python3-wheel build-essential && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN python3.9 -m venv /home/myuser/venv
ENV PATH="/home/myuser/venv/bin:$PATH"
{
"stac_version": "1.0.0",
"stac_extensions": [],
"type": "Feature",
"id": "20201211_223832_CS2",
"bbox": [
172.91173669923782,
1.3438851951615003,
172.95469614953714,
1.3690476620161975
from sqlalchemy import create_engine
import psycopg2
conn = psycopg2.connect("postgres://postgres:mypassword@db:5432/postgres")
sql = """with q as (
select q.id, q.Q_socio, st_setsrid(q.wkb_geometry, 4326) geom from quartiers_sociologiques q
), p as (
select st_setsrid(wkb_geometry, 4326) geom, price from sqfeet_properties as p
)
create table hex_r8 as (
with envelope as (
select st_envelope(wkb_geometry) geom from quartiers_sociologiques
), h3_id as (
select h3_polyfill(geom, 8) id from envelope
)
select id, st_setsrid(h3_h3index_to_geoboundary(id), 4326) geom from h3_id
);