Forums / Developer / gmaplocation extension GoogleMaps Not recognizing my Key

gmaplocation extension GoogleMaps Not recognizing my Key

Author Message

Pierre SCALFATI

Saturday 22 August 2009 5:41:05 am

Hello,

I thought that my gmaplocation was working fine but it was just working fine locally. Once I published my site on my domain space, I had this message :

The Google Maps Api server rejected your request. This could be
because the API key used on this site was registered for a different
website.

Here is the code of my override template used to display my Google Map localisation:



 <div class="class-gallery">

        <h1>{$node.name|wash()}</h1>

    {section show=$node.data_map.image.content}
        <div class="attribute-image">
            {attribute_view_gui alignment=right image_class=medium attribute=$node.data_map.image}
        </div>
    {/section}

        <div class="attribute-short">
           {attribute_view_gui attribute=$node.data_map.description}
        </div>
 <p>&nbsp;</p>  
 {literal}  
   <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key={ezini('SiteSettings','GMapsKey')}" type="text/javascript"></script>
<script type="text/javascript">
function MapViewer_{/literal}{$node.node_id}{literal}()

{
{/literal}
    var attribid = {$node.node_id};
    var mapid = 'map_{$node.node_id}';
    {if is_set($node.data_map.localisation.content.latitude)}
    var lat = {$node.data_map.localisation.content.latitude};
    var long = {$node.data_map.localisation.content.longitude};
    {else}
    var lat = 0.0;
    var long = 0.0;
    {/if}
    {literal}
    
    var map = null;
    var geocoder = null;
    var gmapExistingOnload = null;
    var marker = null;
    if (GBrowserIsCompatible()) 
    {
        var startPoint = new GLatLng(0,0);
        var zoom = 0;
        if(lat && long)
        {
          startPoint = new GLatLng(lat,long);
          zoom=16
        }
        map = new GMap2(document.getElementById(mapid));
        map.addControl(new GSmallMapControl());
        map.setCenter(startPoint, zoom);
        map.addOverlay(new GMarker(startPoint));
    }
}

if (window.addEventListener)
{
{/literal}
    window.addEventListener('load', MapViewer_{$node.node_id}, false);
{literal}
}
else if (window.attachEvent)
{
{/literal}
    window.attachEvent('onload', MapViewer_{$node.node_id});
{literal}
}
    {/literal}
</script>

I tried to enter the key directly in the code, but nothing. It works only on my local Macintosh.

If someone can help, it would be great.

André R.

Saturday 22 August 2009 5:57:49 am

Rember that you have to create one key pr domain, it seesm to work withouth key locally, so check your key.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Pierre SCALFATI

Saturday 22 August 2009 6:34:55 am

Hi André,

Yes I created just one key for my unique domain name.

First thing I noticed is that in my page source code, the ezpublish code remains as it is (it's not interpreted), I have the following line in my code :

Here is what is displayed in my source code:

<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key={ezini('SiteSettings','GMapsKey','site.ini')}" type="text/javascript"></script>

I tried to replace, typing : key="my_google_maps_key" (where my "my_google_maps_key" is the key that copy/paste from google api key generator for mydomain.com...

I noticed also something curious: the Localize button in the Ezpublish Admin Console doesn't work.

André R.

Saturday 22 August 2009 8:54:27 am

> the ezpublish code remains as it is (it's not interpreted)

It's inside a {literal} block, thats why.

Try the updated ezgmapslocation, it shouldn't have any of these issues and have some new features as well:
http://projects.ez.no/ezgmaplocation

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Pierre SCALFATI

Saturday 22 August 2009 8:54:48 am

Hello,

Believe it or not but what happened to me is really laughing. I must admit that I had no luck in the Google Key which was given to me by Google MAPS. In this code there's the letters "SEX' and as my routeur firewall is configured to block such words I had no display when I was adding the Key directly in my code !!!

My web site has nothing to deal with SEX, I must precise, but the Google Map algorithm which gave me the key was not inspired to put such letters in my key. I spent 1 day trying to solve this stupid problem.

For your information, what made me find the solution is that I typed directly the javascript generated in my Browser and I was astonished to get the reply, this time, from my Firewall, saying : "BLOCKED".

That's it.

So, if such problem happens, be sure before that it's not a sex affair :-)
Thank you Mister Google MAPS.

Best Regards.

eZ debug

Timing: Jan 18 2025 15:16:44
Script start
Timing: Jan 18 2025 15:16:44
Module start 'content'
Timing: Jan 18 2025 15:16:45
Module end 'content'
Timing: Jan 18 2025 15:16:45
Script end

Main resources:

Total runtime0.9224 sec
Peak memory usage4,096.0000 KB
Database Queries200

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 587.9688180.7969
Module start 'content' 0.00680.8108 768.7656577.9063
Module end 'content' 0.81760.1048 1,346.6719341.3359
Script end 0.9223  1,688.0078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4325210.0002
Check MTime0.00150.1623210.0001
Mysql Total
Database connection0.00080.083510.0008
Mysqli_queries0.851092.26142000.0043
Looping result0.00180.19291980.0000
Template Total0.893896.920.4469
Template load0.00240.261320.0012
Template processing0.891496.640320.4457
Template load and register function0.00010.011510.0001
states
state_id_array0.00130.142110.0013
state_identifier_array0.00080.082120.0004
Override
Cache load0.00200.2214380.0001
Sytem overhead
Fetch class attribute can translate value0.00140.156130.0005
Fetch class attribute name0.00120.131360.0002
XML
Image XML parsing0.00090.092930.0003
class_abstraction
Instantiating content class attribute0.00000.001470.0000
General
dbfile0.00320.3508280.0001
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs