Home > CRM Development, CRM Integrations > Proximity Search in MapPoint – Drawing Microsoft Dynamics CRM data on Maps

Proximity Search in MapPoint – Drawing Microsoft Dynamics CRM data on Maps

Proximity Search allows you to find businesses located around a reference point you provide. For example, hotels or restaurants can provide the nearest location of all automatic teller machines (ATMs). Or a manufacturing company can list all gas stations within a short drive from a supply center. Or a retail outlet can allow website visitors to search for stores that are open early or stores that handle return items. Or you can locate your potential customers nearby an existing customer.

Proximity Searches can be utilized in MSCRM to get maximum benefit of customer data. For example, you can draw your potential customers nearby an existing customer so that you can analyze and refer your potential leads and opportunities to existing customer to get maximum business benefits. In below section, I will demonstrate the idea by showing code snippets and pictures.

The FindServiceSoap.FindNearby method is a powerful feature of the MapPoint Web Service SOAP API. Using the FindNearby method, you can add the power of proximity searching to your Web site or solution. You can perform proximity searches on regularly-updated commercial data, such as Yellow Pages listings, which are included with a MapPoint Web Service subscription. Additionally, you can upload custom data and use FindNearby in custom store-locator and brand-finder applications.
For further information on how to use this method, please refer MSDN article at http://msdn2.microsoft.com/en-us/library/ms980179.aspx.

Here are the possible steps to follow in order to draw the above example.


Following code snippets will help you in understanding different steps involved in calling FindNearBy method.

Get Longitude and Latitude for Existing Customer using Find Service

//Find Address Longitude and latitude
FindServiceSoap FindService = new FindServiceSoap ();
FindService.Credentials = new NetworkCredential(“”, “”);
FindService.PreAuthenticate = true; FindAddressSpecification spec = new FindAddressSpecification();
spec.InputAddress = new Address();
spec.InputAddress.AddressLine = mAddress.Line1;
spec.InputAddress.CountryRegion = mAddress.Country;
spec.InputAddress.Subdivision = mAddress.StateProvince;
spec.InputAddress.PrimaryCity = mAddress.City;
spec.InputAddress.PostalCode = mAddress.Postalcode; 
spec.DataSourceName = “MapPoint.NA”;
FindResults results = FindService.FindAddress(spec);

Specifying Search Distance and Longitude and Latitude of Origin point and custom Database from where to search for nearby points

FindNearbySpecification myFindSpec = new FindNearbySpecification();//Specify the data source.
myFindSpec.DataSourceName = “Mappoint.InstallerAccounts”; 
//Specify the latitude and longitude.
myLatLong.Latitude = 47.63873;
myLatLong.Longitude = -122.131;
myFindSpec.LatLong = myLatLong; 
//Specify the distance.
myFindSpec.Distance = 10;

Limit the number of records returned by specifying the Range property

//Set the Range property.
myRange.StartIndex = 0;
myRange.Count = 10;
myFindOptions.Range = myRange; 
myFindSpec.Options = myFindOptions;

Return only the Properties you are interested in otherwise it will return all the properties from your custom database uploaded in MapPoint

//Return only the properties that we’re interested in.
myPropertyNames[0] = “Name”;
myPropertyNames[1] = “AddressLine”;
myPropertyNames[2] = “PrimaryCity”;
myPropertyNames[3] = “RelationshipType”;
myPropertyNames[4] = “longitude/latitude”; 
myFindFilter.PropertyNames = myPropertyNames; 
myFindSpec.Filter = myFindFilter;

Specify Filter Expressions to return desired data depending on the entity properties

//Specify the text of the Expression.
string myText = “(RlationshipType = {0}  AND ” +“Rating >  {1} “;
myFilterExpression.Text = myText; 
//Set the paramater values to match the placeholders
//in the Text
object[] myParameters = new object[2];
string myFirstParameter = “Installers”;
myParameters[0] = myFirstParameter;
int mySecondParameter = 25;
myParameters[1] = mySecondParameter;
myFilterExpression.Parameters = myParameters;
myFindFilter.Expression = myFilterExpression;
myFindSpec.Filter = myFindFilter;
 Perform Proximity Search using FindNearby Method
myFindResults = myFindService.FindNearby(myFindSpec);

Find result contains potential customers who reside nearby the existing customer. This also specifies their longitude and latitude data. Now you can simple follow my previous post regarding MSCRM integration with MapPoint to draw these potential customers and existing customer to Map.

Possible MapPoint Integrations with Microsoft Dynamics CRM1.       Store locators
2.       Branch Finders
3.       Drawing Customers to analyze Customers
4.       Lead/Opportunity Analysis per Region
5.       Driving Directions
6.       Order Tracking/shipment Tracking
7.       Finding Points of Interests in a specific route  

  1. April 4, 2008 at 3:41 pm

    shaking my mind.

    This resolve my problem

    Allah bless you


  2. June 10, 2008 at 9:53 am

    Other addons and MSCRM features like Address validators, auto-populate addresses in CRM. Post code validator, auto-populate post code can be developed using the same MapPoint API’s. I will write a post on post code and address validator sometime.

  3. November 16, 2008 at 9:44 pm

    Excellent post…

    I’ve used Yahoo! AJAX map to put CRM Accounts on a map.


  4. September 10, 2009 at 11:07 pm

    Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.

  5. October 19, 2009 at 5:28 am

    Thanks Sandrar. Are you interested in CRM stuff? What kind of CRM articles you are looking into so that i can redirect my efforts in those areas.

  6. April 4, 2010 at 12:52 am

    Do you have any last wishes?

  7. November 29, 2011 at 7:14 pm

    Valuable information. Fortunate me I found your web site unintentionally, and I am stunned why this coincidence didn’t took place earlier! I bookmarked it.

  8. December 9, 2011 at 4:29 pm

    I used to be suggested this blog through my cousin. I’m no longer positive whether this submit is written through him as nobody else recognize such precise approximately my difficulty. You are amazing! Thanks!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: