Solved

this website needs a different google maps api key

Posted on 2010-09-08
3
830 Views
Last Modified: 2012-05-10
Hello,
I have an application that uses a Google api key to load a map.  I already have an API key, however, I'm getting a popup alert that tells me i need a new API key as follows: "this website needs a different google maps api key. "

My code is as follows:
--------------
  <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAlvXTXirLwHOAUAbh9-o8FRQI-BQMnXINec8zTxOlEi2KX90_rRSs-MmEVhvKPN2L5yvAK3eNbVwvYA" type="text/javascript"></script>
 
    <script src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.1" type="text/javascript" ></script>

    <script type="text/javascript">
    var map = null;
    var parcelQueryTask = null;
    var parcelQuery = null;
    var mapExtension;
    var gOverlays;


    function LoadMap() {

      //Load Google Maps
      map = new GMap2(document.getElementById("mymap"));

      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(29.828135, -95.335922), 8);
      map.enableScrollWheelZoom();
      map.addMapType(G_PHYSICAL_MAP);
      map.setMapType(G_PHYSICAL_MAP);      

 

     
      //create mapextension class to be used to add/remove results from the map.
      mapExtension = new esri.arcgis.gmaps.MapExtension(map);

      //create mapOptions to specify opacity, minResolution, maxResolution when adding to the map.
      var mapOptions = {opacity: 0.75, minResolution:0, maxResolution: 19};

      //create custom tile layer
      var tiledmap = new esri.arcgis.gmaps.TiledMapServiceLayer("http://webgis2.h-gac.com/ArcGIS/rest/services/Lamberts/lamberts_tiles/MapServer", mapOptions, addTiledMap);

      //Build ArcGIS Server Query Task and Filter against the Tile Layer
      tileQueryTask = new esri.arcgis.gmaps.QueryTask("http://webgis2.h-gac.com/ArcGIS/rest/services/Lamberts/lamberts_tiles/MapServer/0");

      tileQuery = new esri.arcgis.gmaps.Query();
      tileQuery.returnGeometry = true;
      tileQuery.outFields = ["LAMBERT","Download"];


      GEvent.addListener(map, "click", function(marker, point) {
        if(!marker){
          mapExtension.removeFromMap(gOverlays);
          gOverlays=null;
          tileQuery.queryGeometry = point;
          tileQueryTask.execute(tileQuery, false, addResults);
        }
      });
    }

    function addTiledMap(gTileLayer) {
      //Add tile layer as a GTileLayerOverlay using mapExtension
      mapExtension.addToMap(gTileLayer);
    }


    function addResults(fset) {

      var overlayOptions = {
        strokeColor:"#FF0000",
        strokeWeight:3,
        strokeOpacity:0.75,
        fillColor:"#000066",
        fillOpacity:0.4
      };

      gOverlays = mapExtension.addToMap(fset,overlayOptions,null);

  }

  </script>

<body onload="LoadMap()"  onunload="GUnload()">

---------
 ANY help in either updating the key or getting this alert mssg off so that it does not popup when the page loads would be greatly appreciated.


0
Comment
Question by:Codeaddict7423
3 Comments
 
LVL 11

Expert Comment

by:mattibutt
Comment Utility
try generating a new key
0
 
LVL 28

Accepted Solution

by:
chilternPC earned 500 total points
Comment Utility
each key is created for a particular URL (even aliass)
I had the probrem when I used the key on a .com when I created it for .co.uk even thought the .com was an alias.
go back to google and create anothe key for the site you have the map on
0
 
LVL 2

Expert Comment

by:kostantinos1995
Comment Utility
Hey, try using version 3 of google maps it requires no api key.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now