Skip to content

API Docs - v4.0.15

Geo

findCityFromIP (Function)

Returns the city which 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 that the user need to get the relevant city STRING No No

Examples EXAMPLE 1

define stream IpStream(ip string);
from IpStream
select geo:getCity(ip) as city
insert into outputStream;

This will return the corresponding city to the given ip address

findCountryFromIP (Function)

Returns the country which is related to the give ip address

Syntax

<STRING> geo:findCountryFromIP(<STRING> ip)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
ip The IP address that the user need to get the relevant country STRING No No

Examples EXAMPLE 1

define stream IpStream(ip string);
from IpStream
select geo:getCountry(ip) as country 
insert into outputStream;

This will return the corresponding country to the given ip address

geocode (Stream Function)

Geo code stream function

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
Extra Return Attributes
Name Description Possible Types
longitude Longitude of the location DOUBLE
latitude Latitude of the location DOUBLE
address Location details STRING

Examples EXAMPLE 1

geocode("5 Avenue Anatole France, 75007 Paris, France")

This will returns the longitude and latitude of the given location with the location details. so the results are 48.8588871d, 2.2944861d, "5 Avenue Anatole France, 75007 Paris, France"

reversegeocode (Stream Function)

This extension transforms a latitude and longitude coordinates into precise address information. The output contains string properties streetNumber, neighborhood, route, administrativeAreaLevelTwo, administrativeAreaLevelOne, country, countryCode, postalCode and formattedAddress in order. However, these information are not available for all the geo coordinates. For example, if the latitude and longitude represent a place in a forest, only the high level information like country will be returned. For those which are not available, this extension will return "N/A" as the value.

Syntax

geo:reversegeocode(<DOUBLE> longitude, <DOUBLE> latitude)

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
longitude longitude value of the required location DOUBLE No No
latitude latitude value of the required location DOUBLE No No

Examples EXAMPLE 1

reversegeocode(6.909785, 79.852603)

This will return the precise address information of the given location. On this case this will return "27", "N/A", "Palm Grove", "Colombo", "Western Province", "Sri Lanka", "LK", "00300", "27 Palm Grove, Colombo 00300, Sri Lanka"