# Google Earth/Map API key problem

**URL:** <https://www.ruby-forum.com/t/google-earth-map-api-key-problem/154432>\
**Category:** Rails\
**Created:** [November 29, 2008, 1:36pm UTC](https://www.ruby-forum.com/t/google-earth-map-api-key-problem/154432 "2008-11-29T13:36:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![icewoman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@icewoman](https://www.ruby-forum.com/u/icewoman)\
**Post date:** [November 29, 2008, 1:36pm UTC](https://www.ruby-forum.com/t/google-earth-map-api-key-problem/154432/1 "2008-11-29T13:36:48Z")

</div>

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!

-Lisa

---

<div class="post-metadata">

**Author:** ![icewoman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@icewoman](https://www.ruby-forum.com/u/icewoman)\
**Post date:** [November 29, 2008, 6:40pm UTC](https://www.ruby-forum.com/t/google-earth-map-api-key-problem/154432/2 "2008-11-29T18:40:50Z")

</div>

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  
lisas-computer.wireless.ualberta.ca (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?

-Brady

---

<div class="post-metadata">

**Author:** ![icewoman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@icewoman](https://www.ruby-forum.com/u/icewoman)\
**Post date:** [November 29, 2008, 8:55pm UTC](https://www.ruby-forum.com/t/google-earth-map-api-key-problem/154432/3 "2008-11-29T20:55:46Z")

</div>

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.

-Lisa

---

<div class="post-metadata">

**Author:** ![icewoman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@icewoman](https://www.ruby-forum.com/u/icewoman)\
**Post date:** [November 30, 2008, 7:28pm UTC](https://www.ruby-forum.com/t/google-earth-map-api-key-problem/154432/4 "2008-11-30T19:28:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![icewoman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@icewoman](https://www.ruby-forum.com/u/icewoman)\
**Post date:** [November 30, 2008, 8:39pm UTC](https://www.ruby-forum.com/t/google-earth-map-api-key-problem/154432/5 "2008-11-30T20:39:25Z")

</div>

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.)
