The ST_GeohashCoverExtend function returns the geohash values of all the cells that are
needed to cover an area that corresponds to the specified cell plus a buffer zone surrounding that
cell.
The buffer zone is the geometry that surrounds the input cell by a specified distance. Figure 1. Geohash extension where the distance is less than the length of the side of one cell
Figure 2. Geohash extension where the distance is greater than the length of the side of one
cell
Syntax
Parameters
geohash
A value of type BIGINT that represents the geohash value of the input cell. If the specified
geohash is NULL or empty, one row with a geohash value of NULL is returned. If the specified geohash
is invalid, error GSE9990C is
returned.
depth
A value of type INTEGER that identifies the depth of both the input geohash and the geohashes
that are to be returned.
Important: These depths must be identical; otherwise, the
result will not be accurate.
distance
The distance from the edge of the input cell that determines the size of the buffer zone. The
value cannot be negative or null.
units
A VARCHAR(128) value that identifies the units of the specified distance. The only allowed value
is 'METER', which is the default.
Shortcut functions
The following shortcut functions can be used instead of ST_GeohashCoverExtend:
Shortcut Function
Description
Equivalent ST_ GeohashCoverExtend Function
ST_ GeohashCoverExtend_Small(geohash, distance)
The input and output geohashes have a depth of 28.
ST_ GeohashCoverExtend(geohash, 28, distance)
ST_ GeohashCoverExtend_Medium(geohash,
distance)
The input and output geohashes have a depth of 23.
ST_ GeohashCoverExtend(geohash, 23, distance)
ST_ GeohashCoverExtend_Large(geohash, distance)
The input and output geohashes have a depth of 18.
ST_ GeohashCoverExtend(geohash, 18, distance)
ST_ GeohashCoverExtend_Huge(geohash, distance)
The input and output geohashes have a depth of 13.
ST_ GeohashCoverExtend(geohash, 13, distance)
Restrictions
The number of rows returned by this function cannot exceed 10,000 (SQL0443N).
The specified geometry must use SRS 4326 (GSE3001N).
Output
A column with the name GEOHASH of type BIGINT containing the geohash values of the cells
needed cover of the area that corresponds to the specified geohash cell after it has been extended
in all dimensions by the specified distance.
Examples
Example 1
The following SQL statement returns the geohash values of the cells that are needed to cover the
specified geohash cell, plus the area around that cell within a distance of 2 meters. The input and
output geohashes are at depth 28, which corresponds to an area of about 3
km2.
select geohash from table(st_geohashcoverextend(-4609863165478961152,28, 2,'meter'))
The
result is the input geohash (-4609863165478961152), plus the geohashes of the 8 neighboring cells.
These are the 9 geohashes are needed to cover the area determined by the input
parameters.
The following SQL statement returns the geohash values of the cells that are needed to cover the
specified geohash cell, plus the area around that cell within a distance of 2000 meters or 2 km. The
input and output geohashes are at depth 28, which corresponds to an area of about 3
km2.
select geohash from table(st_geohashcoverextend(-4609863165478961152,28, 2000,'meter'))
The
result is the input geohash (-4609863165478961152), plus the geohashes of the 24 neighboring cells
that are within the specified distance. These are the 25 geohashes are needed to cover the area
determined by the input
parameters.