class LatLonAltParser {

    public static LatLonAlt parseLatLon(String input)
    {
        if (input == null)
        {
            return null;
        }
        String str = input.trim().toUpperCase();
        if (LOGGER.isDebugEnabled())
        {
            LOGGER.debug("Lat/Lon string to parse = " + input);
        }

        for (Coords c : latLonOptions)
        {
            Matcher matcher = c.getPattern().matcher(str);
            if (matcher.matches())
            {
                // lat is first, lon second
                double lat = parse(c.getLat(), matcher);
                double lon = parse(c.getLon(), matcher);
                if (Double.isNaN(lat) || Double.isNaN(lon))
                {
                    return null;
                }

                // If our latitude is greater than 90, we know
                // that the latitude and longitude need to be switched
                if (Math.abs(lat) > 90)
                {
                    return LatLonAlt.createFromDegrees(lon, lat);
                }
                return LatLonAlt.createFromDegrees(lat, lon);
            }
        }
        return null;
    }

    private  LatLonAltParser();

}