Documentation
¶
Index ¶
- Constants
- Variables
- func Base32ForCanonical(canonical uint64) (string, error)
- func CanonicalForCell(cellID string) (uint64, error)
- func CanonicalFromBase32(input string) (uint64, error)
- func CanonicalFromWords(input string) (uint64, error)
- func CellForCanonical(canonical uint64) (string, error)
- func CellIDFor(lat, lng float64) (string, error)
- func ColumnRangeForRow(row int64) (int64, int64, error)
- func ColumnsForRow(row int64) (int64, error)
- func DecodeCellAddressBase32(input string) (string, error)
- func DecodeCellAddressWords(input string) (string, error)
- func FormatBase32(code string) string
- func WordsForCanonical(canonical uint64) ([4]string, error)
- type Address
- type Bounds
- type CellAddressError
- type Point
Constants ¶
const ( // GridVersion names the frozen latitude band table. GridVersion = "grid-2" // GridCellMeters is the nominal north-south cell size. GridCellMeters = 3 // GridRowDegrees is the exact latitude height of every row. GridRowDegrees = 0.00002713115198871344 // GridMinLatitude is the southern edge of the grid. GridMinLatitude = -89.98 // GridMaxLatitude is the northern edge of the grid. GridMaxLatitude = 89.98 // GridTableSHA256 pins the band table bytes. GridTableSHA256 = "747b27e952656d4e631f20a1d5421303c48da2aa94b8bc3533390042ab7bf1c9" // AddressVersion names the frozen address bit layout. AddressVersion = "cell-address-2" // AddressGridVersion names the grid that addresses point into. AddressGridVersion = "grid-2" // WordListVersion names the frozen word list. WordListVersion = "words-4" // WordListSHA256 pins the word list bytes. WordListSHA256 = "e3da4fd6ff4498a0fdd48eb0bc0e0b588602d0e039dc9d71233e537ed5991ffa" )
Variables ¶
var ( // GridMinRow is the southernmost row. GridMinRow int64 // GridMaxRow is the northernmost row. GridMaxRow int64 // GridMinColumn is the westernmost reachable column. GridMinColumn int64 // GridMaxColumn is the easternmost reachable column. GridMaxColumn int64 // GridBandCount counts northern and southern bands together. GridBandCount int64 // DistrictRowCount is the number of row districts in the bit layout. DistrictRowCount int64 // DistrictColCount is the number of column districts in the bit layout. DistrictColCount int64 )
Functions ¶
func Base32ForCanonical ¶
Base32ForCanonical renders the eleven character short code.
func CanonicalForCell ¶
CanonicalForCell packs a cell id into its 48 bit canonical value.
func CanonicalFromBase32 ¶
CanonicalFromBase32 parses a short code in any accepted spelling.
func CanonicalFromWords ¶
CanonicalFromWords parses a four word address in any case or spacing.
func CellForCanonical ¶
CellForCanonical validates a canonical value and returns its cell id.
func ColumnRangeForRow ¶
ColumnRangeForRow returns the reachable column interval at row.
func ColumnsForRow ¶
ColumnsForRow returns the exact column count of the band containing row.
func DecodeCellAddressBase32 ¶
DecodeCellAddressBase32 resolves a short code back to its cell id.
func DecodeCellAddressWords ¶
DecodeCellAddressWords resolves a four word address back to its cell id.
func FormatBase32 ¶
FormatBase32 adds the display hyphens to an eleven character short code.
func WordsForCanonical ¶
WordsForCanonical returns the four word address for a canonical value.
Types ¶
type Address ¶
Address is every representation of one cell address.
func EncodeCellAddress ¶
EncodeCellAddress returns every representation of a cell id.
type Bounds ¶
Bounds is a cell rectangle in degrees.
func CellBoundsFor ¶
CellBoundsFor reconstructs the exact geographic rectangle of a cell id.
type CellAddressError ¶
CellAddressError reports a rejected cell id, word sequence or short code.
func (*CellAddressError) Error ¶
func (e *CellAddressError) Error() string