API Docs - v4.0.19¶
Geo¶
findCityFromIP (Function)¶
This function returns the city that is related to the give IP address.
Syntax
<STRING> geo:findCityFromIP(<STRING> ip)
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
ip | The IP address of which the related city needs to be fetched. | STRING | No | No |
Examples EXAMPLE 1
define stream IpStream(ip string); from IpStream select geo:getCity(ip) as city insert into outputStream;
This query returns the corresponding city of the given IP address.
findCountryFromIP (Function)¶
This function returns the country that is related to the given IP address.
Syntax
<STRING> geo:findCountryFromIP(<STRING> ip)
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
ip | The IP address of which the related country needs to be fetched. | STRING | No | No |
Examples EXAMPLE 1
define stream IpStream(ip string); from IpStream select geo:getCountry(ip) as country insert into outputStream;
This query returns the corresponding country of the given IP address.
geocode (Stream Function)¶
The geo code stream function uses basic details relating to a location (e.g., street name, number,etc.) as the input and returns the longitude, latitude, and the address of that location.
Syntax
geo:geocode(<STRING> location)
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
location | Location details(Street name, number etc.). | STRING | No | No |
Name | Description | Possible Types |
---|---|---|
longitude | The longitude of the location. | DOUBLE |
latitude | The latitude of the location. | DOUBLE |
address | Location details. | STRING |
Examples EXAMPLE 1
geocode("5 Avenue Anatole France, 75007 Paris, France")
This query returns the longitude and latitude of the given location with the location details. The expected results are 48.8588871d, 2.2944861d, "5 Avenue Anatole France, 75007 Paris, France"
geocoordinate (Stream Function)¶
geocoordinate stream function returns the longitude and latitude values of a location which is related to the given IPV4 or IPV6 address.
Syntax
geo:geocoordinate(<STRING> ip)
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
ip | The IP address that the user need to get the longitude and latitude | STRING | No | No |
System Parameters
Name | Description | Default Value | Possible Parameters |
---|---|---|---|
apiurl | ipInfoDB(https://www.ipinfodb.com/) provides an API toget IP information from their IP address geolocation database.This API provides an url to get the information based on IP address | N/A | N/A |
Name | Description | Possible Types |
---|---|---|
longitude | The longitude of the location which is related to the given IP | DOUBLE |
latitude | The latitude of the location which is related to the given IP | DOUBLE |
Examples EXAMPLE 1
define stream IpStream(ip string); from IpStream#geo:geocoordinate(ip) select latitude, longitude insert into outputStream;
This will return the longitude and latitude of the given IPV4 or IPV6 address. So the results for the geocoordinate(95.31.18.119) are 55.7522, 37.6156
reversegeocode (Stream Function)¶
This extension transforms pairs of latitude and longitude coordinates into precise address information. The output contains string properties including the 'streetNumber', 'neighborhood', 'route', 'administrativeAreaLevelTwo', 'administrativeAreaLevelOne', 'country', 'countryCode', 'postalCode', and the 'formattedAddress' in the given order. However, this information is not available for all the geo coordinates. e.g., If the latitude and longitude represent a place in a forest, only the high level information such as the country is returned. In such scenarios, "N/A" is returned as the value for return attributes of which the values cannot be derived.
Syntax
geo:reversegeocode(<DOUBLE> longitude, <DOUBLE> latitude)
QUERY PARAMETERS
Name | Description | Default Value | Possible Data Types | Optional | Dynamic |
---|---|---|---|---|---|
longitude | The longitude value of the required location. | DOUBLE | No | No | |
latitude | The latitude value of the required location. | DOUBLE | No | No |
Examples EXAMPLE 1
reversegeocode(6.909785, 79.852603)
This query returns the precise address information of the given location. In this example, it returns the following value:
"27", "N/A", "Palm Grove", "Colombo", "Western Province", "Sri Lanka", "LK", "00300", "27 Palm Grove, Colombo 00300, Sri Lanka"