PDA

View Full Version : Nearest Location



emrahaydin
08-25-2011, 05:49 AM
Hi...

I have a problem :(

(Bing Maps Silverlight Control)

For example:

I'm here on the Map : Location(30.13580,38.99398 )

Arround me on the Map :

Location1(35.40923,39.43660)
Location2(38.79302,37.78849)
Location3(29.03716,40.19606)

I want to find to nearest Location me..
Which Location is nearest me?
How can I do using VB.Net?

Eric Frost
08-25-2011, 09:16 AM
This code is from Excel VBA, but it should be trivial to convert to VB.NET

dist = Sqr(((PtACoordX - PtBCoordX) * (PtACoordX - PtBCoordX)) + ((PtACoordY - PtBCoordY) * (PtACoordY - PtBCoordY)))

This isn't really accurate especially for long distances, but might be sufficient for your purposes!

Eric