Skip to main content



No record found.

Microsoft Dynamics CRM forum
Suggested answer

Find nearby addresses using Lat & Long

Posted on by 1,720


I have a custom entity 'Property' that stores the address details along with Latitude and Longitude. I want to be able to perform a search on this entity and find all properties within a certain radius (say 5km) of a given address. Does anyone know how this can be achieved?


  • Suggested answer
    Inogic Profile Picture
    Inogic 23,963 on at
    Find nearby addresses using Lat & Long
    Hi there,

    As a quick hack, you can explore Radius/ Proximity Search by Maplytics within Dynamics 365. The app integrates Maps with Dynamics 365 and allows users to visualize CRM records on the map.

    Using the Radius Search feature, you can select one of your ‘property’ entities as the current location, specify a radius for search, say 5 km, and visualize all the properties within that travel distance.

    This is so quick that the results are plotted even before you would blink. For more details and to explore other features of Maplytics, check out the website or connect with the team at
  • Suggested answer
    BadrinathB Profile Picture
    BadrinathB 970 on at
    RE: Find nearby addresses using Lat & Long

    Hi Mir,

    Below could be some of the options for you to achieve this

    1. Use Bing or google maps and ingrate your CRM. Not sure how much you can full fill your businees requirements with this.

    2. Use 3 rd party tools like nutshell to achieve this

    3. Custom code either JS or Plugin to find and associate the properties based on their long and lat

    Algorithams to achieve this are well explained in the below article

    function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {

     var R = 6371; // Radius of the earth in km

     var dLat = deg2rad(lat2-lat1);  // deg2rad below

     var dLon = deg2rad(lon2-lon1);

     var a =

       Math.sin(dLat/2) * Math.sin(dLat/2) +

       Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *

       Math.sin(dLon/2) * Math.sin(dLon/2)


     var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));

     var d = R * c; // Distance in km

     return d;


    function deg2rad(deg) {

     return deg * (Math.PI/180)


Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,989 Super User

Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans