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

## 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. 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. 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

3. ## 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

4. 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

5. ## 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

6. 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)

#### Posting Permissions

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