Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 6 of 6

Find 3 closest matches

This is a discussion on Find 3 closest matches within the MapPoint Desktop 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 ...

  1. #1
    eblubber is offline 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!

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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.

  3. #3
    eblubber is offline 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!!

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

  5. #5
    eblubber is offline 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!

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Btw. Groeten vanuit Gent!
    Almost neighbours and talking to each other on a server somewhere in US Happy coding !

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find closest between two sets of addresses?
    By mksql in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 08-22-2005, 12:49 PM
  2. Finding closest 10 locations
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-19-2003, 05:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96