This topic describes the basic syntax of geo functions and provides examples.
Log Service supports the following geo functions.
|
Function |
Syntax |
Description |
Supported in SQL |
Supported in SPL |
|
geohash(x) |
Encodes latitude and longitude coordinates into a geohash string. Note
Log Service converts an IP address into geographic information, such as the country, province, city, ISP, latitude, and longitude. For more information, see IP functions. |
√ |
× |
Geohash function
The geohash function encodes latitude and longitude coordinates into a geohash string.
Syntax
geohash(x)
Parameters
|
Parameter |
Description |
|
x |
The geographical coordinate to be encoded. This value is typically the output of another function. For example, the output of: |
Return value type
string
Examples
Use the ip_to_geo function to convert the value of the client_ip field into coordinates, and then use the geohash function to encode the coordinates.
-
Query statement
* | SELECT geohash(ip_to_geo(client_ip)) AS hash -
In the query results, the hash column returns
wwgqdmdu2v96.