+ Start a Discussion
Prakhar KPrakhar K 

Distance SOQL returning different results when one searches

  1. ZipCode:94117
  2. ​Geolocaition of 94117: 37.7717185,-122.4438929
 
  1. ZipCode:94568
  2. Geolocaition of 94568: 37.7202463,-121.8676464

Distance between both ZipCodes is 1.6Miles Max

We have geoLocation stored in Salesforce custom object  XYZ,
when I am querying 

when searching all places within less than 5 miles of zipcode 94117 (37.7717185,-122.4438929)
SELECT Id, FROM XYZ WHERE Distance(XYZ_Location__c, GeoLocation(37.7717185,-122.4438929), 'mi') < 5
returns 2 records

while doing vice versa:
searching places withing 5 miles near zipcode 94568 (37.7202463,-121.8676464) 
SELECT Id FROM XYZ WHERE  Distance(XYZ_Location__c, GeoLocation(37.7202463,-121.8676464), 'mi') < 5
returns no rows. [Why this query is not returning result since there is a record having zipcode 94117  and 94568 ]

Has anyone faced this type of issue?