How to check if coordinates are inside bounds object in PHP?
P粉101708623
P粉101708623 2024-04-05 00:25:54
0
1
1562

I have some coordinates and I want to check if these coordinates are exactly within the Google Maps range (Northeast and South West).

Example:

Available Lat: 40.712776
Available Long: -74.005974

I want to know if the coordinates above are within the bounds below:

> bounds_north_east[lat]    28.63713261089665
> bounds_north_east[lng]    77.22579752272338
> bounds_south_west[lat]    28.619767323553265
> bounds_south_west[lng]    77.18275343245239

I want to achieve this using only PHP script.

P粉101708623
P粉101708623

reply all(1)
P粉190883225

This helps me. It returns true or false.

function inBounds($pointLat, $pointLong, $boundsNElat, $boundsNElong, $boundsSWlat, $boundsSWlong) {
    $eastBound = $pointLong  $boundsSWlong;

    if ($boundsNElong  $boundsSWlat && $pointLat 
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template