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

5 Mile radius

This is a discussion on 5 Mile radius within the Development forums, part of the MapPoint Desktop Discussion category; Hello I am working on map2009 mappoint sdk.... I have requirement where the user enters the address and i need ...

  1. #1
    genny is offline Junior Member White Belt
    Join Date
    Feb 2009
    Posts
    2

    5 Mile radius

    Hello

    I am working on map2009 mappoint sdk.... I have requirement where the user enters the address and i need to get the stores which are in 5 miles radius. The store information will be in excel and i need to have pushpins within the 5 mile radius.

    Please help me on this....i am not able to achieve....

    Thanks
    Genny

  2. #2
    app_2_win is offline Member Yellow Belt
    Join Date
    Oct 2008
    Location
    Central Oregon
    Posts
    34

    Re: 5 Mile radius

    If your excel has lat/lon info, you can get the lat/lon of the "found" address and then compute the displacement to each of your excel rows to filter LT 5 miles. I found the distance calculation in MP to be very slow, but found a fairly simple/usable one with an internet search, see below. The language I use is not by MS but it's pretty straight forward.

    Function calcDistance number lat1 number lon1 number lat2 number lon2 Returns number
    //returns miles
    number nX
    number nY
    number rval
    move (69.1 * (lat2 - lat1)) to nX
    move (53.0 * (lon2 - lon1)) to nY
    move (sqrt((nX * nX) + (nY * nY))) to rval
    Function_Return rval
    End_Function
    Larry

  3. #3
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: 5 Mile radius

    Do NOT use that formula! It does a Pythagoras approximation (not very accurate but probably "good enough" for this application) but more seriously it is hard-coded for a very specific latitude!!!

    Instead use the trig formula found at the Aviation Formulary:

    Aviation Formulary V1.44


    However I would agree that if you have the coordinates for the stores already, then calculating the straight-line distances by in your code (albeit with trigonometry!) will be a lot faster than using MapPoint. This is because of the overhead of MapPoint's COM interface.

    If the stores are in MapPoint, then this might be more difficult to determine. It is easier to code if you use MapPoint's distance calculations, but may be faster if you cache the coordinates in your own code and do your own calculation.

    If you want route driving distances, then use MapPoint all the way.

    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  4. #4
    app_2_win is offline Member Yellow Belt
    Join Date
    Oct 2008
    Location
    Central Oregon
    Posts
    34

    Re: 5 Mile radius

    Wouldn't probably "good enough" probably be good enough? At least it's worth testing simple first... maybe compare with what MP comes up with and see if something more accurate is required.

    Larry
    Larry

  5. #5
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: 5 Mile radius

    The big problem is the latitude hard-coding - this will not work for most places on the Earth. It was probably hard-coded for a specific city.

    The "Good Enough" simply referred to the use of Pythagoras. This is only do-able if you don't want a result that is particularly accurate, the distances are very short (5 miles seems fine to me), not at high latitudes, and you have the correct latitude correction.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  6. #6
    genny is offline Junior Member White Belt
    Join Date
    Feb 2009
    Posts
    2

    Re: 5 Mile radius

    Thanks for the suggestions... I have the lat/long codes in the excel and probably i will try to use Pythagaros and will let you know.
    If you have an example , please post here

    Thanks
    Genny

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. can I get demographic data at 1, 3, and 5 mile radius?
    By rmchugh in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 05-22-2009, 11:21 AM
  2. 1 mile radius around all pushpins?
    By stevewilson in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-17-2004, 12:40 PM
  3. Get all zip codes on 50 mile radius
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-16-2004, 12:35 PM
  4. 50 Mile Radius of Airport
    By slyne in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-02-2003, 11:06 PM
  5. Possible to Locate all Hospitals in 1 mile radius?
    By ChrisC in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-08-2003, 05:09 PM

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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127