Looking for C# libraries of "Haversign" spatial functions

K

Ken Fine

I have a database of lat/long positions. What I want to be able to do is to
be able to filter that database based on a selection by the user. In other
words the user picks point X and I want to know all the locations in my DB
that are within say, 50 feet or 500 feet of that point.

I am told there are several ways to do this. One way is to use a database
with spatial query support and write spatial queries. I'm told the other,
Old Skool way to do this is to use something called "haversign functions" --
sorry if I'm mangling the spelling -- and loop through your dataset (or
filter it in some more efficient way).

I will be using a spatially aware DB in the future. I would like to know how
to do this "manually", in programming, using the Haversign functions. I am
competent with working with C# and VS.NET. Can someone point me to a port of
these functions for C#?

Thanks,
-KF
 
K

Ken Fine

Ah, good. I was baffled why my Googling offered only a few esoteric results.
For the benefit of anyone else going down the same path, this will get you
started:

http://www.codeproject.com/KB/cs/di...px?df=100&forumid=245892&exp=0&select=1309714

This includes a SQL function you could use in a non-spatially aware DB:
http://megocode3.wordpress.com/2008/02/05/haversine-formula-in-c/

JavaScript implementation:
http://groups.google.com.jm/group/Google-Maps-API/browse_thread/thread/2ef089ac7277e828

PHP
http://www.go4expert.com/forums/showthread.php?t=339

Wikipedia:
http://en.wikipedia.org/wiki/Haversine_formula

-KF
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top