If i want to divide world in four quadrants and make regions in these quadrants and wanna find the distance from my location to a point in the region I am standing, how is it possible in iPhone using objective c? Or any other solution possible
+1
A:
if you some how calculate the Latitude and Longitude of these 2 points then you can find the distance between two points using Harvesian Method.
**Haversine formula:
R = earth’s radius (mean radius = 6,371km)
Δlat = lat2− lat1
Δlong = long2− long1
a = sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2)
c = 2.atan2(√a, √(1−a))
d = R.c**
S M Kamran
2009-07-14 04:29:58
angles need to be in radians
S M Kamran
2009-07-14 04:33:20
But its a tedious search in the database of a big area. I want to divide large area in small regions so search is optimal
2009-07-14 04:49:32
Hab, is that the reason your'e dividing it into four quadrants? What if the other point is outside of your current quadrant?
Jon Limjap
2009-07-14 04:53:36
Suppose i am on the edge of one region, will implement a condition for this purpose to search in my adjacent region till say within 10 miles
2009-07-14 05:18:13
You can find the Latitude and Longitude points for intersections points of imaginary axis this way you can divide the sphere in four quadrants...
S M Kamran
2009-07-14 05:31:53
then also keep track of the center point for each quadrant... After that given two points you only need to calculate the radius from the center of that quadrant for two points and just add these to find the distance.
S M Kamran
2009-07-14 05:34:36
However, your calculation need to look after the direction as well since you are treating a sphere as a flat surface
S M Kamran
2009-07-14 05:35:44