title: Determining if a lat-long circle and a circle on a sphere overlap
body: <p>I am creating an application with Geo Proximity Search capability using PHP as server scripting language and MySQL as Databse.</p>
  
  <p>Consider a situation:</p>
  
  <p>Where we have certain set of objects having latitude and longitude positions assosciated with respective objects. On specifying location details like country and/or city along with range/radius in KM we are getting objects that are lying withing that radius/range using MySQL query for example:</p>
  
  <pre><code>SELECT [columns] 
  FROM [column] 
  WHERE 1=1 
  AND 3963.191 * 
      ACOS(
      (SIN(PI() * [latitude] / 180) * SIN(PI() * [column].latitude / 180)) + 
      (COS(PI() * [latitude] /180) * cos(PI() * [column].latitude / 180) * COS(PI() * [column].longitude / 180 - PI() * [longitude] / 180)) ) 
      &lt;= 10
  </code></pre>
  
  <p>Above calculations will give the objects that are within the 10 KM area from the country/city center point on earth.</p>
  
  <p>Now suppose i have one object (with latitude and longitude) which is not in this 10 KM area, but for example 15 KM from the country/city center point on earth. This object has service range 10 KM (giving service upto 10 KM area). </p>
  
  <p>Now the question is if i am looking for the objects within the 10 KM range from country/city center point then the object (15 KM apart from country/city center point) having service range 10 KM should also be included in search.</p>
  
  <p>How can i make it possible? I have country/city center lat, long coordinates,range/radius(in which we have to find out objects) and object having delivery radius (for e.g.10 KM) and its corresponding coordinates.</p>
  
  <p>Can you guide me how to do that using PHP, MySQL?</p>