CodeIgniter Forums
Check bound latlng in special bound - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Check bound latlng in special bound (/showthread.php?tid=75407)



Check bound latlng in special bound - omid_student - 02-03-2020

Hi
I have specified bound(west,north-east-south) that need to check latlng in this bound
My code is:
PHP Code:
function inBounds($pointLat$pointLong$boundsNElat$boundsNElong$boundsSWlat$boundsSWlong) {

        
$eastBound $pointLong $boundsNElong;
        
$westBound $pointLong $boundsSWlong;

        if (
$boundsNElong $boundsSWlong) {
            
$inLong $eastBound || $westBound;
        } else {
            
$inLong $eastBound && $westBound;
        }

        
$inLat $pointLat $boundsSWlat && $pointLat $boundsNElat;

        return (boolean)
$inLat && $inLong;

    } 

But this code can only check latlng in north and south bound and not check from west to east
Do you can help me?

I think i found it
https://stackoverflow.com/questions/5065039/find-point-in-polygon-php

Is it?