none
Full state rather than 2 letter state code for US states RRS feed

  • Question

  • Hi,

    I am using Bing rest api in my application. To display results to user I want to show full state name rather than 2 letter state code.  For Example I am getting "MA" as state instead of  "Massachusetts" for waltham. I am getting this only for US states

    Is there any possibility through Bing API for me to get full state name for US states.

    Thanks,

    Suneel


    Monday, December 9, 2013 1:36 PM

Answers

  • The Bing Maps service will always try and return the 2 letter state code in the US. You can easily create a conversion table if you wish to link the 2 letter state code to a full name.

    http://rbrundritt.wordpress.com

    Monday, December 9, 2013 2:59 PM

All replies

  • The Bing Maps service will always try and return the 2 letter state code in the US. You can easily create a conversion table if you wish to link the 2 letter state code to a full name.

    http://rbrundritt.wordpress.com

    Monday, December 9, 2013 2:59 PM
  • HI Ricky,

    Thank you for the reply. Can you tell me how I can create a conversion table.

    Thanks

    Suneel Vanapalli


    Suneel Kumar Vanapalli

    Tuesday, December 10, 2013 5:22 AM
  • An easy conversion table is a 2D array or a Dictionary if you are using C#. For example using JavaScript you might do something like this:

    var stateLookup = { WA : "Washington", FL : "Florida" ...};

    And then you can retrieve the full state name by doing something like this:

    var state = "WA";

    var name = stateLookup[state];

    You may want to add some additional checks and maybe us a toUpperCase type method on the state value. Maybe also fall back on to the original value if a name value comes back null.


    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Wednesday, December 11, 2013 4:45 PM
    Wednesday, December 11, 2013 4:45 PM