Newer Version Available

This content describes an older version of this product. View Latest

Retrieve the Geographical Data of Country-Specific Shapes

The GetBoundaryGeoJSON() Apex method returns the geographical data, area, and perimeter for a list of geographical IDs.

Signature

Where,
  • maps is the namespace that's available after you install Salesforce Maps.
  • API is the class that contains the global methods exposed to developers.
  • GetBoundaryGeoJSON() is the method.

Sample Code

This code takes two geographical IDs and returns their total and individual geometric data, area, and perimeter.

If you invoke methods within a flow, process builder, or trigger, avoid uncommitted work errors when you perform one of the following.

  • Call the methods through a future method
  • Call the methods as queueable

Different processes refresh the token, such as plotting a route or schedule. The refresh process is almost immediate after each qualifying action occurs.

Warning

Input Format of the Parameters

  • A list of geographical IDs with the format {countrycode}-{level}-{id}.
  • A Boolean that determines whether the returned information of the shape is merged (true) or separated (false).

Example

Sample Response

Although the return value is an Apex Map<String, Object> object, this JSON response illustrates the essential data you receive in the resulting map.