File: app/helpers.php

Recommend this page to a friend!
  Classes of Edward Paul  >  Find PHP Service  >  app/helpers.php  >  Download  
File: app/helpers.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Find PHP Service
Application to find services in a near location
Author: By
Last change:
Date: 3 months ago
Size: 511 bytes
 

Contents

Class file image Download
<?php

function calcCoordinates($longitude, $latitude, $radius = 20)
{
   
$lng_min = $longitude - $radius / abs(cos(deg2rad($latitude)) * 69);
   
$lng_max = $longitude + $radius / abs(cos(deg2rad($latitude)) * 69);
   
$lat_min = $latitude - ($radius / 69);
   
$lat_max = $latitude + ($radius / 69);

    return [
       
'min' => [
           
'lat' => $lat_min,
           
'lng' => $lng_min,
        ],
       
'max' => [
           
'lat' => $lat_max,
           
'lng' => $lng_max,
        ],
    ];
}



For more information send a message to info at phpclasses dot org.