Doodles for Google Apps

 

Since 1998, when the first doodle was released, they have been one of the most loved features of the Google home page. There have been doodles to celebrate all kinds of events, including national holidays, birthdays of artists and scientists, sports competitions, scientific discoveries and even video games! Also, doodles have evolved from simple static images to complex applications, such as the interactive electric guitar used to celebrate the birthday of Les Paul.

Want your company logo to change for selected events or holidays, just like doodles? The Admin Settings API allows domain administrators to write scripts to programmatically change the logo of their Google Apps domain, and Google App Engine offers the ability to configure regularly scheduled tasks, so that those scripts can run automatically every day.

With these two pieces combined, it is pretty easy to implement a complete solution to change the domain logo on a daily basis (assuming the graphic designers have prepared a doodle for each day), as in the following screenshot:

 

Let’s start with a Python App Engine script called doodleapps.py:

import gdata.apps.adminsettings.service
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from datetime import date

class DoodleHandler(webapp.RequestHandler):
  # list of available doodles
  DOODLES = {    
    '1-1': 'images/newyearsday.jpg',
    '2-14': 'images/valentinesday.jpg',
    '10-31': 'images/halloween.jpg',
    '12-25': 'images/christmas.jpg'
  }

  # returns the path to the doodle corresponding to the date
  # or None if no doodle is available
  def getHolidayDoodle(self, date):
    key = '%s-%s' % (date.month, date.day)
    if key not in self.DOODLES:
      return None

    return self.DOODLES[key]

  # handles HTTP requests by setting today’s doodle
  def get(self):
    doodle = self.getHolidayDoodle(date.today())
    self.response.out.write(doodle)

    if doodle:
      service = gdata.apps.adminsettings.service.AdminSettingsService()
      // replace domain, email and password with your credentials
      // or change the authorization mechanism to use OAuth
      service.domain = 'MYDOMAIN.COM'
      service.email = 'ADMIN@MYDOMAIN.COM'
      service.password = 'MYPASSWORD'
      service.source = 'DoodleApps'
      service.ProgrammaticLogin()

      # reads the doodle image and update the domain logo
      doodle_bytes = open(doodle, "rb").read()
      service.UpdateDomainLogo(doodle_bytes)

# webapp initialization
def main():
    application = webapp.WSGIApplication([('/', DoodleHandler)],
                                         debug=True)
    util.run_wsgi_app(application)

if __name__ == '__main__':
    main()

The script uses a set of predefined doodles which can be edited to match your list of images or replaced with more sophisticated logic, such as using the Google Calendar API to get the list of holidays in your country.

Every time the script is triggered by an incoming HTTP request, it will check whether a doodle for the date is available and, if there is one, update the domain logo using the Admin Settings API.

In order for this script to be deployed on App Engine, you need to to configure the application by defining a app.yaml file with the following content:

application: doodleapps
version: 1
runtime: python
api_version: 1

handlers:
- url: .*
  script: doodleapps.py

We want the script to run automatically every 24 hours, without the need for the administrator to send a request, so we also have to define another configuration file called cron.yaml:

cron:
- description: daily doodle update
  url: /
  schedule: every 24 hours

Once the application is deployed on App Engine, it will run the script on a daily basis and update the logo.

It’s Time to Improve Your Web Map App

 

Google had several new feature announcements for the Google Maps API in the last few months, including high resolution static maps, the new Street View Image API, and the use of high DPI map tiles in the JS Maps API on mobile devices. I’m here to give you some tips for using these new features to improve your existing mobile JS map app.

1. Upgrade Your App to Use the v3 API
If you’re still using the v2 Google Maps API it’s time to change that. Period. This is one of the best improvements you can make to your map app. The v3 Google Maps API was designed for the mobile web and it is significantly faster than its predecessor. Not only is the v3 Google Maps API designed to load fast on mobile browsers, but your app will be upgraded immediately because your map will automatically access high DPI map tiles, which have better on screen fidelity.

2. Use the Static Maps API to Improve User Experience
Check your Google Analytics data (or server logs) to see if your app is being accessed by devices with browsers that can’t or don’t fully support JavaScript. You can add logic to your app (e.g, server-side user agent checking) to determine whether you should serve your JS Maps API-based app or a static map image that shows the same or similar information. Although your users won’t be able to interact with the map, they’ll appreciate the ability to view the map. You can even add markers and other features to the static map. You’ll also be able to take advantage of the high resolution Static Maps API.

 

3. Use StreetView Images to Provide More Context
Chances are your map app gives users access to all kinds of information, whether it’s your own data and images or our very own Places API. Give your users some additional context by using the Street View Image API to provide a general idea of what a location looks like at street level. When you provide a location in your URL request, the API will snap to the panorama photographed closest to that particular location.

4. Use the JS Maps API Only When It Makes Sense
If all you need is a small map for context, you should be using the Static Maps API. This may seem obvious, but we’ve come across a few mobile apps that seem to use the JS Maps API to provide nothing more than a thumbnail. Use the Static Maps API to load a small image and, if needed, link that thumbnail to open up a larger map (whether your own page that uses the JS Maps API or maps.google.com).

And again, if you’re still using the deprecated v2 Google Maps API in any of your apps (mobile or otherwise), it’s time to migrate your app to the v3 Google Maps API, as Google are more than halfway through the three year deprecation period.

 

Google Street View with a Date


The Google Earth Blog noticed that Google Maps Street View images now come with a date telling you when the panoramas were taken.

If you look at the bottom left hand corner of a Street View image you can now view the month and year when the picture was taken.

Another nice little feature I’ve noticed Google Maps testing recently is the highlighting of search results. For a while now when you search for a location in Google it has shown a map with the searched area highlighted. Google have been testing this feature in Google Maps as well.


This feature still seems to be very much in the testing stage. I noticed the feature was working this morning but this afternoon it no longer seems to be working for me.

Finally, in Chrome (but not in Firefox and IE for me) the satellite button in Google Maps now shows the satellite view directly beneath the button.

via:googlemapsmania