This topic describes the syntax of geo functions. This topic also provides examples on how to use the functions.
The following table describes the geo functions that are supported by Simple Log Service.
Function | Syntax | Description | Supported in SQL | Supported in SPL |
geohash(x) | Encodes latitudes and longitudes by using the Geohash algorithm. Note Simple Log Service allows you to convert IP addresses into geographic location information such as countries, provinces, cities, operators, and latitudes and longitudes. For more information, see IP functions. | √ | × |
geohash function
The geohash function encodes latitudes and longitudes by using the Geohash algorithm.
Syntax
geohash(x)
Parameters
Parameter | Description |
x | The value of this parameter is of the string type. The value indicates a latitude and a longitude. Example: |
Return value type
The string type.
Examples
Use the ip_to_geo function to convert the value of the client_ip field into a latitude and a longitude. Then, use the geohash function to encode the latitude and longitude.
Query statement
* | SELECT geohash(ip_to_geo(client_ip)) AS hash
Query and analysis results