State/Province list for Location Extension

2,673 views
Skip to first unread message

eint...@gmail.com

unread,
May 6, 2011, 3:51:56 PM5/6/11
to adwor...@googlegroups.com
Hi,
I am working on application to support Location Extension. Questions I have is to get all drop down values of state/province. Apparently, these value are different from Geographical Targeting

Do you know where I can get these values? or I have to use LocationService to verify what user entered?

Thanks

Pete Lavetsky (AdWords API Guru)

unread,
May 8, 2011, 2:55:10 AM5/8/11
to AdWords API Forum
The states are just the normal abbreviations for states: NY, CA, NJ.
This value is part of an Address object:

address.setStreetAddress( address1 ); //1 Main St
address.setCityName( city ); //Beverly Hills
address.setPostalCode( zip ); //90210
address.setProvinceCode( country + "-" + state ); //US-CA
address.setProvinceName( state ); //CA
address.setCountryCode( country ); //US

You use this address object to get a GeoLocation object through the
Google GeoLocation Service

GeoLocationSelector selector = new GeoLocationSelector();
selector.setAddresses( addresses );

This GeoLocation object is what you set on your LocationExtension
object

LocationExtension locationExtension = new LocationExtension();
locationExtension.setAddress( geoLocation.getAddress() );
locationExtension.setGeoPoint( geoLocation.getGeoPoint() );
locationExtension.setEncodedLocation( geoLocation.getEncodedLocation() );

Pete

On May 6, 3:51 pm, "einter...@gmail.com" <einter...@gmail.com> wrote:
> Hi,
> I am working on application to support Location Extension. Questions I have
> is to get all drop down values of state/province. Apparently, these value
> are different from Geographical Targeting<http://code.google.com/apis/adwords/docs/appendix/geotargeting.html>

Luke Renn

unread,
Jul 29, 2011, 4:10:54 PM7/29/11
to adwor...@googlegroups.com
I'm bumping this old thread because I'm running into the same issue.

As the OP points out, locations provinceCodes are not the same as for GeoTargeting .  For the US this is easy to solve (remove country code), but I need to know the exact list of supported countries and what those province codes are.  Another variation is UK.  For GeoTargeting UK province codes are supported, but for LocationAdExtensions they are not (and instead get a free form 'County' field).  As this service was recently added to the RMF, developers are going to need to know the discrepancies between GeoTargeting and LocationAdExtensions.

Is there a documented list of supported countries and corresponding province codes?

Thanks,

Luke


Eric Koleda

unread,
Aug 4, 2011, 10:58:01 AM8/4/11
to adwor...@googlegroups.com
Hi Luke,

Can you post a specific address that you are struggling with? Perhaps that will help illustrate the issue more clearly.

Best,
- Eric Koleda, AdWords API Team

Luke Renn

unread,
Aug 4, 2011, 1:25:33 PM8/4/11
to adwor...@googlegroups.com
First, it's not really a specific address.  It's a general question about what is supposed to be in provinceName and what the rules are around provinces in general.  

If you send a US address with US-NJ as the province code and leave provinceName blank, you do not get an error.  However if you check the address in the MCC the state is not populated.  To get that to work, you need to put NJ in the provinceName.  Fine, we can just strip out the <CountryCode-> from all provinceCodes and send that as the provinceName.  This works for most countries.  This is what the OP is about.

However, if you goto add a UK address there is no province drop down with the values from the province codes appendix[1].  Instead, it is a free form text field for "County".  For UK addresses it seems you can put the provinceCode in, but for provinceName, you have to put an actual county.  Stripping out the <CountryCode-> like you can do for states does not work since those regions are Ireland, Wales, etc.  Besides trying every country, how am I supposed to know what these rules are?

So works:

<provinceCode>US-NJ</provinceCode>
<provinceName>NJ</provinceName>

Doesn't work:

<provinceCode>GB-ENG</provinceCode>
<provinceName>ENG</provinceName>

In this case, if I put a county name in provinceName it would work.  I just need to know what the rules are for each country.

Speaking of countries, is the list of supported countries documented any where other than just looking at the current UI?

My bonus question is where can I find the icon id mappings to the actual images.  I know 1000 is the default (looks like a desk), but I really don't feel like determining the other 16 by changing the icon and calling the service to see what it sends.  Can I download these icons anywhere other than right click->save as?  They are not returned from the MediaService.

Since the CampaignLocationAdExtensions are now part of the RMF I would expect some more documentation on it.

Thanks,

Luke

Eric Koleda

unread,
Aug 5, 2011, 5:21:42 PM8/5/11
to adwor...@googlegroups.com
Hi Luke,

There is certainly more we can do to document the behavior of this service, and thank you for bringing up these points.  In regards to your questions:

1) As you've found, it's better to remove the country-code prefix when populating the provinceCode.  Although US-NJ works, it's safer to just use NJ.  GB-ENG will return an invalid geo location, but just ENG works.

2) The provinceName field should contain the province as you'd like it to be displayed in the ad.  For example, "England" instead of ENG.  The province code page includes the display name for each province.  You can choose to use either "NJ" or "New Jersey" for the province code NJ, however the drop down in the UI only seems to work with "NJ".

3) The availability of location extensions is not API specific and is documented in the AdWords Help Center: http://adwords.google.com/support/aw/bin/answer.py?hl=en&answer=144619

4) The MediaService will return all the standard icons if you add a predicate for Type EQUALS STANDARD_ICON.  Using a predicate for the MediaId doesn't seem to work however, and I'll look into that.

Let me know if you have any other questions.

Best,
- Eric

Luke Renn

unread,
Aug 16, 2011, 2:23:00 PM8/16/11
to adwor...@googlegroups.com
1) It's pointless to even populate provinceCode.  It doesn't come down with the locations anyway (it's always null) and as far as I can tell, is ignored.

2) Right, but what I really wanted was the list countries that don't work as expected.  From what I can tell these are the United Kingdom, Egypt, and Columbia [ 'GB', 'EG', 'CO' ].  For those three countries there is a text field in the adwords ui even though there is seed data for province codes for those countries.  For the UK, it calls itself County, for this, the provinceName needs to either be the valid county, or a valid provinceName (England).  For any other countries with provinceCodes the provinceName needs to be the provinceCode with the country stripped.  Otherwise, the drop down won't be properly set.

3) While it's true that it is documented there, that's not exactly the best place for a developer to find it.  For anyone else out there, here are the supported country codes so you can filter your country list...

[ 'AU', 'AT', 'BE', 'BR', 'CA', 'CL', 'CN', 'CO', 'HR', 'CZ', 'DK', 'EG', 'FI', 'FR', 'DE', 'HK', 'HU', 'IN', 'IE', 'IL', 'IT', 'JP', 'KE', 'KR', 'LI', 'MY', 'MX', 'NL', 'NZ', 'NG', 'NO', 'PL', 'PT', 'RU', 'SG', 'SK', 'ZA', 'ES', 'SE', 'CH', 'TW', 'TH', 'UA', 'GB', 'US' ]

4) Ok, could be better documented; not being able to pull by mediaId is odd.

Thanks,

Luke

Alexander Parij

unread,
Sep 27, 2011, 1:51:11 PM9/27/11
to adwor...@googlegroups.com
Hi Eric 

Can you explain to me why this address is invalid geolocation or any address in UK? :

                           'streetAddress' :17 Rectory Terrace ,
                           'streetAddress2' : '' ,
                           'cityName' : Cambridge,
                           'provinceCode' : GB-ENG,  (or ENG )
                           'provinceName' : ENG or England
                           'postalCode':  CB1 9HU ,
                           'countryCode' : GB

Thanks

Eric Koleda

unread,
Sep 27, 2011, 5:21:21 PM9/27/11
to adwor...@googlegroups.com
Hi Alex,

Some trial and error indicates that the service is rejecting it with the postalCode specified, but working correctly without a postal code.  Unfortunately I don't have any information as to why this is the case.  Is this address validating correctly in the UI?

Best,
- Eric

Alexander Parij

unread,
Sep 27, 2011, 5:43:35 PM9/27/11
to adwor...@googlegroups.com
Thanks Eric, 

Unfortunately the api requires the postalCode...
This address or any other UK or South African address is accepted in UI and can be downloaded with the same post code.
You can try Apple's store address in London taken from the official site :  
235 Regent Street
LondonW1B 2EL
England, GB

I hope you don't reject this address based on the rivalry between the two companies...

Alexander Parij.
Thanks.




 



Eric Koleda

unread,
Sep 30, 2011, 4:57:01 PM9/30/11
to adwor...@googlegroups.com
Hi Alexander,

I'm able to geocode that address without any problems:

<selector>
  <addresses>
     <streetAddress>235 Regent Street</streetAddress>
     <cityName>London</cityName>
     <provinceName>England</provinceName>
     <provinceCode>ENG</provinceCode>
     <postalCode>W1B 2EL</postalCode>
     <countryCode>GB</countryCode>
  </addresses>
</selector>

<rval>
  <geoPoint>
     <latitudeInMicroDegrees>51514343</latitudeInMicroDegrees>
     <longitudeInMicroDegrees>-141765</longitudeInMicroDegrees>
  </geoPoint>
  <address>
     <streetAddress>235 Regent Street</streetAddress>
     <cityName>London</cityName>
     <provinceCode>ENG</provinceCode>
     <provinceName>England</provinceName>
     <postalCode>W1B 2EL</postalCode>
     <countryCode>GB</countryCode>
  </address>
  <encodedLocation>qrvM3...</encodedLocation>
  <GeoLocation.Type>GeoLocation</GeoLocation.Type>
</rval>

Best,
- Eric

Joshua Chan

unread,
Aug 9, 2012, 7:04:42 PM8/9/12
to adwor...@googlegroups.com
Hi Eric,

Do you know why using the provinceCode in a request for a South African address returns an InvalidGeoLocation?

Using the address of the Google Johannesburg office, here's a request that works:
'streetAddress2': None,
'countryCode': 'ZA',
'cityName': 'Bryanston, Johannesburg',
'streetAddress': 'Cnr Main & Sloane Street',
'provinceCode': 'GT',
'postalCode': '2012'

But adding any of these makes it not work:
'provinceCode': 'ZA-GT'
'provinceCode': 'GT'

Johannesburg is in the province of Gauteng and the province code of 'ZA-GT' is retrieved from https://developers.google.com/adwords/api/docs/appendix/provincecodes#South%20Africa
Also noticed that in the UI, there's no dropdown for the province for South Africa. Is provinceCode needed then?

Thanks,
Josh

Joshua Chan

unread,
Aug 15, 2012, 2:42:58 PM8/15/12
to adwor...@googlegroups.com
Are there any updates on this, by any chance?
Reply all
Reply to author
Forward
0 new messages