Newer Version Available
Get the Boundary Information
The GetBoundaryInformation() Apex
method returns geographical IDs of locations that fit the specified search
criteria.
Signature
1Map<String, Object> maps.API.GetBoundaryInformation(String parameters)Where,
- maps is the namespace of the Salesforce Maps package. It’s automatically available when the package is installed.
- API is the class that contains the global methods exposed to developers.
- GetBoundaryInformation() is the method.
Sample Code
This code finds the geographical IDs of states in the USA beginning with “A”.
Example
1// Create the search criteria in JSON format.
2String parameters = '{"overlay":"USA","level":"1","filters":[{"field_id":"label","operator":"starts with","values":["A"]}]}';
3
4// Call the GetBoundaryInformation() method with the search criteria.
5Map<String, Object> response= maps.API.GetBoundaryInformation(parameters);
6
7// Log the resulting Geo IDs.
8system.debug(response);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.
1{
2 "endPoint": "https://internal.na.sfmapsapi.com/boundary/search/1",
3 "limitInfo": {
4 "QueryRows": "12 / 50000",
5 "Queries": "8 / 100",
6 "HeapSize": "71096 / 6000000",
7 "CPUTime": "133 / 10000"
8 },
9 "request": "{\"overlay\":\"USA\",\"level\":\"1\",\"filters\":[{\"field_id\":\"label\",\"operator\":\"starts with\",\"values\":[\"A\"]}]}",
10 "params": {
11 "filters": [
12 {
13 "values": [
14 "A"
15 ],
16 "operator": "starts with",
17 "field_id": "label"
18 }
19 ],
20 "level": "1",
21 "overlay": "USA"
22 },
23 "success": true,
24 "data": {
25 "geoids": [
26 {
27 "label": "Alabama",
28 "value": "USA-01"
29 },
30 {
31 "label": "Alaska",
32 "value": "USA-02"
33 },
34 {
35 "label": "Arizona",
36 "value": "USA-04"
37 },
38 {
39 "label": "Arkansas",
40 "value": "USA-05"
41 }
42 ]
43 }
44}