geo_info_from_ip_address
This page explains how to use the geo_info_from_ip_address function in APL.
The geo_info_from_ip_address
function in APL retrieves geographic information based on an IP address. It maps an IP address to attributes such as city, region, and country, allowing you to perform location-based analytics on your datasets. This function is particularly useful for analyzing web logs, security events, and telemetry data to uncover geographic trends or detect anomalies based on location.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.
Usage
Syntax
Parameters
Parameter | Type | Description |
---|---|---|
ip_address | string | The IP address for which to retrieve geographic information. |
Returns
A dynamic object containing the IP address’s geographic attributes (if available). The object contains the following fields:
Name | Type | Description |
---|---|---|
country | string | Country name |
state | string | State (subdivision) name |
city | string | City name |
latitude | real | Latitude coordinate |
longitude | real | Longitude coordinate |
country_iso | string | ISO code of the country |
time_zone | string | Time zone in which the IP address is located |
Use case example
Use geographic data to analyze web log traffic.
Query
Output
This query identifies the geographic location of the IP address 172.217.22.14
.
List of related functions
- has_any_ipv4: Matches any IP address in a string column with a list of IP addresses or ranges.
- has_ipv4: Checks if a single IP address is present in a string column.
- ipv4_is_in_range: Checks if an IP address is within a specified range.
- ipv4_is_private: Checks if an IPv4 address is within private IP ranges.
IPv4 Examples
Extract geolocation information from IPv4 address
Project geolocation information from IPv4 address
Filter geolocation information from IPv4 address
Group geolocation information from IPv4 address
IPv6 Examples
Extract geolocation information from IPv6 address
Project geolocation information from IPv6 address
Filter geolocation information from IPv6 address
Group geolocation information from IPv6 address
Was this page helpful?