Skip to content

Geolocation Functions

GeoHashDecode

returns the latitude and longitude for a given geo hash string

Syntax:

GeoHashDecode(hash: string) -> {lat: float, lng: float}?

Examples:

GeoHashDecode("8675309").lat = 13.231
GeoHashDecode("8675309").lng = -164.485

GeoHashEncode

returns the string geohash for a given latitude and longitude

Syntax:

GeoHashEncode(lat: float, lng: float) -> string?

Examples:

GeoHashEncode(34.0901, -118.4065) = "9q5cctgj0x4r"

GeoMiles

returns the miles between two lat/lng coordinates

Syntax:

GeoMiles(lat1: float, lng1: float, lat2: float, lng2: float) -> float

Examples:

GeoMiles(41.5,87.37, 40.47, 73.58) = 721.8461040487858
GeoMiles(-34, 151, -36.52, 174.45) = 1330.7963962578674

IPCity

returns the city for a given IP address

Syntax:

IPCity(ip: string) -> string?

Examples:

IPCity("202.162.192.8") = "Los Angeles"
IPCity("0") is null

IPCountry

returns the country code for a given IP address

Syntax:

IPCountry(ip: string) -> string?

Examples:

IPCountry("202.162.192.8") = "US"
IPCountry("0") is null

IPLocate

returns the latitude and longitude for a given IP address

Syntax:

IPLocate(ip: string) -> {lat: float, lng: float}?

Examples:

IPLocate("202.162.192.8") = {lat: 3.5847, lng: 98.6629}
IPLocate("0") is null

IPRegion

returns the region (state) for a given IP address

Syntax:

IPRegion(ip: string) -> string?

Examples:

IPRegion("202.162.192.8") = "California"
IPRegion("0") is null

IPZip

returns the nearest postal code to a given IP address

Syntax:

IPZip(ip: string) -> string?

Examples:

IPZip("70.112.72.100") = "78613"
IPZip("0") is null