惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
J
Java Code Geeks
量子位
腾讯CDC
C
Check Point Blog
小众软件
小众软件
IT之家
IT之家
I
InfoQ
Hugging Face - Blog
Hugging Face - Blog
Stack Overflow Blog
Stack Overflow Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
GbyAI
GbyAI
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
博客园_首页
S
SegmentFault 最新的问题
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Martin Fowler
Martin Fowler

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
offline land/sea lookup (a Trifold library)
jaakl · 2026-06-12 · via Hacker News: Show HN

landcheck: is this point on land or in the sea?

An offline lookup library built on the Trifold grid. Thanks to exact aperture-4 nesting, the level-10 grid (~7 km cells) classified against Natural Earth collapses into a 182 KB dataset that answers anywhere on Earth in microseconds, with a confidence value for every answer. Python and JavaScript give identical results. This page runs the real JS library in your browser; the dataset is embedded right in this HTML file.

Try it on the map

Interactive demo

Load sample points or your own file (CSV lon,lat or GeoJSON points), and every point is classified in your browser by the bundled library, with no server and no network call per lookup. The lookups-per-second figure is measured tightly around the classification loop on your machine (map rendering and file parsing excluded), so it is the real library throughput. Use the 100k-random button for a stable number.

Controls

Your own points

Open CSV / GeoJSON…

CSV: lon,lat[,name] per line (or a header naming lat/lon columns in either order). GeoJSON: any FeatureCollection of Points. Files stay on your machine.

OSM coastal refinement exact OSM polygon test wherever the coastline crosses a cell (downloads once)

Off: coastal answers use the bundled land-area fraction. On: near-exact coastline. Watch how the counts, confidence and lookup rate change.

Debug layers source coastline (NE, follows the refinement setting)

Click anywhere on the map to see the level-10 triangle and its classification.

land: certain (confidence 1.0)
coast: mixed cell
sea: certain (confidence 1.0)
answer flipped by OSM refinement

Loading dataset…

Click any classified point for its full answer: cell address (computed on the fly for sea points, whose cells are not stored), kind, confidence and land fraction. Note the Natural Earth 1:50m caveats: lakes count as land and islets below its resolution are missing. Switching on the OSM coastal refinement makes OSM authoritative in cells crossed by either source coastline. Try the cities sample with it on and off and compare the answers near coasts.

User guide

JavaScript (browser or Node)

import { LandCheck } from "./landcheck.mjs";

// Node: bundled file · browser: fetch the 182 KB dataset
const lc = await LandCheck.fromFile();              // Node
const lc = await LandCheck.fromUrl("landsea_L10.tfls"); // browser

lc.isLand(24.7536, 59.437);   // true  (lon, lat)
lc.check(-0.1276, 51.5072);
// { land: true, kind: 'land', confidence: 1,
//   landFraction: 1, cell: 'TFA95BM', refined: false }

Python (stdlib only)

from landcheck import LandCheck

lc = LandCheck()                       # bundled data
lc.is_land(24.7536, 59.4370)           # True
lc.check(-0.1276, 51.5072)
# LandResult(land=True, kind='land', confidence=1.0,
#   land_fraction=1.0, cell='TFA95BM', refined=False)

# vectorised: ~2.8 µs/point with numpy
lc.is_land_batch(lons, lats)

What the answer means

kindmeaninglandconfidence
landcell wholly inside landtrue1.0
seacell absent from the datasetfalse1.0
coastmixed cell; bundled land-area fraction decides fraction ≥ 0.5max(f, 1−f)
coast + refineddecided by the optional OSM polygon layer exact0.99

Measured accuracy: 99.82% agreement with exact polygon containment on 30,000 uniform random points. The land and sea answers were 100% correct; all residual error lives in coast answers, which self-report lower confidence. With the OSM refinement loaded, coastal answers reach 99.95%.

Command line

$ python landcheck/python/landcheck.py 24.7536 59.4370
LAND  kind=land  confidence=1.000  land_fraction=1.0  cell=TFAVKGR  refined=False

Technical info

Canonical index

Any Trifold cell at level ≤ 10 maps to addr64 >> 39, a 25-bit integer where a level-l cell covers exactly 410−l consecutive indices. The whole classification becomes run-length intervals.

TFLS format · 182 KB

153,884 runs as varint(gap), varint(len·2|coastal) + a 4-bit land fraction per coastal cell, zlib-compressed. Level-agnostic: the same tooling serves an L8 (~30 KB) or L12 (~3 MB) variant.

Lookup path

Pure-float point location (no dependencies, bit-identical to the SDK) descends 10 subdivision levels, then one binary search over the run starts. ~0.8 µs in Node, ~13 µs in pure Python, ~2.8 µs batched with numpy.

OSM refinement · TFLR

OSM simplified land polygons clipped to every cell crossed by either source coastline, quantized to a cell-local 16-bit grid (~0.1 m), with zigzag-varint rings and the even-odd rule. The OSM polygon test can override Natural Earth land, sea or fraction answers in those cells.

Full documentation, build scripts (build.py, refine_build.py) and the cross-language test suite live in landcheck/ on GitHub. Roadmap: country detection with the same run-length + clipped-border approach, an L12 variant, published pip/npm packages.

Benchmark: Trifold vs SQL spatial engines

Same job for every engine: classify 100,000 sphere-uniform random points against the same OSM simplified land polygons. Median of seven warm runs on an Apple M5 Pro laptop (June 2026); BigQuery ran as a managed on-demand service. In batch mode the OSM-refined Trifold was 3–4× faster than BigQuery and PostGIS and ~30× faster than DuckDB Spatial; called one point at a time it answered ~86,000 lookups per second, 40× the embedded DuckDB rate.

Batch · 100,000 points per call

Trifold base

459,096 pts/s

Singular · one point per call

The SQL engines compute exact polygon containment on the loaded OSM snapshot; Trifold's compact dataset agrees with that result on 99.5% of points (refined). PostGIS singular includes localhost TCP + Docker transport; DuckDB runs embedded in-process. BigQuery's singular mode was not run. Full methodology, dataset manifest and caveats: benchmark.md.