Google Earth/Map API key problem

I’m trying to have my Rails app create a web page showing the Google
Earth API. I’ve been having some problems with it, but finally got
the window to come up by putting all the javascript code in as a
javascript_tag in my rhtml… Now I keep getting the an error that my
key is registered for a different website… Even though I’ve created
new keys for “localhost:3000” and my production website.

Anyone know what might be the problem?

I saw a previous potentially relevant posting that talked about
routing, but I’m thinking that they key is supposed to work for ANY
page served off that site?

Thanks for any help you can provide!


Just a thought, but I suspect that you’re not going to be able to use
the API locally without that error message. Although your computer
calls itself “localhost”, from Google’s end your computer is most
likely just an IP address (no reverse DNS set up), or something like (for example, what your computer
might resolve to on campus at my university).

The API documentation might say something about how to run it locally
without error?


Thanks for the suggestion!

You could be right about the local run, although some of the earlier
posts talked about getting a key for “localhost.” Unfortunately, I’m
having the same problem with my production web site.

Also, if one has an ordinary html web page, google doesn’t seem to
look at the key when it’s on the computer.

One more detail that could be relevant: if I view source and then
save the results to an html file, that works fine on my machine, but
not if I put the one with the production site’s key in the public
directory within my rails app on the production site.

So it really seems that google is seeing the rails app as something
other than the url it’s on.


I’m not completely sure what I did to fix this, but I started from
scratch with the sample map provided with the key, and it works now on
my local machine.

One possibility is that the scripts were outside the head in some of
my attempts. Although that doesn’t quite explain the reason the saved
html version worked, so I think there were multiple issues.

One more trick: don’t try to use a rails command for the key. Just
put the keyfile info in the header as it appears in your sample code
(as modified for Google Earth API vs. maps.)