Getting started with Google Maps

My first few searches turned up some fairly unpolished methods of accessing Google Maps from Ruby. I’m definitely using Ruby as a starting point in this challenge, its the language I’m most comfortable with. That’s not to say that I’m not going to do any other languages. I do want to do a Python/Django project at some point, just to get it out of the way.

After bit of digging around I discovered the YM4R gem. YM4R provides access to the Google Maps and the Yahoo! Maps Building Block API’s. Before we go any further lets just get a Google Map on the page and point it at a location. The gem also comes as a plugin for rails, which I’m about to find out has some different capabilities (more on that later).

To do that we need to get an API key here. Making sure to put in whatever url you will be using to access your application, in my case, at least for the example application, that’s http://localhost:4567. If you’re familar with the port number then you know that I’m using Sinatra rather than Rails, this means, is that I can’t use the YM4R/GM rails plugin (at least without hacking it up) & unlike the plugin the gem doesn’t contain the code to actually generate the map code. So I’m back to the drawing board.

Taking a step back I have a look at how difficult it is to just get it onto the page without a helper, which as it turns out is ‘not very’. Lets look at the code to get a minimal example happening:

And the view:

Google Maps Example Application Screenshot

Google Maps Example Application Screenshot

As you can see, It’s pretty simple to get a nice looking Google Map onto the page. In the next post I’ll go into the details of how to start manipulating the map for our purposes.

Overhype – Breathe, just breathe

A huge deal has been made of the Terms of Service for Google Accounts and Google Chrome. Slashdot, Ars Technica and a host of bloggers jumping on the bandwagon to pimp their blogs. And the cause a few sentences in the Terms of Service for Google Accounts, which apparently got copied to Google Chrome (Which has since been corrected). Here is the offending passage (as copied to slashdot):

“By submitting, posting or displaying the content you give Google a perpetual, irrevocable, worldwide, royalty-free, and non-exclusive license to reproduce, adapt,
modify, translate, publish, publicly perform, publicly display and distribute any content which you submit, post or display on or through, the services. This license is for the sole purpose of enabling Google to display, distribute and promote the services and may be revoked for certain services as defined in the additional terms of those services.”

Scary? Not really, as far as Google Chrome goes its actually a mistake. Someone at Google didn’t read the Google Accounts ToS closely enough when they copied and pasted
it. The offending section has now been changed:

11. Content license from you

11.1 You retain copyright and any other rights you already hold in Content which you submit, post or display on or through, the Services.

Many people are also concerned about the above as it relates to Google Accounts. Let me debunk those concerns, first by providing the whole section of the ToS:


11. Content licence from you

11.1 You retain copyright and any other rights you already hold in Content which you submit, post or display on or through, the Services. By submitting, posting or displaying the content you give Google a perpetual, irrevocable, worldwide, royalty-free, and non-exclusive licence to reproduce, adapt, modify, translate, publish, publicly perform, publicly display and distribute any Content which you submit, post or display on or through, the Services. This licence is for the sole purpose of enabling Google to display,distribute and promote the Services and may be revoked for certain Services as defined in the Additional Terms of those Services.

11.2 You agree that this licence includes a right for Google to make such Content available to other companies, organizations or individuals with whom Google has relationships for the provision of syndicated services, and to use such Content in connection with the provision of those services.

11.3 You understand that Google, in performing the required technical steps to provide the Services to our users, may (a) transmit or distribute your Content over various public networks and in various media; and (b) make such changes to your Content as are necessary to conform and adapt that Content to the technical requirements of connecting networks, devices, services or media. You agree that this licence shall permit Google to take these actions.

11.4 You confirm and warrant to Google that you have all the rights, power and authority necessary to grant the above licence.

and then with the following from Googles own FAQ:

Privacy and security: Understanding section 11.1 of our Terms of Service

We’ve received questions over time about the meaning of section 11.1 of our Terms of Service. We realize that or those not familiar with legal agreements for services that use the Internet, these terms can look confusing, or even frightening.

The first thing to understand is that this language doesn’t give Google ownership rights to your data. You, and you alone, own your content. Whether you wish to keep your content totally private, or share it with the world, that’s your choice.

However, in order to honor this choice, Google Docs needs permission to display your content as you see fit. This is what we mean by a “license to reproduce.” We
need to ensure that when you click the “Publish document” button, or use the “Invite collaborators” option, we have the license to carry out your wishes. It
is this agreement, between Google Docs and you, the user, that section 11.1 of our Terms of Service reflects.

So firstly the license that you grant google is for the sole purpose of technically performing ‘publishing’ and ‘collaborating’ on content, and secondly The Terms of Service go on to talk about terminating the agreement. Honestly its all legal speak, Google could get away with a lot if it wanted to, with or without license. But they market themselves as not being evil, stepping away from that statement is not in their best interest; people have long memories. So sure be a little bit cautious when you use these wonderful Web 2.0 services that google and others provide, but please spare me the overhype. If there is a problem then contact the people that can fix it and a wait for a response.