Revision 2.56 of API v2

Friday, June 16, 2006 at 7:32:00 PM

Today we're releasing version 2.56 of API v2, which includes two bugfixes for the Maps API geocoder:

  • Improper escaping of the ampersand character ('&'). This has been fixed. The ampersand character is now correctly being returned as '&amp'.

  • Internet Explorer crashing when you hit the back button. This was happening because of the way that Internet Explorer caches JavaScript based on its URL. When a script node is created, IE checks if it already has seen the script, using the script's src attribute. If so, the control is passed to the cached script, even if it is going to disrupt the flow dictated by the surrounding code.

Here's what we plan to work on next to improve the geocoder:

  • Invalid JSON formatting. Because some JSON parsers cannot accept key names without quotation marks, we plan to change our JSON format to include quotes. So instead of returning request: "geocode", we'll return "request": "geocode". Since this increases the output size, we'll try to compensate a bit by removing any unnecessary spaces. Thus the amount of data you receive should not increase significantly.

  • Simpler HTTP response. Some developers have asked that we return a simpler geocode response that just contains the latitude and longitude, minus the extra information such as address components. We'll work on that.

Thank you to everyone who's been checking out the geocoder and sending feedback to the Maps API discussion forum. Keep the feedback coming!

API v1 Current: 1.31
API v1 Default: 1.31
API v2 Current: 2.56
API v2 Default: 2.55a

Google Maps for Enterprise

Wednesday, June 14, 2006 at 3:51:00 PM

At Google we like making products free, and most of our users seem to enjoy that too. So we were a little surprised that some companies asked if they could pay us for the Maps API (which, after geocoding, has been our most requested feature). In response to this popular corporate demand, we just launched Google Maps for Enterprise, which includes service-level agreements, full support and complete control over the user interface. And it has a different set of licensing terms for business and government customers who want to use the API in applications that are internal, non-publicly accessible or otherwise restricted by the current Maps API Terms of Use. (Interested customers may request pricing details.) Right now, it's only available in the U.S. and Canada; we're working to expand it as quickly as possible.

Of course, the Google Maps API continues to be totally open for free, publicly accessible sites, both non-profit & commercial. The new Enterprise product doesn't change the existing Google Maps API terms or product offering in any way.

Geocoding at last!

Tuesday, June 13, 2006 at 1:33:00 PM

On Sunday night we silently updated the Google Maps API to include geocoding, our #1 most requested feature by developers. It took just 4 hr 32 min 19 sec for curious developers (Mike Williams in this case) to discover it in our new JavaScript files.

The Maps API provides two ways to access the geocoder. You can talk to our geocode servers directly via HTTP request, or you can have the JavaScript do the dirty work for you from the browser. Some cool features of our geocoder are:

  • We don't require you to break up the address into components such as street, city, country. Just send us the address as a single string and let us take care of the parsing.

  • Don't worry about capitalization or punctuation or abbreviations. The geocoder is smart enough to figure out that "Pky" means "Parkway" and "Mtn View" means "Mountain View".

  • The geocoder returns a nicely formatted version of the address you sent. So if your users are typing in things like "1600 aMPhiTheatrE pkWy 94043 USa", we'll send you back a cleaned-up version that you can store & display back to users: "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA".

  • The geocoder also returns the address broken up into components, like street, country, province, prefecture, postal code, etc. This allows you to do things like sort all your addresses by zip code. The geocoder response uses the eXtensible Address Language format, is an international address standard that works for 200+ countries.

  • There's also a simpler version of the geocoder that returns a GLatLng. If you don't need any fancy extra features like address components or cleaned-up strings, just use the getLatLng method of GClientGeocoder to get back a geocoded point.

  • The client-side JavaScript geocoder comes equipped with a built-in cache. This makes the user experience faster and means you'll use up less of your geocode request quota.

  • Street-level geocoding is available for the US, Canada, France, Germany, Italy, Spain and Japan. More countries will be added as Google Maps launches in new countries.

For now, geocode requests are limited to 50,000 requests per day per API key. Since this is a new service, we've set a conservative limit and will reassess as usage picks up. For more information on the geocoder and example code, check out the documentation. As always, we welcome your feedback on the feature and the documentation.

API v1 Current: 1.31
API v1 Default: 1.31
API v2 Current: 2.55a
API v2 Default: 2.54

Update: Removed Japan from the list of countries for which we offer street-level geocoding, as it is not available there. たいへん申し訳ございません。 m(_ _)m

Revision 2.54 of API v2

Thursday, June 08, 2006 at 3:00:00 AM

We've released revision 2.54 of API v2. The changes in the current revision should not affect the API.

API v1 Current: 1.31
API v1 Default: 1.31
API v2 Current: 2.54
API v2 Default: 2.53

Revision 2.53 of API v2

Friday, June 02, 2006 at 2:43:00 PM

This week there's one API bugfix: the GOverviewMapControl no longer covers the copyright.

Here's an interesting Javascript story from a bug I ran into last week. There was an API site missing copyrights, and I tracked it down to a part of GCopyrightControl I had worked on that had code like this:

copyrightObject = {};
copyrightObject[somePrefix] = someArray;

for (var prefix in copyrightObject) {
  copyrightText += copyrightObject[prefix].join(', ');

But there was an exception saying "copyrightObject[prefix] is not an array" even though the only values I set on it were arrays. How could that be? It turned out the site had a library that modified Object.prototype, so when I wrote {}, I was not getting a blank object at all, but one with existing properties. I was treating copyrightObject as an empty hash table, but it didn't start empty.

What's the fix? First I used .hasOwnProperty() to ignore inherited properties. That looked good until our testing team caught a bug in the bugfix on its way to production: Safari 1.3 doesn't support hasOwnProperty. Ahh, browser compatibility fun! So in the end, I kept a separate array of the prefixes. Lesson of the week: Javascript objects are not quite hash tables.

API v1 Current: 1.31
API v1 Default: 1.31
API v2 Current: 2.53
API v2 Default: 2.52