On Apr 24, 7:49 am, "[email protected]"
<[email protected]> wrote:
> I have come across a slight issue. I don't know why, but if a zip code
> is searched in which we do not have any locations near by, the map
> ends up in the middle of the ocean.

you need to test if no markers are returned and then center the map to
the zip code, maybe with a fixed zoom:

if (markerNodes.length == 0) {
  map.setCenter(center);
  map.setZoom(11);
} else {
  var bounds = new google.maps.LatLngBounds();
  for (var i = 0; i < markerNodes.length; i++) {
  ...
  ...
  map.fitBounds(bounds);
}

-- 
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 [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