Loading

->GEOCELL


geo
Since v2.6.0
Available on all platforms
See also

The ->GEOCELL function converts a STRING or a BYTES HHCode prefix to a LONG geocell. The length of the input implicitly specifies the resolution of the cell.

A geocell is a LONG where the 4 MSBs store the resolution and the 60 LSBs store a trimmed HHCode. The value stored in the 4 MSBs must be multiplied by 2 to give the resolution of the trimmed HHCode, thus only even resolutions can be represented in a geocell. A resolution of 0 is considered invalid and the highest resolution is 30. The value stored in the 60 LSBs are the 60 MSBs of a HHCode but only the 2*resolution MSBs must be considered.

Here is an example of the bits representation of a geocell and their meaning:

1001101101010111001001011000100010101111000000000000000000000000
\__/\__________________________________/\______________________/
 ||                  ||                            ||
Res: 9*2=18          ||                            ||
        18*2 relevant bits of HHCode     60-18*2 unrelevant bits

A GEOSHAPE is simply a list of geocells, see ->GEOSHAPE to build a GEOSHAPE from geocells.

Signature

Examples