You need to sign in to do that
Don't have an account?
Pavani Akella 9
How to write a query to show 0.25 miles distance for geolocation
HI,
I wrote a query to calculate the distance for geolocation and show in the map if the distance is less than 0.25 miles. But for some reason the query is calculating more than 1/4th mile distance. Can you please look into the query and let me know the mistake I made.
for (Vehicle_Daily_Checkin__e event : Trigger.New) {
List<Account> acc=Database.query(
'SELECT Id, Name, Location__c, BillingLatitude, BillingLongitude FROM Account '+
'WHERE (public_service_center__c != \'N/A\' OR public_service_center__c != \'No\')'+
'AND DISTANCE(BillingAddress, GEOLOCATION(' +event.Latitude__c + ', ' +event.Longitude__c + '), \'mi\') < 0.25') ;
Thanks in advance
I wrote a query to calculate the distance for geolocation and show in the map if the distance is less than 0.25 miles. But for some reason the query is calculating more than 1/4th mile distance. Can you please look into the query and let me know the mistake I made.
for (Vehicle_Daily_Checkin__e event : Trigger.New) {
List<Account> acc=Database.query(
'SELECT Id, Name, Location__c, BillingLatitude, BillingLongitude FROM Account '+
'WHERE (public_service_center__c != \'N/A\' OR public_service_center__c != \'No\')'+
'AND DISTANCE(BillingAddress, GEOLOCATION(' +event.Latitude__c + ', ' +event.Longitude__c + '), \'mi\') < 0.25') ;
Thanks in advance