I'm working to hack together a module that will take locative data assigned to nodes with location.module and plot those nodes on a map using the Google Maps API.
I've obtained several API keys, all of which will not work with my module-in-development. According to Google's documentation, the API keys are only valid for a single directory (i.e. only http://example.com/gmaps, not http://example.com/gmaps AND http://example.com/gmaps/mn).
I want my map page to be located at http://example.com/gmap. I've applied for a key using that URL, but get a javascript error alert when trying to access the page:
The Google Maps API key used on this website was registered for a different website...
I've tried keys for http://example.com, http://example.com/gmap, http://example.com/modules/gmap, all of which fail with the same error message.
Does this have something to do with the URL rewriting? I'm using clean URLs, but got the same error message testing the gmap module with clean URLs disabled.
Thanks in advance for troubleshooting ideas!
-Bjorn
Comments
Drupal in top level dir?
I assume you've got Drupal in the top level direcory, right?
In that case, the path site.com/gmaps really looks like this:
site.com/?q=gmaps
where gmaps would be a path that you registered in your hook_menu function.
- Robert Douglass
-----
If this helped you, please take the time to rate the value of this post: http://rate.affero.net/robertDouglass/
www.hornroller.com, www.robshouse.net
Yes, my drupal installation
Yes, my drupal installation is in the top-level directory. I've done a little more experimentation, and I'm no further along in sorting this out.
I tried turning off clean urls once again, and accessing http://choirgeek.com/?q=gmap with the API key I registered for the choirgeek.com root. No dice. Same error message as in my first post. I thought that Google might ignore the query parameters. Guess not?
The drupal module output is all being written correctly--both head and body content. The problem is that Google won't accept my API key.
http://choirgeek.com/gmap
Follow the link above to see error message and page source.
--
Bjorn | choirgeek.com
P.S.
For those digging through the page source, I know that the data file for the map points won't work as currently coded. I'm trying to get a working instance of the map set up first, and then will integrate the location.module output into the map.
--
Bjorn | choirgeek.com
problem solved
I don't know how I screwed this up. In any case, here is the solution:
Request an API key for the baseurl. That single key will work for http://example.com/gmap and http://example.com/?q=gmap. It will NOT however, work for http://example.com/gmap/ (with trailing slash) or any variant of http://subdomain.example.com/.
For additional directories or subdomains, additional keys are needed, and then some logic to know which key to apply when.
More information at http://www.google.com/apis/maps/documentation/
--
Bjorn | choirgeek.com
redirect www subdomain
I have the map accessible on my home page. If visitors access my site at http://www.choirgeek.com/ rather than http://choirgeek.com/, the Google API throws an error.
I added the following lines to my .htaccess file to redirect all requests for http://www.choirgeek.com/some-page-here to http://choirgeek.com/some-page-here.
AFAIK, this does not break anything else in Drupal.
--
Bjorn | choirgeek.com
Very cool!
This is exciting. Do you think this will be a separate module or will you contribute it as part of location.module. This type of functionality in Drupal would be truly AMAZING!
Be sure to post if you have any success.
--= Jeff Robbins | www.jjeff.com =--
separate module
It is already part of a separate working module. Demo at http://choirgeek.com/gmap.
--
Bjorn | choirgeek.com
Nice!
Does this exist in someone's sandbox? I'd love to tinker with it.
--= Jeff Robbins | www.jjeff.com =--
I've applied for CVS access
I've applied for CVS access so I can post the code in a sandbox. Until that happens, you can download code directly from my site at
http://choirgeek.com/files/googlemap.module.txt
--
Bjorn | choirgeek.com
proxy.php
I assume that proxy.php is a file for letting javascript create connections between websites? Do you have the source of that?
I'd think it's quite likely it should be a module on it's own or part of core Drupal itself (since we now support a bit of Ajax).
proxy.php
This proxy.php file was a first pass at letting the googlemaps script plot Drupal's native feeds as well as RSS feeds from different servers. At last check, it is not working as expected. Maybe someone can see the error.
At the moment, the call to proxy.php is commented out in my script.
proxy.php:
Also, I don't know if this proxy is a security hole or not. As far as I can tell, it's possible that someone could directly call http://example.com/path-to-module/proxy.php?url=http://example.com/malic....
--
Bjorn | choirgeek.com
wow... very interesting idea
wow... very interesting idea you had... well done
I never thought about google, but i have been pondering if that was even possible wiht the banners.module
I try many times and register
I try many times and register a new key for my site and i am getting this error " google map api used for this website registered for different website " From many days and i have post in many forums topics but no reply for that can any one is there who will tell me how to solve this issue .................................................
--
Azhar uddin
Technical Lead
email : engr.azharuddin@gmail.com
skype : computer_jin