Skip to content

Instantly share code, notes, and snippets.

@jeremykdev
Created September 12, 2013 15:09
Show Gist options
  • Save jeremykdev/6539073 to your computer and use it in GitHub Desktop.
Save jeremykdev/6539073 to your computer and use it in GitHub Desktop.
Collection of U.S. state information
//average lat/lon based on http://dev.maxmind.com/geoip/legacy/codes/state_latlon/
public class UsStateInformation
{
public string Name { get; set; }
public string Abbreviation { get; set; }
public decimal Latitude { get; set; }
public decimal Longitude { get; set; }
public static List<UsStateInformation> GetAllStates()
{
var list = new List<UsStateInformation>();
list.Add(new UsStateInformation() { Name = "Alaska", Abbreviation = "AK", Latitude = 61.3850m, Longitude = -152.2683m });
list.Add(new UsStateInformation() { Name = "Alabama", Abbreviation = "AL", Latitude = 32.7990m, Longitude = -86.8073m });
list.Add(new UsStateInformation() { Name = "Arkansas", Abbreviation = "AR", Latitude = 34.9513m, Longitude = -92.3809m });
list.Add(new UsStateInformation() { Name = "Arizona", Abbreviation = "AZ", Latitude = 33.7712m, Longitude = -111.3877m });
list.Add(new UsStateInformation() { Name = "California", Abbreviation = "CA", Latitude = 36.1700m, Longitude = -119.7462m });
list.Add(new UsStateInformation() { Name = "Colorado", Abbreviation = "CO", Latitude = 39.0646m, Longitude = -105.3272m });
list.Add(new UsStateInformation() { Name = "Connecticut", Abbreviation = "CT", Latitude = 41.5834m, Longitude = -72.7622m });
list.Add(new UsStateInformation() { Name = "Washington DC", Abbreviation = "DC", Latitude = 38.8964m, Longitude = -77.0262m });
list.Add(new UsStateInformation() { Name = "Delaware", Abbreviation = "DE", Latitude = 39.3498m, Longitude = -75.5148m });
list.Add(new UsStateInformation() { Name = "Florida", Abbreviation = "FL", Latitude = 27.8333m, Longitude = -81.7170m });
list.Add(new UsStateInformation() { Name = "Georgia", Abbreviation = "GA", Latitude = 32.9866m, Longitude = -83.6487m });
list.Add(new UsStateInformation() { Name = "Hawaii", Abbreviation = "HI", Latitude = 21.1098m, Longitude = -157.5311m });
list.Add(new UsStateInformation() { Name = "Iowa", Abbreviation = "IA", Latitude = 42.0046m, Longitude = -93.2140m });
list.Add(new UsStateInformation() { Name = "Idaho", Abbreviation = "ID", Latitude = 44.2394m, Longitude = -114.5103m });
list.Add(new UsStateInformation() { Name = "Illinois", Abbreviation = "IL", Latitude = 40.3363m, Longitude = -89.0022m });
list.Add(new UsStateInformation() { Name = "Indiana", Abbreviation = "IN", Latitude = 39.8647m, Longitude = -86.2604m });
list.Add(new UsStateInformation() { Name = "Kansas", Abbreviation = "KS", Latitude = 38.5111m, Longitude = -96.8005m });
list.Add(new UsStateInformation() { Name = "Kentucky", Abbreviation = "KY", Latitude = 37.6690m, Longitude = -84.6514m });
list.Add(new UsStateInformation() { Name = "Louisiana", Abbreviation = "LA", Latitude = 31.1801m, Longitude = -91.8749m });
list.Add(new UsStateInformation() { Name = "Massachusetts", Abbreviation = "MA", Latitude = 42.2373m, Longitude = -71.5314m });
list.Add(new UsStateInformation() { Name = "Maryland", Abbreviation = "MD", Latitude = 39.0724m, Longitude = -76.7902m });
list.Add(new UsStateInformation() { Name = "Maine", Abbreviation = "ME", Latitude = 44.6074m, Longitude = -69.3977m });
list.Add(new UsStateInformation() { Name = "Michigan", Abbreviation = "MI", Latitude = 43.3504m, Longitude = -84.5603m });
list.Add(new UsStateInformation() { Name = "Minnesota", Abbreviation = "MN", Latitude = 45.7326m, Longitude = -93.9196m });
list.Add(new UsStateInformation() { Name = "Missouri", Abbreviation = "MO", Latitude = 38.4623m, Longitude = -92.3020m });
list.Add(new UsStateInformation() { Name = "Mississippi", Abbreviation = "MS", Latitude = 32.7673m, Longitude = -89.6812m });
list.Add(new UsStateInformation() { Name = "Montana", Abbreviation = "MT", Latitude = 46.9048m, Longitude = -110.3261m });
list.Add(new UsStateInformation() { Name = "North Carolina", Abbreviation = "NC", Latitude = 35.6411m, Longitude = -79.8431m });
list.Add(new UsStateInformation() { Name = "North Dakota", Abbreviation = "ND", Latitude = 47.5362m, Longitude = -99.7930m });
list.Add(new UsStateInformation() { Name = "Nebraska", Abbreviation = "NE", Latitude = 41.1289m, Longitude = -98.2883m });
list.Add(new UsStateInformation() { Name = "New Hampshire", Abbreviation = "NH", Latitude = 43.4108m, Longitude = -71.5653m });
list.Add(new UsStateInformation() { Name = "New Jersey", Abbreviation = "NJ", Latitude = 40.3140m, Longitude = -74.5089m });
list.Add(new UsStateInformation() { Name = "New Mexico", Abbreviation = "NM", Latitude = 34.8375m, Longitude = -106.2371m });
list.Add(new UsStateInformation() { Name = "Nevada", Abbreviation = "NV", Latitude = 38.4199m, Longitude = -117.1219m });
list.Add(new UsStateInformation() { Name = "New York", Abbreviation = "NY", Latitude = 42.1497m, Longitude = -74.9384m });
list.Add(new UsStateInformation() { Name = "Ohio", Abbreviation = "OH", Latitude = 40.3736m, Longitude = -82.7755m });
list.Add(new UsStateInformation() { Name = "Oklahoma", Abbreviation = "OK", Latitude = 35.5376m, Longitude = -96.9247m });
list.Add(new UsStateInformation() { Name = "Oregon", Abbreviation = "OR", Latitude = 44.5672m, Longitude = -122.1269m });
list.Add(new UsStateInformation() { Name = "Pennsyvania", Abbreviation = "PA", Latitude = 40.5773m, Longitude = -77.2640m });
list.Add(new UsStateInformation() { Name = "Rhode Island", Abbreviation = "RI", Latitude = 41.6772m, Longitude = -71.5101m });
list.Add(new UsStateInformation() { Name = "South Carolina", Abbreviation = "SC", Latitude = 33.8191m, Longitude = -80.9066m });
list.Add(new UsStateInformation() { Name = "South Dakota", Abbreviation = "SD", Latitude = 44.2853m, Longitude = -99.4632m });
list.Add(new UsStateInformation() { Name = "Tennessee", Abbreviation = "TN", Latitude = 35.7449m, Longitude = -86.7489m });
list.Add(new UsStateInformation() { Name = "Texas", Abbreviation = "TX", Latitude = 31.1060m, Longitude = -97.6475m });
list.Add(new UsStateInformation() { Name = "Utah", Abbreviation = "UT", Latitude = 40.1135m, Longitude = -111.8535m });
list.Add(new UsStateInformation() { Name = "Virginia", Abbreviation = "VA", Latitude = 37.7680m, Longitude = -78.2057m });
list.Add(new UsStateInformation() { Name = "Vermont", Abbreviation = "VT", Latitude = 44.0407m, Longitude = -72.7093m });
list.Add(new UsStateInformation() { Name = "Washington", Abbreviation = "WA", Latitude = 47.3917m, Longitude = -121.5708m });
list.Add(new UsStateInformation() { Name = "Wisconsin", Abbreviation = "WI", Latitude = 44.2563m, Longitude = -89.6385m });
list.Add(new UsStateInformation() { Name = "West Virginia", Abbreviation = "WV", Latitude = 38.4680m, Longitude = -80.9696m });
list.Add(new UsStateInformation() { Name = "Wyoming", Abbreviation = "WY", Latitude = 42.7475m, Longitude = -107.2085m });
return list;
}
public static UsStateInformation FindByAbbreviation(string stateAbbreviation)
{
return UsStateInformation.GetAllStates().Where(s => s.Abbreviation == stateAbbreviation).FirstOrDefault<UsStateInformation>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment