?
Solved

this website needs a different google maps api key

Posted on 2010-09-08
3
Medium Priority
?
861 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
ID: 33631408
try generating a new key
0
 
LVL 29

Accepted Solution

by:
chilternPC earned 2000 total points
ID: 33631411
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
ID: 33635098
Hey, try using version 3 of google maps it requires no api key.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

585 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