[GIS] Google Maps API v.2 to v.3 conversion

apigoogle maps

I want to go from
http://www.zolnai.ca/WMS/whereintheworldV2.htm
to
http://www.zolnai.ca/WMS/whereintheworldV3.htm
I went through Gmaps API documentation on code.google.com and added the changes that I could find, but I cannot get the V3.htm to display anything.

Comments or suggestions please?

Best Answer

In http://www.zolnai.ca/WMS/whereintheworldV3.htm you are missing the following:

  1. Proper reference to the google maps api library. From v3 there is no need for an api key so the reference would look like this:

    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    
  2. There is no need for "new google.maps.Icon". You can simply use gicons["pink"]="0pink_Marker.PNG";

  3. "new google.maps.Marker(point, gicons[icontype]);" is completely wrong syntax in v3. The right way of defining your marker would be: "new google.maps.Marker({position:point, icons:gicons[icontype]});" That is because in v3, the marker object requires a list of options in a javascript object literal, which in your case is: {position:point,icon:gicons[icontype]}

I am watching the code right now but it seems to me your code is a perfect mixture ofthe two versions. I recommend you checking the v3 api and picking it up!

Related Question