s2_cells v1.0.1

maps latitude and longitude to S2 Cells https://s2geometry.io/

Crystal Lang S2 Cells

CI

Maps Lat Lon coordinates to S2 Cells. Useful for things like storing points in InfluxDB

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      s2_cells:
        github: spider-gazelle/s2_cells
    
  2. Run shards install

Usage


require "s2_cells"

lat = -33.870456
lon = 151.208889
level = 24

cell = S2Cells.at(lat, lon).parent(level)
token = cell.to_token # => "3ba32f81"

# Or a little more direct
S2Cells::LatLon.new(lat, lon).to_token(level)

Repository

s2_cells

Owner
Statistic
  • 0
  • 0
  • 0
  • 2
  • 0
  • almost 3 years ago
  • October 8, 2020
License

MIT License

Links
Synced at

Tue, 07 May 2024 22:41:53 GMT

Languages