geohash-coloring
БесплатноБез исполняемых скриптовНе проверенGeohash Coloring Skill
от plurigrid★ 73 звезды на GitHubОб этом скилле
Geohash Coloring Skill
GF(3) colored geohashes for hierarchical spatial indexing with deterministic color derivation.
Trigger
- Geohash encoding/decoding
- Hierarchical spatial clustering
- Location-based coloring schemes
- Privacy-preserving location representation
GF(3) Trit: +1 (Generator)
Generates colored spatial identifiers from coordinates.
Geohash Basics
Geohash encodes lat/lon into a string where:
- Longer = more precise
- Prefix = parent cell
- Adjacent cells share prefixes
Precision | Cell Width | Cell Height
1 | 5,009 km | 4,992 km
2 | 1,252 km | 624 km
3 | 156 km | 156 km
4 | 39 km | 19 km
5 | 5 km | 5 km
6 | 1.2 km | 0.6 km
7 | 153 m | 153 m
8 | 38 m | 19 m
9 | 5 m | 5 m
Core Implementation
import hashlib
# Geohash alphabet (base32)
GEOHASH_CHARS = '0123456789bcdefghjkmnpqrstuvwxyz'
def encode_geohash(lat: float, lon: float, precision: int = 9) -> str:
"""Encode lat/lon to geohash string."""
lat_range = (-90.0, 90.0)
lon_range = (-180.0, 180.0)
geohash = []
bits = 0
bit_count = 0
is_lon = True
while len(geohash) < precision:
if is_lon:
mid = (lon_range[0] + lon_range[1]) / 2
if lon >= mid:
bits = (bits << 1) | 1
lon_range = (mid, lon_range[1])
else:
bits = bits << 1
lon_range = (lon_range[0], mid)
else:
mid = (lat_range[0] + lat_range[1]) / 2
if lat >= mid:
bits = (bits << 1) | 1
lat_range = (mid, lat_range[1])
else:
bits = bits << 1
lat_range = (lat_range[0], mid)
is_lon = not is_lon
bit_count += 1
if bit_count == 5:
geohash.append(GEOHASH_CHARS[bits])
bits = 0
bit_count = 0
return ''.join(geohash)
def decode_geohash(geohash: str) -> tuple[float, float, float, float]:
"""Decode geohash to bounding box (lat_min, lat_max, lon_min, lon_max)."""
lat_range = [-90.0, 90.0]
lon_range = [-180.0, 180.0]
is_lon = True
for char in geohash:
idx = GEOHASH_CHARS.index(char.lower())
for i in range(4, -1, -1):
bit = (idx >> i) & 1
if is_lon:
mid = (lon_range[0] + lon_range[1]) / 2
if bit:
lon_range[0] = mid
else:
lon_range[1] = mid
else:
mid = (lat_range[0] + lat_range[1]) / 2
if bit:
lat_range[0] = mid
else:
lat_range[1] = mid
is_lon = not is_lon
return lat_range[0], lat_range[1], lon_range[0], lon_range[1]
def geohash_center(geohash: str) -> tuple[float, float]:
"""Get center point of geohash cell."""
lat_min, lat_max, lon_min, lon_max = decode_geohash(geohash)
return (lat_min + lat_max) / 2, (lon_min + lon_max) / 2
GF(3) Coloring
# SplitMix64 constants
GOLDEN = 0x9E3779B97F4A7C15
MIX1 = 0xBF58476D1CE4E5B9
MIX2 = 0x94D049BB133111EB
MASK64 = 0xFFFFFFFFFFFFFFFF
def splitmix64(seed: int) -> tuple[int, int]:
state = (seed + GOLDEN) & MASK64
z = state
z = ((z ^ (z >> 30)) * MIX1) & MASK64
z = ((z ^ (z >> 27)) * MIX2) & MASK64
z = z ^ (z >> 31)
return state, z
def color_geohash(geohash: str) -> dict:
"""Assign GF(3) color to geohash."""
# Seed from geohash string
seed = int(hashlib.sha256(geohash.encode()).hexdigest()[:16], 16)
seed = seed & 0x7FFFFFFFFFFFFFFF
_, z = splitmix64(seed)
hue = z % 360
# Trit from hue region
if hue < 60 or hue >= 300:
trit = 1 # Red → Generator
elif hue < 180:
trit = 0 # Green → Ergodic
else:
trit = -1 # Blue → Validator
# HSL to hex
h = hue / 360.0
s, l = 0.7, 0.55
c = (1 - abs(2 * l - 1)) * s
x = c * (1 - abs((h * 6) % 2 - 1))
m = l - c / 2
h6 = int(h * 6)
if h6 == 0: r, g, b = c, x, 0
elif h6 == 1: r, g, b = x, c, 0
elif h6 == 2: r, g, b = 0, c, x
elif h6 == 3: r, g, b = 0, x, c
elif h6 == 4: r, g, b = x, 0, c
else: r, g, b = c, 0, x
hex_color = '#{:02X}{:02X}{:02X}'.format(
int((r + m) * 255), int((g + m) * 255), int((b + m) * 255))
lat, lon = geohash_center(geohash)
return {
'geohash': geohash,
'lat': lat,
'lon': lon,
'precision': len(geohash),
'seed': seed,
'hue': hue,
'hex': hex_color,
'trit': trit
}
def colored_geohash(lat: float, lon: float, precision: int = 9) -> dict:
"""Encode and color in one step."""
gh = encode_geohash(lat, lon, precision)
return color_geohash(gh)
Установить geohash-coloring в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл geohash-coloring?
Geohash Coloring Skill
Как установить скилл geohash-coloring?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл geohash-coloring запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic