s2_cells
Version, currently 1.0.13 versions
- 2.0.0latestJul 27, 2024
- 1.0.1not indexedJul 27, 2024
- 1.0.0not indexedJul 27, 2024
github.com/spider-gazelle/s2_cells
maps latitude and longitude to S2 Cells https://s2geometry.io/
Nothing has been indexed for 1.0.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
s2_cells:
github: spider-gazelle/s2_cells
version: ~> 1.0.1Then run:
shards installshard.yml
No shard.yml has been indexed for 1.0.1. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Crystal Lang S2 Cells
Maps Lat Lon coordinates to S2 Cells. Useful for things like storing points in InfluxDB
Installation
-
Add the dependency to your
shard.yml:dependencies: s2_cells: github: spider-gazelle/s2_cells -
Run
shards install
Usage
require "s2_cells"
# index a location in your database
lat = -33.870456
lon = 151.208889
level = 24
cell = S2Cells.at(lat, lon).parent(level)
token = cell.to_token # => "3ba32f81"
# or
id = cell.id # => Int64
# find all the indexes in an area
p1 = S2Cells::LatLng.from_degrees(33.0, -122.0)
p2 = S2Cells::LatLng.from_degrees(33.1, -122.1)
cells = S2Cells.in(p1, p2) # => Array(CellId)
# then can search your index:
# loc_index = ANY(cells.map(&.id))
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.0.1- Tagged
- Jul 27, 2024
- Commit
e253c003cf02- Indexed
- not yet
Dependents
Repository
github.com/spider-gazelle/s2_cells
Metadata
- Created
- Aug 12, 2026
- Updated
- Oct 1, 2026
- Synced
- Oct 1, 2026
- Versions
- 3