Attention! Do you have any ideas for reorganizing and updating the Mapki? Please leave a note here. Thank you!

Talk:FAQs

From Google Mapki

Jump to: navigation, search

I am currently working on a government site, trying to start my mapping process. As I am doing this a little blind, I was wondering if someone could give me advice telling me where to begin with this process. I have created an API key through google, and have linked it to this domain, but nothing comes up when I enter the information into a page in the domain. What am I doing wrong? http://www.vdh.virginia.gov/epidemiology/DiseasePrevention/indextest1.htm

any help would be much appreciated. Thank you

First of all, please copy this content to notepad and save it to *.htm (for instance, map.htm) Second, to suppose that you have created an API key through google with your web site URL ( for example, http://www.vdh.virginia.gov/api), you should move map.htm to under virtual path api. Third, key=ABQIAAAAoB5Y1ibhTVqqF2LugJ5tdxTdDwYDXDH52oLs-2MW0CjwGBqfrxSoCqDtMi cF1gh0V0UpAnDr0WK_oA should be changed to what you get API Key sent from google after you click "Generate API Key" and then it should work. Good Luck


<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Google Maps JavaScript API Example</TITLE> <script

src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAoB5Y1ibhTVqqF2LugJ5tdxTdDwYDXDH52oLs-2MW0CjwGBqfrxSoCqDtMi

cF1gh0V0UpAnDr0WK_oA"

     type="text/javascript"></script>

<SCRIPT type=text/javascript>

   //<![CDATA[
   function load() {
     if (GBrowserIsCompatible()) {
       var map = 

new GMap2(document.getElementById("map"));

       map.addControl(new GSmallMapControl());
       map.addControl(new 

GMapTypeControl());

       map.setCenter(new GLatLng(37.4419, -122.1419), 13);
       // Create a base icon for all of 

our markers that specifies the

       // shadow, icon dimensions, etc.
       var baseIcon = new GIcon();
       

baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";

       baseIcon.iconSize = new GSize(20, 34);
       

baseIcon.shadowSize = new GSize(37, 34);

       baseIcon.iconAnchor = new GPoint(9, 34);
       baseIcon.infoWindowAnchor 

= new GPoint(9, 2);

       baseIcon.infoShadowAnchor = new GPoint(18, 25);
       // Creates a marker whose info window 

displays the letter corresponding

       // to the given index.
       function createMarker(point, index) {
         // 

Create a lettered icon for this point using our icon class

         var letter = String.fromCharCode("A".charCodeAt(0) + 

index);

         var icon = new GIcon(baseIcon);
         icon.image = "http://www.google.com/mapfiles/marker" + letter + 

".png";

         var marker = new GMarker(point, icon);
         GEvent.addListener(marker, "click", function() {
       
   marker.openInfoWindowHtml("Marker " + letter + "");
         });
         return marker;
       }
       // 

Add 10 markers to the map at random locations

       var bounds = map.getBounds();
       var southWest = 

bounds.getSouthWest();

       var northEast = bounds.getNorthEast();
       var lngSpan = northEast.lng() - 

southWest.lng();

       var latSpan = northEast.lat() - southWest.lat();
       for (var i = 0; i < 10; i++) {
         

var point = new GLatLng(southWest.lat() + latSpan * Math.random(),

                                 southWest.lng() + 

lngSpan * Math.random());

         map.addOverlay(createMarker(point, i));
       }
     }
   }
   //]]>
   </SCRIPT>

<META content="MSHTML 6.00.2800.1589" name=GENERATOR></HEAD> <BODY onload=load() onunload=GUnload()>

</BODY></HTML>
Personal tools
Advertisement