src/Factory/CoordinateFactory.php
private static function parseDecimalMinutesWithoutCardinalLetters(string $string, Ellipsoid $ellipsoid = null)
    {
        // Decimal minutes without cardinal letters, e. g. "52 12.345, 13 23.456",
        // "52° 12.345, 13° 23.456", "52° 12.345′, 13° 23.456′", "52 12.345 N, 13 23.456 E",
        // "N52° 12.345′ E13° 23.456′"
        $regexp = '/(-?\d{1,2})°?\s+(\d{1,2}\.?\d*)[\'′]?[, ]\s*(-?\d{1,3})°?\s+(\d{1,2}\.?\d*)[\'′]?/u';

        if (preg_match($regexp, $string, $match) === 1) {
            $latitude  = (int)$match[1] >= 0
                ? (int)$match[1] + (float)$match[2] / 60
                : (int)$match[1] - (float)$match[2] / 60;
            $longitude = (int)$match[3] >= 0
                ? (int)$match[3] + (float)$match[4] / 60
                : (int)$match[3] - (float)$match[4] / 60;

            return new Coordinate((float)$latitude, (float)$longitude, $ellipsoid);
        }

        return null;
    }
private static function parseDecimalMinutesWithoutCardinalLetters(string $string, Ellipsoid $ellipsoid = null)
    {
        // Decimal minutes without cardinal letters, e. g. "52 12.345, 13 23.456",
        // "52° 12.345, 13° 23.456", "52° 12.345′, 13° 23.456′", "52 12.345 N, 13 23.456 E",
        // "N52° 12.345′ E13° 23.456′"
        $regexp = '/(-?\d{1,2})°?\s+(\d{1,2}\.?\d*)[\'′]?[, ]\s*(-?\d{1,3})°?\s+(\d{1,2}\.?\d*)[\'′]?/u';

        if (preg_match($regexp, $string, $match) === 1) {
            $latitude  = (int)$match[1] >= 0
                ? (int)$match[1] + (float)$match[2] / 60
                : (int)$match[1] - (float)$match[2] / 60;
            $longitude = (int)$match[3] >= 0
                ? (int)$match[3] + (float)$match[4] / 60
                : (int)$match[3] - (float)$match[4] / 60;

            return new Coordinate((float)$latitude, (float)$longitude, $ellipsoid);
        }

        return null;
    }
private static function parseDecimalMinutesWithoutCardinalLetters ( string $ string , Ellipsoid $ ellipsoid = null ) { // Decimal minutes without cardinal letters, e. g. "52 12.345, 13 23.456", // "52° 12.345, 13° 23.456", "52° 12.345′, 13° 23.456′", "52 12.345 N, 13 23.456 E", // "N52° 12.345′ E13° 23.456′" $ regexp = '/(-?\d{1,2})°?\s+(\d{1,2}\.?\d*)[\'′]?[, ]\s*(-?\d{1,3})°?\s+(\d{1,2}\.?\d*)[\'′]?/u'; if ( preg_match ( $ regexp , $ string , $ match ) === 1 ) { $ latitude = ( int ) $ match [ 1 ] >= 0 ? ( int ) $ match [ 1 ] + ( float ) $ match [ 2 ] / 60 : ( int ) $ match [ 1 ] - ( float ) $ match [ 2 ] / 60 ; $ longitude = ( int ) $ match [ 3 ] >= 0 ? ( int ) $ match [ 3 ] + ( float ) $ match [ 4 ] / 60 : ( int ) $ match [ 3 ] - ( float ) $ match [ 4 ] / 60 ; return new Coordinate ( ( float ) $ latitude , ( float ) $ longitude , $ ellipsoid ) ; } return null ; }
@param string $string
@param Ellipsoid $ellipsoid

@return Coordinate|null
@throws InvalidArgumentException
@param string $string @param Ellipsoid $ellipsoid