Skip to content

Instantly share code, notes, and snippets.

@darrenwiens
darrenwiens / index.html
Created April 29, 2024 23:55
High Res Canopy Height COG viewer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>High Resolution Canopy Height</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.js"></script>
<style>
@darrenwiens
darrenwiens / index.html
Created February 25, 2024 00:59
A Potree static site for showing COPCs from Microsoft Planetary Computer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>MPC COPC Viewer</title>
@darrenwiens
darrenwiens / maps.js
Created February 19, 2024 17:53
Add Tetris to Mapbox GL JS
mapboxgl.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
let center = [-74.5, 40]
const map = new mapboxgl.Map({
container: 'map',
center: [-74.426, 40.1792],
zoom: 9,
pitch: 50,
keyboard: false,
preserveDrawingBuffer: true,
});
@darrenwiens
darrenwiens / jupytercad_mr_pg.ipynb
Created June 2, 2023 22:32
Draw Mr. PG with jupytercad
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darrenwiens
darrenwiens / dem_to_oblique.ipynb
Created May 15, 2023 22:26
A notebook demonstrating how to create an oblique horizon plot, given a digital elevation model and observer point.
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 April 6, 2023 20:20
Segment anything API, segments static Mapbox Satellite Image
from fastapi import FastAPI
from pydantic import BaseModel
import torch
import torchvision
import numpy as np
from PIL import Image
import random
import requests
import base64
import io
@darrenwiens
darrenwiens / index.html
Created March 25, 2023 17:01
A frontend for a ChatGPT map-maker
<!DOCTYPE html>
<html lang="en">
<head>
<base target="_top">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ChatGPT Mapmaker</title>
@darrenwiens
darrenwiens / main.py
Last active March 26, 2023 17:51
A FastAPI that makes a request to OpenAI for LeafletJS map code
from fastapi import FastAPI
from pydantic import BaseModel
import openai
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = [
"http://localhost:8001", # your allowed origin
@darrenwiens
darrenwiens / index.html
Created November 30, 2022 02:57
Mapbox single tile map client and API
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Single tile</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.js"></script>
<script src="https://unpkg.com/@turf/turf@6/turf.min.js"></script>
@darrenwiens
darrenwiens / 3dep-tile-client
Created November 27, 2022 04:40
A client for consuming 3DEP tiles from Microsoft Planetary Computer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>3dep-tile-client</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.js"></script>
<style>