php - GreatCircle and mysql query -



php - GreatCircle and mysql query -

i have table lon/lat coordinates need users mysql table in distance given coordinates (it can circle or square)

i utilize greatcircle class (great circle distance question) north east west soth coordinates in distance starting point:

$distance = 300; $greatcircle = new greatcircle(); // north $new_coordinates = $greatcircle->getpositionbydistance($distance, 0, $lon, $lat); $n_lon = $new_coordinates['lon']; //$n_lat = $new_coordinates['lat']; // east $new_coordinates = $greatcircle->getpositionbydistance($distance, 90, $lon, $lat); //$e_lon = $new_coordinates['lon']; $e_lat = $new_coordinates['lat']; // south $new_coordinates = $greatcircle->getpositionbydistance($distance, 180, $lon, $lat); $s_lon = $new_coordinates['lon']; //$s_lat = $new_coordinates['lat']; // west $new_coordinates = $greatcircle->getpositionbydistance($distance, 270, $lon, $lat); //$w_lon = $new_coordinates['lon']; $w_lat = $new_coordinates['lat'];

now, can create sql other coordinates table 300 meters around?

$greatcircle = "l.longitude <= $e_lon , l.latitude <= $n_lat , l.longitude >= $w_lon , l.latitude >= $s_lat";

that work if dont mind square. (although maintain in mind lat/long values negative...)

ususally, pass 2 sets of lat/long pairs function, , distance result. check if distance within limit. (that circle version)

php mysql gps latitude-longitude

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -