Stream Tweet Place StateCode

May 27, 2015 at 5:42 PM
I have the "Streams" sample set up and running. I want to simply extract the U.S. state (AZ, IL, TX, etc.) if the tweet is Place.CountryCode = "US". It appears that Place.PlaceType 1 and 6 are relevant to me.

With Place.PlaceType = 1, Place.Name is the full state name. I can work with that.

With Place.PlaceType = 6, which is far more common, Place.Name = city/town name and Place.FullName is city/townname comma space two-letter state code. Of course, I can string manipulate my way to the state code, but I'm wondering if there is better way to get to it.

, Lee
May 29, 2015 at 3:37 PM
Hi,

I don't think there is a better way than the way you are planning to do it.
I would be happy to do that in the library but the problem is that not all countries are composed of states.

I think a good regex will be the best way to go.

Please give some feedback or code if you can. This could help other developers ;)

Cheers,
Linvi
Marked as answer by linvi on 5/29/2015 at 8:45 AM