dw.util
Class Geolocation
dw.util.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.
Properties
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.
Constructor Summary
Method Summary
getCountryCode()
:
String
Get the ISO country code associated with this location.
getCountryName()
:
String
Get the country name in English 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.
getLongitude()
:
Number
Get the longitude coordinate associated with this location which is a number between -180.0 and +180.0.
getMetroCode()
:
String
Get the metro code associated with this location.
getPostalCode()
:
String
Get the postal code associated with this location.
getRegionCode()
:
String
Get the region (e.g.
getRegionName()
:
String
Get the region (e.g.
isAvailable()
:
boolean
Returns 'true' if a valid GeoLocation was found for the IP address (meaning at least Latitude and Longitude were found), false otherwise.
Methods inherited from class
Object
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
Constructor Detail
Geolocation
public 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.
Method Detail
getCity
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
getCountryCode()
:
String
Get the ISO country code associated with this location.
Returns:
The two-character ISO 3166-1 alpha code for the country.
getCountryName
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
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
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
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
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
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
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
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.