Class Geolocation

Read-only class representing a position on the earth (latitude and longitude) and information associated with that location (e.g. country, city, etc). The Commerce Cloud Digital system can provide geolocation information for a Request and this information can be used in customer group segmentation rules.

Note: This class is not related to the store locator API (i.e. the GetNearestStores pipelet) which uses a static set of store locations loaded into the system by the merchant.

This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.

PropertyDescription
available: Boolean (read-only)Returns 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise.
city: String (read-only)Get the city name in English associated with this location.
countryCode: String (read-only)Get the ISO country code associated with this location.
countryName: String (read-only)Get the country name in English that the system associates with this location on the earth.
latitude: Number (read-only)Get the latitude coordinate associated with this location which is a number between -90.0 and +90.0.
longitude: Number (read-only)Get the longitude coordinate associated with this location which is a number between -180.0 and +180.0.
metroCode: String (read-only)Get the metro code associated with this location.
postalCode: String (read-only)Get the postal code associated with this location.
regionCode: String (read-only)Get the region (e.g.
regionName: String (read-only)Get the region (e.g.
ConstructorDescription
Geolocation(String, String, String, String, String, String, String, Number, Number)Constructor for a Geolocation object
MethodDescription
getCity()Get the city name in English associated with this location.
getCountryCode()Get the ISO country code associated with this location.
getCountryName()Get the country name in English that the system associates with this location on the earth.
getLatitude()Get the latitude coordinate associated with this location which is a number between -90.0 and +90.0.
getLongitude()Get the longitude coordinate associated with this location which is a number between -180.0 and +180.0.
getMetroCode()Get the metro code associated with this location.
getPostalCode()Get the postal code associated with this location.
getRegionCode()Get the region (e.g.
getRegionName()Get the region (e.g.
isAvailable()Returns 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise.

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

available: Boolean (read-only)

Returns 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise.


city: String (read-only)

Get the city name in English associated with this location.


countryCode: String (read-only)

Get the ISO country code associated with this location.


countryName: String (read-only)

Get the country name in English that the system associates with this location on the earth.


latitude: Number (read-only)

Get the latitude coordinate associated with this location which is a number between -90.0 and +90.0.


longitude: Number (read-only)

Get the longitude coordinate associated with this location which is a number between -180.0 and +180.0.


metroCode: String (read-only)

Get the metro code associated with this location.


postalCode: String (read-only)

Get the postal code associated with this location.


regionCode: String (read-only)

Get the region (e.g. province or state) code for this location.


regionName: String (read-only)

Get the region (e.g. province in state) name in English that the system associates with this location.


Geolocation(countryCode: String, countryName: String, regionCode: String, regionName: String, metroCode: String, city: String, postalCode: String, latitude: Number, longitude: Number)

Constructor for a Geolocation object

Parameters:

  • countryCode - the ISO country code associated with this location. The two-character ISO 3166-1 alpha code for the country.
  • countryName - the country name in English that the system associates with this location on the earth.
  • regionCode - the region (e.g. province or state) code for this location. This is a string up to three characters long containing the subdivision portion of the code.
  • regionName - the region (e.g. province in state) name in English that the system associates with this location.
  • metroCode - the metro code associated with this location. The metro code of the location if the location is in the US. See the Google AdWords API for values
  • city - the city name in English associated with this location.
  • postalCode - the postal code associated with this location.
  • latitude - the latitude coordinate associated with this location which is a number between -90.0 and +90.0.
  • longitude - the longitude coordinate associated with this location which is a number between -180.0 and +180.0.

getCity(): String

Get the city name in English associated with this location.

Returns:

  • the city that the system associates with this location on the earth.

getCountryCode(): String

Get the ISO country code associated with this location.

Returns:


getCountryName(): String

Get the country name in English that the system associates with this location on the earth.

Returns:

  • the country name that the system associates with this location on the earth.

getLatitude(): Number

Get the latitude coordinate associated with this location which is a number between -90.0 and +90.0.

Returns:

  • The latitude of the location as a floating point number.

getLongitude(): Number

Get the longitude coordinate associated with this location which is a number between -180.0 and +180.0.

Returns:

  • The longitude of the location as a floating point number.

getMetroCode(): String

Get the metro code associated with this location.

Returns:

  • The metro code of the location if the location is in the US. See the Google AdWords API for returned values.

getPostalCode(): String

Get the postal code associated with this location.

Returns:

  • The postal code of the location. Postal codes are not available for all countries. In some countries, this will only contain part of the postal code.

getRegionCode(): String

Get the region (e.g. province or state) code for this location.

Returns:

  • This is a string up to three characters long containing the subdivision portion of the code.

getRegionName(): String

Get the region (e.g. province in state) name in English that the system associates with this location.

Returns:

  • the region name that the system associates with this location on the earth.

isAvailable(): Boolean

Returns 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise.

Returns:

  • 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise.