public static function normalizeLat(float $lat): float
    {
        if ($lat > 360.0) {
            $lat = \fmod($lat, 360.0);
        }

        if ($lat < -360.0) {
            $lat = \fmod($lat, -360.0);
        }

        if ($lat > 180.0) {
            $lat = 180.0 - $lat;
        }

        if ($lat < -180.0) {
            $lat = -180.0 - $lat;
        }

        if ($lat > 90.0) {
            $lat = 180.0 - $lat;
        }

        if ($lat < -90.0) {
            $lat = -180.0 - $lat;
        }

        return $lat;
    }
public static function normalizeLat(float $lat): float
    {
        if ($lat > 360.0) {
            $lat = \fmod($lat, 360.0);
        }

        if ($lat < -360.0) {
            $lat = \fmod($lat, -360.0);
        }

        if ($lat > 180.0) {
            $lat = 180.0 - $lat;
        }

        if ($lat < -180.0) {
            $lat = -180.0 - $lat;
        }

        if ($lat > 90.0) {
            $lat = 180.0 - $lat;
        }

        if ($lat < -90.0) {
            $lat = -180.0 - $lat;
        }

        return $lat;
    }
public static function normalizeLat ( float $ lat ) : float { if ( $ lat > 360.0 ) { $ lat = \ fmod ( $ lat , 360.0 ) ; } if ( $ lat < - 360.0 ) { $ lat = \ fmod ( $ lat , - 360.0 ) ; } if ( $ lat > 180.0 ) { $ lat = 180.0 - $ lat ; } if ( $ lat < - 180.0 ) { $ lat = - 180.0 - $ lat ; } if ( $ lat > 90.0 ) { $ lat = 180.0 - $ lat ; } if ( $ lat < - 90.0 ) { $ lat = - 180.0 - $ lat ; } return $ lat ; }
Normalizes a latitude in degrees to the -90,90 range.
@see https://github.com/postgis/postgis/blob/153cf2b8e346182e371d0fdec7f34baaf78c4334/liblwgeom/lwgeodetic.c#L133-L155
Normalizes a latitude in degrees to the - 90 90 range .