I've made a google map mashup displaying polygons created from an xml
file.  I'm wanting the map to zoom into an individual polygon after
it's name is selected from a drop down menu.   I'm trying to use a
polygon's shape or center to do this and just can't figure out the
proper syntax do it.  See snippets of the script below or visit
(http://www.geology.ar.gov/test/quad24k_map.htm).  Thanks!

var quadArray = [];
 var q = 0;

function createPolygon(pts, html, latlng, color, name) {

      var quads = new google.maps.Polygon(
          {paths: pts,
             strokeColor: '#FFFFFF',
             strokeOpacity: 0.7,
             strokeWeight: 0.5,
             fillOpacity: 0.5,
             fillColor: color
             }
       );

      google.maps.event.addListener(quads, 'mouseover', function(event)
{

           if (infowindow) infowindow.close();
           infowindow = new google.maps.InfoWindow({content:
html});
           infowindow.setPosition(latlng);
           infowindow.open(map);

      });

      quads.setMap(map);

      document.forms['QuadSelect'].quadSel.options[q] = new
Option(name,q); //poplulates drop down menu

      //testing
      //quads.cPt = latlng;
      //quads.area = new google.maps.Polygon({paths: pts})
      //quadArray.push(quads[q])
      quadArray[q] = quads;
    q++;

  } //end createPolygon



 function selectQuadZoom(qNum){

      //var selectedQ =
viewQuad.options[viewQuad.selectedIndex].value;

               /      map.setCenter(new
google.maps.LatLng(quadArray[selectedQ].cPt));
//      map.setZoom(12);

      var qBounds = new google.maps.LatLngBounds();
      qBounds.extend(quadArray[qNum]);
      map.fitBounds(qBounds);
    //google.maps.event.trigger(quadArray[selectedQ], "click");
 }



<form name="QuadSelect">
    <select name="quadSel" id="quadSel"
onChange="selectQuadZoom(this.value)">
      <option value=""></Option>
    </select>
</form>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to