Thank you for the help. I assume I did this incorrectly since it's not 
zooming in when I search (longwood, fl, 5mi for example).
Here is my code:

function searchLocationsNear(center) {
     clearLocations(); 

     var radius = document.getElementById('radiusSelect').value;
     var searchUrl = 'phpsqlsearch_genxml.php?lat=' + center.lat() + 
'&lng=' + center.lng() + '&radius=' + radius;
     downloadUrl(searchUrl, function(data) {
       var xml = parseXml(data);
       var markerNodes = xml.documentElement.getElementsByTagName("marker");
       var bounds = new google.maps.LatLngBounds();
       
       sidebarInfo = ""; //this clears the list in the sidebar with each 
search
       var visibleMarkersCount=0; 
       if (markerNodes[0].getAttribute("street")=="No properties found"){
             map.setZoom(8);
        }
for (var i = 0; i < markerNodes.length; i++) { 
         var id = markerNodes[i].getAttribute("property_id");
         var city_id = markerNodes[i].getAttribute("city");
         var state_id = markerNodes[i].getAttribute("state");
         var country_id = markerNodes[i].getAttribute("country");
         var postal_code = markerNodes[i].getAttribute("postal_code");
         var address = markerNodes[i].getAttribute("street");
         var price = markerNodes[i].getAttribute("price");
         var bedrooms = markerNodes[i].getAttribute("bedrooms");
         var bathrooms = markerNodes[i].getAttribute("bathrooms");
         var category_id = markerNodes[i].getAttribute("type");
         var living_area = markerNodes[i].getAttribute("sqft");
         var lot_area = markerNodes[i].getAttribute("lotsqft");
         var listing_type_id = markerNodes[i].getAttribute("listing");
         var building_name = markerNodes[i].getAttribute("building_name");
         var distance = parseFloat(markerNodes[i].getAttribute("distance"));
         var googlemap_ltgooglemap_ln = new google.maps.LatLng(
              parseFloat(markerNodes[i].getAttribute("googlemap_lt")),
              parseFloat(markerNodes[i].getAttribute("googlemap_ln")));
         createOption(address, distance, i+1);
         createMarker(googlemap_ltgooglemap_ln, address, city_id, state_id, 
country_id, postal_code, price, bedrooms, bathrooms, category_id, 
living_area, lot_area, building_name, listing_type_id, id);
         bounds.extend(googlemap_ltgooglemap_ln);
        visibleMarkersCount++; 
       }
       switch(visibleMarkersCount){
        case 0:
        // no markers have been created
        // set map zoom and center accordingly - or just it leave it as it 
is
        map.setZoom(8);
        break;
        case 1:
        // a single marker has been created
        // center on the marker but set a zoom level that's not fully 
zoomed in
        map.setZoom(8);
        break;
        default:
        // two or more markers have been created
        // fit the map to the markers
        map.fitBounds(bounds);
} 
       map.fitBounds(bounds);
         //map.setZoom(8);
       /*locationSelect.style.visibility = "visible";
       locationSelect.onchange = function() {
         var markerNum = 
locationSelect.options[locationSelect.selectedIndex].value;
         google.maps.event.trigger(markers[markerNum], 'click');
       };*/
      });
    }

The commented out map.setZoom(8); (8 lines from the bottom) set the zoom of 
the map on search, but didn't zoom out when there were more than one 
properties (if that made sense).

What did I do wrong?
Thank you for the help.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/GvYSLm80dVoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to