Skip to content

Instantly share code, notes, and snippets.

@eddy-geek
eddy-geek / 20260323-TERRAIN-ANALYSIS-3D-STATUS.md
Last active March 23, 2026 22:04
terrain-analysis layer invisible in 3D when many layers intervene — @eslopemap/maplibre-gl@5.21.2 bug reproducer

Terrain Analysis 3D Bug — Root Cause & Fix

Summary

The terrain-analysis layer type (from @eslopemap/maplibre-gl@5.21.2) fails to render in 3D terrain mode when many non-DEM layers (GeoJSON tracks, circles, symbols, etc.) are positioned between the hillshade layer and the terrain-analysis layer in the MapLibre style layer stack.

Root cause: Layer position in the style stack. When terrain-analysis layers are appended to the end of the layer stack via map.addLayer() (the default behavior), and 20+ other layers exist above the hillshade, 3D terrain rendering silently drops the terrain-analysis output. This appears to be a bug in the fork's render-to-texture pipeline for 3D terrain.

Fix applied: Move terrain-analysis layers into the initial style definition, immediately after the hillshade layer, instead of adding them dynamically via addLayer() during map.on('load').

@eddy-geek
eddy-geek / tweaks.md
Last active March 15, 2026 08:49
Tweaks to VSCode and Windsurf keybindings

VsCode (home)

[
{ "key": "shift shift",      "command": "workbench.action.quickOpen" },

// default ctrl+k ctrl+s
{ "key": "alt+left",         "command": "workbench.action.navigateBack" },
// default ctrl+shift+-
{ "key": "alt+right",        "command": "workbench.action.navigateForward" },
@eddy-geek
eddy-geek / apple-touch-icon.png
Last active March 22, 2026 20:00
Slope/Aspect map viewer & track editor — MapLibre GL JS
�PNG

IHDR��=�2bKGD�������+IDATx���yt\�}�?w�;@��I�XHQ&%R�(ɒEK�-���8��c7��$'��M���nݸv���=�nO�ƕ]�n۲d��J$-��H-$Ap�/�>��7�{� �"��f����sH̛{/f~�����M�RJ����ۄ?(�N�D� Tu��mP��� �I����̯ۘ~qO�E!�L�R�Γ���B�0�����
�I�q����Ŭ>�o�lO�٩\��s�-�W��K���@\��5 �����u$�'%��=1]����@�5P�v R'���!O�_}h[x��� �o�s ��~
rOv�g`�:."ħ����ᵮ[3��}��a!�/$�d�{iᗒ'�xg�+���t������H���D���Y���`U���9�A4~ ���k�B<��{�_|�7�ߟwJ�3�lP��MȻ���MWW��������J��� �v]�f`��l������u?nȡ���/c�A� ���j����,+�9�P�8��3�j������PhU��`�A�Q�YL_�����{{�T�` g'q������Ɖ�BK�s�lP�X4��'&)��AB��b�b,&���R���w�.�<��A�c��,&�=��q��FJ���/�10�B�,Bȁ|w�� +L@W��a`�%z,�X�jP:�Z@T��Y��"֘�o`Pd�,�cgPJX�x6(%�tà�0��]\ P� ) =z/�+Rd�s���C_�g�t��R�X�!�EEU�������Lm��P��`�ED������ZUG�g�nC�o�" ߮h�,Pۼ��G�GNuȃ��݈�J�H�=��\@l�c\���ۖ.*�ܯBÔ��FI�x'.��'1�L�Wҿ{��+�ǥ�{�
�#�E�����P��b^�]��¾����|��]ar�=y�a�`��E�����n�w�+T�_�RF��10\��G���F�nm�鱺��"",�xf�2�ȡ ��F��?�V0�U8�C�F�q�X��Z�p9
�����c�
slope: [
'step', ['slope'],
"#ffffff", // white
20, "#c0ffff", // light sky blue
24, "#57ffff", // bright cyan
28, "#00d3db", // aqua blue
31, "#fffa32", // sunshine yellow
34, "#ffc256", // macaroni
37, "#fd7100", // orange
40, "#ff0000", // cherry red
@eddy-geek
eddy-geek / README.md
Last active February 27, 2026 19:39
maplibre-gl slope/aspect debug viewer

What this does

full interactive slope/aspect debug viewer using only maplibre-gl-js with:

  • Hybrid DEM pipeline

    • Uses internal backfilled DEM tiles when available
    • Falls back to custom border-fixed tiles when needed
    • Status counters show internal vs fallback usage
  • Terrain analysis overlay

How to convert terrarrium terrain RGB mbtiles back into tif ?

You can do it with GDAL in two steps:

  1. pick the correct decoder (Terrarium vs Mapbox Terrain‑RGB),
  2. apply the formula to the RGB PNG tiles inside the MBTiles and write out a Float32 GeoTIFF (then optionally reproject to WGS84).

Below I give ready‑to‑run commands for both encodings, plus tips to choose the zoom level, mask with the alpha band, and reproject.

#!/bin/bash
set -e # Exit on any error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
@eddy-geek
eddy-geek / necessary-verbs.sh
Created September 18, 2023 23:32
Audio fix for ALC298 in 16T90R-K.ADB9U1, kernel bug 212041 #13
#!/bin/sh
hda-verb /dev/snd/hwC0D0 0x20 0x500 0x0
hda-verb /dev/snd/hwC0D0 0x20 0x500 0x0
hda-verb /dev/snd/hwC0D0 0x20 0x500 0x99
hda-verb /dev/snd/hwC0D0 0x20 0x500 0x99
hda-verb /dev/snd/hwC0D0 0x20 0x500 0x99
hda-verb /dev/snd/hwC0D0 0x20 0x480 0x0
hda-verb /dev/snd/hwC0D0 0x20 0x500 0x99
hda-verb /dev/snd/hwC0D0 0x20 0x480 0x0
hda-verb /dev/snd/hwC0D0 0x20 0x500 0x99
def get_jpg_quality(pim: 'PIL.Image.Image') -> int:
"""
Implement quality computation following ImageMagick heuristic algorithm:
https://github.com/ImageMagick/ImageMagick/blob/7.1.0-57/coders/jpeg.c#L782
Usage:
```
pim = Img.open(...)
quality = get_jpg_quality(pim)
```
See also https://stackoverflow.com/questions/4354543/