From 8facb09a44e729d08020e826dfe498400b576dc5 Mon Sep 17 00:00:00 2001 From: Jonathan Stanley Date: Tue, 11 Mar 2014 12:16:32 -0600 Subject: [PATCH] distance to degrees --- GooglePlaces.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/GooglePlaces.php b/GooglePlaces.php index 3eebf3d..26069fa 100644 --- a/GooglePlaces.php +++ b/GooglePlaces.php @@ -252,6 +252,21 @@ class GooglePlaces return $this->response; } + + /** + * Returns the longitude equal to a given distance (kilometers) at a given latitude + */ + public function km2lng($km,$latitude){ + return $km/(cos(deg2rad($latitude))*40075.16/360); + } + + /** + * Returns the latitude equal to a given distance (kilometers) + */ + public function km2lat($km){ + return $km/(40075.16/360); + } + } ?>