A new release of Geopointe will be out next week after all systems are on the Summer 11 release. With the update will come the ability to perform spatial/proximity/radial searches via Apex. Two new Apex methods are available for this:
These Apex methods enable Geopointe customers to utilize the proximity searching of Geopointe into advanced Apex logic. For information on all methods available to you, visit the Apex API page in the Help Center.
Let’s run an example. The image below displays a query (via the Geopointe UI) of our Geopointe customers within 15 miles of Wrigley Field in Chicago. We want to accomplish this same query in Apex without ever needing the UI. Now we can and the geopointe.API class will help us with this.
This method allows you to perform a radial search against a Map Object (a Salesforce object enabled for mapping) and also allows the passing in of a custom filter. Here we are saying to search around the record with id a1430000001E32gAAC and to search the Account object with a filter of Type = ‘Customer’ for records within 15 miles.
geopointe.API.radialSearchResult result = geopointe.API.radialSearchMapObject( 'a1430000001E32gAAC', 'account', 'type=\'Customer\'', 15, geopointe.API.units.MILES); system.debug(result);
The method below is accomplishing the same thing, but is using a pre-defined dataset that already has the filter for Customers built into it.
geopointe.API.radialSearchResult result = geopointe.API.radialSearchDataSet( 'a1430000001E32gAAC', '12826856169860.9678661172894504', 15, geopointe.API.units.MILES); system.debug(result);
The radialSearchResult Class
Both methods result in a geopointe.API.radialSearchResult object, which is defined in the Geopointe Help Center. This object will return the record Ids closest to the center as well as the distances to these locations.