Sorry if this is in the wrong forum, but I think it applies best here and it doesn't have any calc in it.
I'm doing some coding for a social site. I have already uploaded a list of all US zip codes and all combinations of the first 3 letters of CA postal codes, and their associated Lat/Lon coordinates (in radians).
Then I found this website: Geographic Distance and Azimuth Calculations - CodeGuru
It describes in great detail how to find the distance between two Lat/Lon coordinates using a 'great sphere' model and a more accurate 'ellipsoid' model.
I'm sure this works great but as it stands I will need to run every combination of postal/zip code to check which are 'close' to the user that is checking. I'd first like to eliminate some codes.
To do this I thought I would do something like this:
Imagine: A male user, who has a postal/zip code that places him at lat 30, long 80. He considers other users to be close to him as long as they live within 50km of him.
He selects to list all users close to him. My program draws a 50km wide square centered on lat 30, long 80. Then (through a very simple query) selects all zip/postal codes within this square. Then it calculates the distance between lat 30, long 80 and each of the selected zip/postal codes, and eliminates any that are more then 50 km. Then (through another very simple query) displays all users who have chosen to be searchable via this method and have provided a zip/postal code.
My problem is now I need another formula. One that takes latitude/longitude (preferably in radians), and a distance(km or miles).
This formula then should give me 4 points(lat/lon pairs in radians): 1) 'distance' km/miles due N of the coordinates given, 2) 'distance' km/miles due E of the coordinates given, 3) 'distance' km/miles due S of the coordinates given, and 4) 'distance' km/miles due W of the coordinates given.
All coordinates must be calculated according to the ellipsoid model.
I thought I'd combine the entire algorithm from the above website, into a single line formula and then maybe I can do some kind of simplification and solve for what I want however, I am finding it VERY difficult to isolate lat1/lon1 or lat2/lon2 on to one side.
When I try to write the latex for this it gives me a ['LaTeX' ERROR: Image too big 3245x22, max 1200x1500].
That's not even the full equation I didn't expand H1 and H2 (see the website mentioned and skip down to the 'Code for Approximate Ellipsoid Distance Calculation') which would just about double the size of the formula. Am I going about this all wrong? How should I approach this?
I would appreciate any help!