Does anyone have a list of AppEngine location header codes for regions and cites?

76 views
Skip to first unread message

Patrick

unread,
Mar 31, 2014, 3:04:57 PM3/31/14
to google-a...@googlegroups.com
AppEngine uses ISO 3166-1 alpha-2 country codes for the country header but there seems to be no set pattern for region or city.  For example,  we have seen saint, st. and st in city names.  Also not every city is in a region.  If anyone has a list of the codes used it would help us out greatly.

        

**** Our recent press: AdWeek, VentureBeat, TechCrunch

**** We're hiring! Our open roles: MediaSpike Careers

Vinny P

unread,
Apr 2, 2014, 4:10:56 AM4/2/14
to google-a...@googlegroups.com
On Mon, Mar 31, 2014 at 2:04 PM, Patrick <pat...@mediaspike.com> wrote:
AppEngine uses ISO 3166-1 alpha-2 country codes for the country header but there seems to be no set pattern for region or city.  For example,  we have seen saint, st. and st in city names.  Also not every city is in a region.  If anyone has a list of the codes used it would help us out greatly.


The differing patterns that you're seeing can be annoying, but they're easy enough to work around depending on the use case. What exactly are you using the addresses for?

In regards to the "list of the codes" you're asking for, I don't think such a list exists. But this same issue happens with a lot of the other geocoding solutions available out there, paid or free.
 
 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

Patrick Laban

unread,
Apr 2, 2014, 3:07:09 PM4/2/14
to google-a...@googlegroups.com

We wish to use the location headers for geotargeting.

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/QlR6NFhkeYo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.

Vinny P

unread,
Apr 3, 2014, 4:01:58 AM4/3/14
to google-a...@googlegroups.com
On Wed, Apr 2, 2014 at 2:07 PM, Patrick Laban <pat...@mediaspike.com> wrote:

We wish to use the location headers for geotargeting.


Depending on how accurate you want the geotargeting to be, the header data provided should be good enough.

As an alternative, what you can do is collect the lat/long from the header X-AppEngine-CityLatLong then look up the city name by using the Google Geocoding API: https://developers.google.com/maps/documentation/geocoding/#ReverseGeocoding or another geocoding service such as MaxMind: http://www.maxmind.com/en/geolocation_landing . The Geocoding API in particular can supply several different versions of the city name, and you can choose your preferred version.

I realize that in your previous email, you commented about city names not being standardized: i.e. some cities have St while others have Saint in their names. But that shouldn't be a problem; the goal here is to have all users within a specific geographical zone share the same identifying string. For instance, as long as all users from Saint Example City all have "St. Example City" OR "Saint Example City" OR "ST Example City", does it really matter which string is used?

During geotargeting, you can convert the city name back to coordinates (or simply save the coordinates themselves) and use those to select users for your services.

You may also want to investigate the HTML5 Geolocation API: most modern browsers support it and it can provide much more accurate geolocation data: https://developer.mozilla.org/en-US/docs/WebAPI/Using_geolocation 
Reply all
Reply to author
Forward
0 new messages