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:

 ||                  ||                            ||
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.

->GEOCELL is available since version 2.6.0.

See also



'b5724df5' ->GEOCELL