geohash-kit 1.5.3 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/llms.txt +14 -0
- package/package.json +12 -7
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# geohash-kit
|
|
2
2
|
|
|
3
|
+
**Nostr:** [`npub1mgvlrnf5hm9yf0n5mf9nqmvarhvxkc6remu5ec3vf8r0txqkuk7su0e7q2`](https://njump.me/npub1mgvlrnf5hm9yf0n5mf9nqmvarhvxkc6remu5ec3vf8r0txqkuk7su0e7q2)
|
|
4
|
+
|
|
3
5
|
**The modern TypeScript geohash toolkit — encode, decode, cover polygons, and discover location-based Nostr events.**
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/geohash-kit)
|
|
@@ -45,6 +47,8 @@ const adj = neighbours(hash) // { n, ne, e, se, s, sw, w, nw }
|
|
|
45
47
|
const d = distance('gcpvj', 'u09tu') // ~340km (London → Paris)
|
|
46
48
|
|
|
47
49
|
// Cover a polygon with geohashes
|
|
50
|
+
// Note: polygon coordinates are [longitude, latitude] (GeoJSON standard)
|
|
51
|
+
// This is the opposite of encode(latitude, longitude)
|
|
48
52
|
const coverage = polygonToGeohashes([
|
|
49
53
|
[-0.15, 51.50], [-0.10, 51.50],
|
|
50
54
|
[-0.10, 51.52], [-0.15, 51.52],
|
|
@@ -244,6 +248,16 @@ Performance summary:
|
|
|
244
248
|
|
|
245
249
|
For detailed performance analysis, device comparisons, and optimization guidance, see [docs/BENCHMARKS.md](./docs/BENCHMARKS.md).
|
|
246
250
|
|
|
251
|
+
## Runtime Compatibility
|
|
252
|
+
|
|
253
|
+
geohash-kit is pure ESM with zero dependencies and no Node.js-specific APIs. It works in:
|
|
254
|
+
|
|
255
|
+
- **Node.js** 18+ (supported, tested in CI)
|
|
256
|
+
- **Deno** — import from npm: `import { encode } from 'npm:geohash-kit'`
|
|
257
|
+
- **Bun** — works out of the box: `import { encode } from 'geohash-kit'`
|
|
258
|
+
- **Browsers** — bundler-compatible (Vite, esbuild, Rollup, webpack 5)
|
|
259
|
+
- **Cloudflare Workers** — ESM-compatible, no filesystem or network calls
|
|
260
|
+
|
|
247
261
|
## Android Compatibility
|
|
248
262
|
|
|
249
263
|
For Kotlin/Android parity implementations, use the compatibility contract and versioned vectors:
|
|
@@ -256,6 +270,24 @@ For Kotlin/Android parity implementations, use the compatibility contract and ve
|
|
|
256
270
|
|
|
257
271
|
See [llms.txt](./llms.txt) for a concise API summary, or [llms-full.txt](./llms-full.txt) for the complete reference with examples.
|
|
258
272
|
|
|
273
|
+
## Part of the ForgeSworn Toolkit
|
|
274
|
+
|
|
275
|
+
[ForgeSworn](https://forgesworn.dev) builds open-source cryptographic identity, payments, and coordination tools for Nostr.
|
|
276
|
+
|
|
277
|
+
| Library | What it does |
|
|
278
|
+
|---------|-------------|
|
|
279
|
+
| [nsec-tree](https://github.com/forgesworn/nsec-tree) | Deterministic sub-identity derivation |
|
|
280
|
+
| [ring-sig](https://github.com/forgesworn/ring-sig) | SAG/LSAG ring signatures on secp256k1 |
|
|
281
|
+
| [range-proof](https://github.com/forgesworn/range-proof) | Pedersen commitment range proofs |
|
|
282
|
+
| [canary-kit](https://github.com/forgesworn/canary-kit) | Coercion-resistant spoken verification |
|
|
283
|
+
| [spoken-token](https://github.com/forgesworn/spoken-token) | Human-speakable verification tokens |
|
|
284
|
+
| [toll-booth](https://github.com/forgesworn/toll-booth) | L402 payment middleware |
|
|
285
|
+
| [geohash-kit](https://github.com/forgesworn/geohash-kit) | Geohash toolkit with polygon coverage |
|
|
286
|
+
| [nostr-attestations](https://github.com/forgesworn/nostr-attestations) | NIP-VA verifiable attestations |
|
|
287
|
+
| [dominion](https://github.com/forgesworn/dominion) | Epoch-based encrypted access control |
|
|
288
|
+
| [rendezvous-kit](https://github.com/forgesworn/rendezvous-kit) | Fair meeting point discovery using isochrones |
|
|
289
|
+
| [nostr-veil](https://github.com/forgesworn/nostr-veil) | Privacy-preserving Web of Trust |
|
|
290
|
+
|
|
259
291
|
## Licence
|
|
260
292
|
|
|
261
293
|
[MIT](https://github.com/forgesworn/geohash-kit/blob/main/LICENSE)
|
package/llms.txt
CHANGED
|
@@ -34,6 +34,8 @@ Basic geohash operations: encode, decode, bounds, neighbours, distance.
|
|
|
34
34
|
### geohash-kit/coverage
|
|
35
35
|
Polygon-to-geohash coverage with adaptive threshold subdivision.
|
|
36
36
|
|
|
37
|
+
**Coordinate order:** `polygonToGeohashes` accepts `[longitude, latitude]` pairs (GeoJSON order) — the opposite of `encode(latitude, longitude)`. This is the most common source of bugs when migrating from `encode`.
|
|
38
|
+
|
|
37
39
|
- polygonToGeohashes(polygon, options?) → multi-precision hash set (accepts [lon,lat][], GeoJSON Polygon, or MultiPolygon)
|
|
38
40
|
- geohashesToGeoJSON(hashes) → GeoJSON FeatureCollection
|
|
39
41
|
- geohashesToConvexHull(hashes) → polygon vertices
|
|
@@ -75,6 +77,18 @@ const tags = createGTagLadder(hash) // [['g','g'], ['g','gc'], ['g','gcp'], ['g'
|
|
|
75
77
|
const filter = createGTagFilter(51.5074, -0.1278, 5000) // { '#g': ['gcpvj', 'gcpvm', ...] }
|
|
76
78
|
```
|
|
77
79
|
|
|
80
|
+
## Alternatives
|
|
81
|
+
|
|
82
|
+
geohash-kit vs the field:
|
|
83
|
+
|
|
84
|
+
- **ngeohash** (171k/week) — CommonJS, no TypeScript, no polygon coverage, no Nostr, last published 2018. geohash-kit is a drop-in ESM replacement.
|
|
85
|
+
- **geohashing** (7k/week) — TypeScript, but no polygon coverage, no Nostr g-tags.
|
|
86
|
+
- **latlon-geohash** (19k/week) — no TypeScript native, no polygon, no Nostr.
|
|
87
|
+
- **geohash-poly / shape2geohash** — single-precision brute-force polygon coverage only; no TypeScript, no Nostr.
|
|
88
|
+
- **nostr-geotags** — generates Nostr geo tags but no geohash maths, no polygon coverage.
|
|
89
|
+
|
|
90
|
+
geohash-kit is the only library combining TypeScript-native types, adaptive multi-precision polygon coverage, Nostr g-tag primitives, and zero runtime dependencies.
|
|
91
|
+
|
|
78
92
|
## Optional
|
|
79
93
|
|
|
80
94
|
- llms-full.txt: Full API reference with all type signatures
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geohash-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Modern TypeScript geohash toolkit — encode, decode, cover polygons, and build Nostr filters",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -63,23 +63,28 @@
|
|
|
63
63
|
"node": ">=18"
|
|
64
64
|
},
|
|
65
65
|
"homepage": "https://forgesworn.github.io/geohash-kit/",
|
|
66
|
+
"bugs": {
|
|
67
|
+
"url": "https://github.com/forgesworn/geohash-kit/issues"
|
|
68
|
+
},
|
|
66
69
|
"repository": {
|
|
67
70
|
"type": "git",
|
|
68
71
|
"url": "git+https://github.com/forgesworn/geohash-kit.git"
|
|
69
72
|
},
|
|
70
73
|
"devDependencies": {
|
|
71
|
-
"@semantic-release/changelog": "^6.0.3",
|
|
72
|
-
"@semantic-release/git": "^10.0.1",
|
|
73
|
-
"@semantic-release/github": "^12.0.6",
|
|
74
|
-
"@semantic-release/npm": "^13.1.5",
|
|
75
|
-
"semantic-release": "^25.0.3",
|
|
76
74
|
"typescript": "^5.7.0",
|
|
77
75
|
"vitest": "^4.1.0"
|
|
78
76
|
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"provenance": true
|
|
79
|
+
},
|
|
79
80
|
"files": [
|
|
80
81
|
"dist",
|
|
81
82
|
"LICENSE",
|
|
82
83
|
"llms.txt",
|
|
83
84
|
"llms-full.txt"
|
|
84
|
-
]
|
|
85
|
+
],
|
|
86
|
+
"funding": {
|
|
87
|
+
"type": "lightning",
|
|
88
|
+
"url": "lightning:thedonkey@strike.me"
|
|
89
|
+
}
|
|
85
90
|
}
|