MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Find 3 closest matches

This is a discussion on Find 3 closest matches within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I have to make a website where user can look for the stores closest to their address. So I have ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-09-2005
Junior Member
White Belt
 
Join Date: Feb 2005
Posts: 8
Find 3 closest matches

I have to make a website where user can look for the stores closest to their address.

So I have a database with all the store addresses and I need to find the 3 closest matches to the clients home address. What would be the best approach?

I was thinking :
- get all latitude and longitude coordinates of the stores and store them locally in a database.
- get the latitude and longitude coordinates of the home address of the client
- find the 3 nearest matches in the database.

Am I thinking in the right way?

Thanks for replying!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 02-09-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

Yes. I assume you mean the most close in a strait line. And to avoid to much calculations (dont know how many stores there are) you kan seek in the database the store with the most close longitude, then also the record with the most close latitude. Then 1 of these 2 is really the most close. So for each of the 3 you have to do 2 database seek and 2 calculations. If you index on lat and an index on long this can go pretty fast.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 02-09-2005
Junior Member
White Belt
 
Join Date: Feb 2005
Posts: 8
Quote:
Originally Posted by Wilfried

Yes. I assume you mean the most close in a strait line. And to avoid to much calculations (dont know how many stores there are) you kan seek in the database the store with the most close longitude, then also the record with the most close latitude. Then 1 of these 2 is really the most close. So for each of the 3 you have to do 2 database seek and 2 calculations. If you index on lat and an index on long this can go pretty fast.
Hey, thanks for the reply.
Yes in straight line would do. If I have found those 3 most close stores. How would I get a map from MapPoint on which all 3 stores are located? Is there any function to get like a rectangle from MapPoint? So I could set the boundaries of the rectangle to the two farest stores relative from the users home place. I have been going through the documentation but I couldn't find something like this? How is this done?

Thanks again!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 02-09-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

Yes, like this:

Code:
MP.ActiveMap.DataSets.ZoomTo();
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 02-09-2005
Junior Member
White Belt
 
Join Date: Feb 2005
Posts: 8
Quote:
Originally Posted by Wilfried
Yes, like this:

Code:
MP.ActiveMap.DataSets.ZoomTo();
Very nice, thx. I can start developing my application now, I think Thanks for enlightening me!

Btw. Groeten vanuit Gent!

Thanks again!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 02-09-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

Quote:
Btw. Groeten vanuit Gent!
Almost neighbours and talking to each other on a server somewhere in US Happy coding !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
closest, find, matches


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Find closest between two sets of addresses? mksql MapPoint 2006/2009 Discussion 2 08-22-2005 12:49 PM
Finding closest 10 locations Anonymous MapPoint 2006/2009 Discussion 1 11-19-2003 05:59 AM


All times are GMT -5. The time now is 12:59 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55