How to find distance in longitude and latitute when center and radius is given? for example:
Center :
longitude : 40.000000
latitude : 40.000000
radius : 1000 KiloMeter
what would be the distance in degrees?
What would be the formula, Since distance in kilometer varies with change in degrees?
UPDATE 1: Consider usecase: Suppose I want to find all resaurent around me within 1000KM. My location is 40, 40, range of all resaurents to find is 1000KM, So how many resaurents are there around me with in 1000 KM
UPDATE 2: All restaurents are located at perticular longitudes and latitudes, So to find all of them, we need to convert radius into distnace in degrees from center ie. 40, 40.
Here's a method to compute the distance (in km along the surface of the earth) between two points whose longitude and latitude (in degrees) are given.
Assuming the earth is a perfect sphere of radius $R$ km, introduce the Cartesian coordinate system with origin at the center of the earth, $x$-axis through the intersection of the equator and the prime meridian, $y$-axis through the intersection of the equator with $90$ degrees east, and the $z$-axis through the north pole. The Cartesian coordinates of the point at longitude $\theta$ and latitude $\phi$ (measured in degrees) are $$ (x, y, z) = S(\theta, \phi) = \left(R\cos\frac{\pi\theta}{180} \cos\frac{\pi\phi}{180}, R\sin\frac{\pi\theta}{180} \cos\frac{\pi\phi}{180}, R\sin\frac{\pi\phi}{180}\right). $$ (The factors of $\pi/180$ convert angles to radians; the trig functions are "in radians mode".)
If two points on the surface of the earth subtend angle $\psi$ measured at the center of the earth, then the distance between the points, measured along an arc on the surface of the earth, is $R\psi$. This distance is easily found using the dot product: Say the "current location" is at longitude $\theta_0$ and latitude $\phi_0$, and the restaurant is at longitude $\theta_1$ and latitude $\phi_1$, with angles measured in degrees. Convert each pair into Cartesian coordinates using the formula above, obtaining two triples $(x_0, y_0, z_0)$ and $(x_1, y_1, z_1)$. The distance $R\psi$ is given by $$ R\cos^{-1} \left(\frac{x_0x_1 + y_0y_1 + z_0z_1}{R^2}\right), $$ again with $\arccos$ "in radians mode".
(To implement this in code, you'll want to omit the factors of $R$ from the formula for $S(\theta, \phi)$ and omit the denominator $R^2$ inside the $\arccos$. Of course, you'll also have to iterate through your list of restaurants, calculating the distance to each from your present location.)