I have two location fields of type Geolocation named point1 and point2. I have one radius field of type Number(6,2). i need to determine whether point2 is located within radius distance from point1 or not. How can this be determined ?

1 Answer 1


There is a DISTANCE function available so this formula should work:

DISTANCE(Point1__c, Point2__c, 'km') <= RadiusInKm__c

(or use 'mi' for miles).

  • How can this be achieved in apex without using SOQL ?
    – Walker
    Nov 18, 2015 at 3:30
  • 1
    @Walker This is a formula function so can be used in several places not just SOQL. If you need to do this in Apex I think you will need to write the maths code yourself - examples and links here Calculate distance between two places on accounts from a VF page.
    – Keith C
    Nov 18, 2015 at 9:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .