RSSAmplifier

Blog

Home on AJ Friend

Recent content in Home on AJ Friend

ajfriend.comRSS feed ↗12 posts

Latest posts

Geo Viz

H3 Cell Viz – interactive H3 cell visualizer GeoJSON Viz – interactive GeoJSON polygon viewer

Codenames

Board – word cards for the table Map – spymaster key card

A Failed Attempt at Improving H3 Compaction

I tried to make the H3 compactCells function faster. I failed. But I think the approach is interesting, and it may still prove useful in the future, so here’s a writeup. The prototype code is at: https://github.com/ajfriend/h3/pull/1 . I used Claude Code quite a bit for benchmarks, tests, and trying out different sorting algorithms—it did all that much faster than I could have. I still…

H3 Bit Layout

H3 cells are stored as 64-bit integers, with bit fields encoding the cell’s mode, resolution, base cell, and hierarchical path. Below is a diagram of the bit layout for a cell, which can be written in a few ways: '84754a9ffffffff' (15-digit Python string) 0x84754a9ffffffff (15-digit hex literal) 0x084754a9ffffffff (16-digit hex literal with leading 0 ) 596538564771053567 (decimal literal)…

[WIP] Making H3's cells-to-polygon faster

Note : This post is currently a quick-and-dirty attempt at explaining the algorithm behind the PR uber/h3 #1113 . My plan is to grow this into a proper blog post with more context, background, etc. I also have a Python version of this algorithm shared at https://github.com/ajfriend/h3c2p # Goal: H3 cells to spherical polygons A collection of H3 cells describes a subset of the globe, and an…

[WIP] Computing Spherical Polygon Areas

The H3 library provides a hexagonal geospatial grid system, and being a geospatial library, one of the things we want to be able to do is to compute the surface areas of polygons on the sphere. This post will go through the math behind the spherical polygon area calculation that we use, which I mostly learned about through the D3 library’s area calculation code . This algorithm is robust…

[WIP] Elements of Spherical Polygons

These are some of my notes on constructing spherical polygons, related to my work on the H3 cells-to-polygon functionality. When working with spherical polygons, “edge cases” often cause problems: larger-than-a-hemisphere polygons, edges that cross the antimeridian, polygons containing the north or south pole, or issues with loop orientation. Luckly, all these issues can be handled…

Notes on justfiles

Some notes—mostly for myself—around how I use just . # Clean recipe clean : just _rm env just _rm .venv just _rm '*.pytest_cache' # put wildcards in quotes just _rm .DS_Store _rm pattern : -@find . -name '{{pattern}}' -prune -exec rm -rf {} + Alternatively, there’s git clean -fdx , but I don’t use that often. # UV uv is great, but I really wish it had an “online, but…

Big Figures

Can i plot some big figs? # Globes

Reproducible Plots Example

This post demonstrates keeping Python code and generated figures together with the post content. ## Sine and Cosine Waves Here’s a simple plot of sine and cosine functions generated with matplotlib: ## Random Walk A visualization of a 2D random walk with 1000 steps: ## Regenerating the Figures All figures in this post are generated from Python code in the code/ directory. The project uses uv…

Software

Software h3-py Author and maintainer H3 Steering Committee Member and co-maintainer duckboat Author and maintainer (and probably only user) CVXPY Contributor

Spherical Aspect Ratio

We can compute the spherical aspect ratio TODO: worry about the A 1/2 maximize subject to ​ lo g det A ∥ A x i ​ ∥ 2 ​ ≤ b ⊤ x i ​ , ∀ i = 1 , … , n ∥ b ∥ 2 ​ ≤ 1 ​