Loading

GEOCELL->

geo

The GEOCELL-> function converts a LONG geocell to a STRING HHCode prefix. The resulting string length is half the resolution of the geocell.

This function cannot convert to BYTES because this representation is limited to resolutions multiple of 4.

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.

GEOCELL-> is available since version 2.6.0.

See also

Signatures

Examples