https://github.com/w8r/hilbert
2D Hilbert curve coordinate encoder/decoder
https://github.com/w8r/hilbert
geohashing geometry hilbert-curve space-filling-curves spatial-index
Last synced: 2 months ago
JSON representation
2D Hilbert curve coordinate encoder/decoder
- Host: GitHub
- URL: https://github.com/w8r/hilbert
- Owner: w8r
- License: apache-2.0
- Created: 2017-09-13T16:32:34.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-13T17:25:17.000Z (over 7 years ago)
- Last Synced: 2025-04-28T19:07:14.391Z (3 months ago)
- Topics: geohashing, geometry, hilbert-curve, space-filling-curves, spatial-index
- Language: JavaScript
- Size: 9.77 KB
- Stars: 10
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hilbert-2D [](https://badge.fury.io/js/hilbert-2d) [](https://circleci.com/gh/w8r/hilbert)
2D [Hilbert curve](https://en.wikipedia.org/wiki/Hilbert_curve) coordinate encoder/decoder
;
The code is ported from Go to JS from https://github.com/google/hilbert/
Inlined rotations to eliminate function calls.## Install
```
npm install -S hilbert-2d
```## API
```js
const h = require('hilbert-2d');h.encode(16, [12, 23]); // 837
h.decode(16, 837); // [12, 23]
```## TODO
- [ ] Add range queries and sorting
- [ ] Add examples