3 ms·
I can give you a teeny tiny head start. Here is the logic for determining the distance (in miles) between two points. sqrt((power(69.1 * (latitude1 - latit
by icey 18y ago
I can give you a teeny tiny head start. Here is the logic for determining the distance (in miles) between two points.
sqrt((power(69.1 * (latitude1 - latitude2),2) + power(69.1 * (longitude1 - longitude2) * cos(latitude1 / 57.3), 2)))
This is coming from SQL server... it took a little fidgeting to get the actual distances right because of the weird curvature of the earth issue; but it should get you close for reasonable distances.
The Yahoo! geocoding API is pretty nice for getting lats and longs for addresses in the US:
http://developer.yahoo.com/maps/rest/V1/geocode.html http://developer.yahoo.com/maps/rest/V1/geocode.html
- shafqat 18y agoWow, cool. This is the kind of stuff I'm looking for. Tips and tricks to help me start coding and experiment. Thanks!
- icky 18y ago> it took a little fidgeting to get the actual distances right because of the weird curvature of the earth issue; but it should get you close for reasonable distances. Probably can't tell you how we solve it at work, but the very much publicly-available book Computational Geometry: Algorithms and Applications, Third Edition by de Berg, Cheong, et al., mentions something about the robustness of geometric algorithms using inexact (floating point) vs. exact arithmetic. :-)
- icey 18y agoI can never tell the appropriate way to say thank you to a poster here. Should I upvote? Should I leave a comment? In this case, I'll do both. Thanks for the recommendation, most of the maths work I do these days is financial, so geometry is a nice diversion. I hadn't seen this text before so I've got it bookmarked for some reading now. As an aside, is this something I would have gotten some exposure to if I'd been a college grad? Any time I see things like this, I worry there are large swaths of text I've missed in self-study.
- icky 18y ago> As an aside, is this something I would have gotten some exposure to if I'd been a college grad? You might have had some exposure to the subject, but probably as part of other problems, i.e. not under the name Computational Geometry. For me, the most valuable thing was learning that this was an actual field with a name, which gave me a starting point for self-study. Also check out Computational Geometry in C, Second Ed., by O'Rourke. It goes into more low-level implementation details (the first book I mentioned is a good high-level introduction to reasoning about geometric algorithms, so you should read that first).