Look at this page: http://gmaps-samples-v3.googlecode.com/svn/trunk/geocoder/v3-geocoder-tool.html
Enter a place to search for and look at the result returned from Google. I'm pretty sure that not all results contain a viewport bounds (but could be wrong!) so you'd have to test for it's presence and if present you can use that with the Map fitBounds() method to better pan and zoom your map. See the documentation: http://code.google.com/apis/maps/documentation/javascript/services.html#GeocodingResults Martin. On Aug 27, 5:19 pm, Jesus <jesus.delaga...@gmail.com> wrote: > Hello, > > Is it possible to define the zoom level of a map on an javascript > onclick link? > > What I'm trying to do with the zoom its to give individual zoom level > per place as, in some cases, smaller cities needs more zoom than big > cities. I hope this make this more clear. > > Different zoom level per onclick link and each onclick link will open > a new map. > > Here's what I currently have: > > var buceriasHTML = '<img src="images/rn-bucerias.jpg" height="80" > width="80" style="float: left; margin-right: 20px" / > > ><strong>Bucerias,<br />Nayarit</strong>'; > > <li><a onclick="findAddress('Bucerias, Nayarit, MX',buceriasHTML)" > style="color: #009; text-decoration: underline; > cursorointer">Bucerias, Nayarit</a></li> > > function findAddress(address, HTML) { > if (HTML === undefined) { > HTML = "<strong>" + address + "</strong>"; > } > markerHTML = HTML; > > var geocoder = new google.maps.Geocoder(); > geocoder.geocode( { 'address': address}, function(results, status) > { > if (status == google.maps.GeocoderStatus.OK) { > map.setCenter(results[0].geometry.location); > addressSet = 1; > startAddress = address; > searchCenter = results[0].geometry.location; > createMarker(searchCenter, 0, markerHTML, "pin"); > var trafficLayer = new google.maps.TrafficLayer(); > trafficLayer.setMap(map); > getCategories(0); > if (mapExtra === true) { > mapPost(); > } > > } else { > alert("Geocode was not successful for the following reason: " > + status); > } > }); > > } > > So, each onclick link will open a new map and I'm looking to insert a > proper default zoom level per link/map. Any ideas how can I do this? > > I was thinking on something like this: > <li><a onclick="findAddress('Bucerias, Nayarit, > MX',INSERTZOOMLEVELHERE,buceriasHTML)" style="color: #009; text- > decoration: underline; cursorointer">Bucerias, Nayarit</a></li> > > Here's a link to my page with the > map:http://www.mundoregio.com/puntosdeinteres/mapa-rivieranayarit.html > > You will see below the map on the right side a 5 links and I want to include > a zoom value to those links as this are very small towns so the map will > really work better if I can give a street zoom value to each of those links. > But I'll like to give a specific value per map so I can adjust it as need > it. > > Thanks in advance for your help! -- 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.