Google Maps Markerclusterer - Manually Set Zoom Level - google-maps

I use Google Maps Markerclusterer and normally it works great. The problem I am having is when only 1 marker is being displayed (due to users choosing options resulting in 1 marker) the clusterer is setting the zoom level all the way in to the closest level.
Is there any way I can manually set my zoom level and still use the clusterer? I found the MaxZoomLevel feature but that doesn't actually control the zoom. Trying to set the zoom manually at initiate did not work either.
Thanks!

Related

Setting perfect zoom level for a Place with Google API

In my Google Maps app the user can search for a place (using Autocomplete) and the map will be re-centered upon it with map.setCenter(pos);.
This does not change zoom level though, that must be done manually with map.setZoom(x).
In Google's map, zoom automatically readjusts to perfectly show the place's boundaries, how can I replicate that behavior?
The duplicate #woelliJ found almost worked, but ended up using an old version of the API. It led me on the right track though, and I ended up finding how to make it work with the new API - map.fitBounds(autocomplete.getPlace().geometry.viewport);

Google maps: Same positioned clustered markers disappear on zoom

I'm currently using the MarkerClusterer v3 library in my app to group markers inside a Google map instance.
I've found that when I have 2 markers on the same exact coordinates, the clusterer displays a group of 2 markers correctly, but when clicking on the cluster to zoom into the 2 individual markers, no markers appear. Zooming back out re-paints the "2 marker" cluster.
I'm using the default Google Maps API, adding markers to the clusterer individually inside a loop. When I disable the clusterer I can zoom into the 2 markers properly.
Any thoughts on why this may be happening?
Finally found the answer:
Marker Clusterer accepts a parameter maxZoom that controls the maximum zoom to display clusters. If this value is too high (in my case higher than the possible zoom in that area) it won't display the markers properly.
Playing around with this parameter allows for fine-tuned cluster behaviour, as you zoom into your markers.

On my Google Maps when I zoom out beyond level 10 all my markers disappear

My google maps work fine at a zoom level higher than 10, but if I zoom out my markers disappear. I cant see where the error is. Have tried using v3 and v2. Also changing from .png markers to .gif. Have tried with fewer points on the map.
Its the same problem across all the browsers.
Thanks for helping...
http://test.onionring.co.uk/map-towns.asp?region=Cheshire
Nick
This is your problem (the marker manager is doing what you are telling it to do):
manager.addMarkers(batch, 11);
According to the documentation, 11 is the minimum zoom (the first zoom at which the marker will appear).
addMarker(marker:Marker, minZoom:Number, opt_maxZoom:Number)

Setting map bounds

I have a map which I would like to stay within certain bounds. I have allowed for 2 zoom levels 5 and 8. On zoom level 5 I was able to keep the map from moving by setting the center of the map to adjust by using the setCenter() function on the event of a drag. When I am zoomed in at zoom level 8 I would like to prevent users from dragging the map outside designated limits. The limits are the bounds at zoom level 5. I have tried a few things but with no avail. When I used fitbounds() it kicked me back to zoom level 5. I basically just want to limit how far you can go on the map. Any help would be appreciated.
G
There is a method posted here http://econym.org.uk/gmap/range.htm that works with v2 of the Google Maps API. The technique should work with v3 as well. View source on the example page.
Also see the duplicate question here for refinements on the above method: Google Maps API V3: limit map bounds

Google Maps default zoom level

I created a public map using my Google Map. I want to set a default zoom level, but it is not saved. Is this possible?
Also, is it possible to change the list of place markers?
the reference map that you supply (quebec summer festival) is called by the URL: http://maps.google.com/maps/ms?source=embed&hl=en&geocode=&ie=UTF8&msa=0&msid=112492115201367239282.0004609e0fcc239c4f792&ll=46.81084,-71.217113&spn=0.02056,0.038624&z=15
notice that the last parameter "&z=15" defines the zoom level (in the embed map code, "&z=15" becomes "& a m p ; z = 1 5" [remove spaces between letters]). if you change this you can increase or decrease the zoom level. if you suppress the zoom level, googlemaps will automatically calculate a zoom level when displaying said map. NORMALLY this leaves some of your map outside the frame.
so, just by supplying the URL with the desired zoomlevel you have solved your problem. this works very well with static maps. if you have a dynamically generated map (from a database, for example), the fastest solution is to put 2 markers (top left and bottom right corners) slightly outside your boundary box. this will force automatic zoom in the desired amount (hopefully).
Not using API just made a map points using my GMail account and made it public, like the following site:
http://maps.google.com/maps/ms?source=embed&hl=en&geocode=&ie=UTF8&msa=0&msid=112492115201367239282.0004609e0fcc239c4f792&ll=46.81084,-71.217113&spn=0.02056,0.038624&z=15
Nothing is saved by a web page. HTML browsing is stateless. If you want to save some information you will need to use similar trick as any other web applications. E.g. putting it in cookie and the setting the zoom level using the information in the cookie when you initial the page.