Google App Engine has announced version 1.6.5 of its App Engine SDK. I was pleasantly surprised to find an excellent feature that was hidden away in the Release Notes. Here is the nugget:
- All user requests have X-AppEngine-Region, X-AppEngine-City, and X-AppEngine-CityLatLong headers which contain location information based on the IP address of the client request. For a full description of these headers, see:
I had covered earlier on X-AppEngine-country and the fact that it worked quite well. And I had suggested just offhand that Google should probably take this one still further and provide other fine grained information too like city. It looks like they have gone further than that and include region, city and latitude / longitude.
In addition to the X-AppEngine-Country in the request header, it has now introduced the following additional location based headers with each request:
- X-AppEngine-Region
- X-AppEngine-City
- X-AppEngine-CityLatLong
<h2>Hello My Friend. Your co-ordinates are: </h2>
<h3> Country : <%=request.getHeader("X-AppEngine-Country") %></h3>
<h3> Region : <%=request.getHeader("X-AppEngine-Region") %></h3>
<h3> City : <%=request.getHeader("X-AppEngine-City") %></h3>
<h3> Latitude,Longitude : <%=request.getHeader("X-AppEngine-CityLatLong") %></h3>
Since I live in India, it does a good job and prints out the following (as shown in the screenshot below):
You can try it too.
Do you envision using this in your application? What have you been using so far to get similar functionality?
Source Code on GitHub.
Read more Episodes on App Engine Services
- Writing Google Talk Bots with App Engine
- Write your first Google Chrome Extension, powered by App Engine
- Scheduling Background Tasks in App Engine: Learn about the Cron Scheduler in App Engine
- Asynchronous Processing in App Engine: Learn about tasks / queues in App Engine
- Handling Email in App Engine Applications: Sending and Receiving incoming Email in your App Engine applications
- Blobstore Tutorial : Use the App Engine Blobstore service to store data in GB
- Datastore Tutorial : Basic database programming in App Engine
- Captcha Tutorial: How to integrate a Captcha in your App Engine application
- Location Services: Learn how to detect Location (Latitude & Longitude) in your App Engine Application. Part 1 and Part 2.
- Memcache: Learn how to use the cache to speed up your App Engine applications
- Networking: Learn how to make calls to external Web Services using URLFetch service in App Engine.
- Download the eBook: All the episodes packaged for you in a free eBook. Enjoy and thanks for downloading.
