Solved

this website needs a different google maps api key

Posted on 2010-09-08
3
843 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Expert Comment

by:mattibutt
ID: 33631408
try generating a new key
0
 
LVL 29

Accepted Solution

by:
chilternPC earned 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

739 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