Click here to Skip to main content
15,887,214 members
Articles / General Programming / Regular Expressions

Parsing Latitude and Longitude Information

Rate me:
Please Sign up or sign in to vote.
4.73/5 (24 votes)
21 Feb 2012CPOL9 min read 93.3K   2K   74  
Parses user input and extracts latitude and longitude information, taking into account the user's language and regional settings
using System;

namespace Geospatial
{
    /// <summary>
    /// Determines the styles permitted in string arguments that are passed
    /// to the Parse/TryParse methods of Location.
    /// </summary>
    [Flags]
    public enum LocationStyles
    {
        /// <summary>
        /// Default formatting optiona are used. Indicates that the Degrees,
        /// DegreesMinutes and DegreeMinuteSeconds styles are used.
        /// </summary>
        None = 0x00,

        /// <summary>Allows parsing of degree values only.</summary>
        Degrees = 0x01,

        /// <summary>
        /// Allows parsing of values that contain both degrees and minutes.
        /// </summary>
        DegreesMinutes = 0x02,

        /// <summary>
        /// Allows parsing of values that contain degrees, minutes and seconds.
        /// </summary>
        DegreesMinutesSeconds = 0x04,

        /// <summary>
        /// Allows parsing of values formmated to ISO 6709.
        /// </summary>
        Iso = 0x08,

        /// <summary>
        /// Indicates that the Degrees, DegreesMinutes, DegreeMinuteSeconds
        /// and Iso styles are used.
        /// </summary>
        Any = Degrees | DegreesMinutes | DegreesMinutesSeconds | Iso
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions