Newer Version Available
Retrieve the Geographical Data of Polygons
The getPolygonGeometry() Apex
method returns the geometric data, such as the area and perimeter, for the requested
geographical shape or custom polygon.
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.
- getPolygonGeometry() is the method.
Sample Code of a Circle
This code passes a circular geographical region to the Salesforce Maps API.
Input Format of a Circle
Example
Sample Code of a Rectangle
This code passes a rectangular geographical region to the Salesforce Maps API.
Input Format of a Rectangle
Example
Sample Code of a Polygon
This code passes a polygonal geographical region to the Salesforce Maps API.
Input Format of a Polygon
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.