Posted by halhx on May 14, 2010 at 7:17pm
By default, there are 18 zoom levels. I'm wondering if anyone has got experience with limiting the number of zoom level to a smaller number (e.g. 8) ?
I searched around and found that there are ways to control the maximum zoom level and the minimum zoom level in google map documentation page: http://code.google.com/apis/maps/documentation/reference.html
but can't figure out how to control these from drupal.
--halhx
Comments
Hey - I bet you'll get more
Hey - I bet you'll get more help if you cross-post to the Mapping group http://groups.drupal.org/mapping ;-) There's also a #drupal-geo channel on IRC if you want to try and get some real-time help (it's not super active, but there's usually a few people in there).
Assuming you're using the
Assuming you're using the gmap module all you can really do is set the initial zoom level and then the type of zoom control (ie none, micro, small, large).
Looking at the google maps API there doesn't look to be any way to limit the number of zoom levels, but you can control the zoom using setZoom (http://code.google.com/apis/maps/documentation/reference.html#GMap2.setZoom). With that in mind, you can decide to not show the default zoom control via the gmap module and then create your own that works directly with the google maps API to do whatever zoom limiting you require.
No offence but I don't agree
No offence but I don't agree with your conclusion that there isn't a way to control the # of zoom level.
Search for, maxResolution, the doc says:
Sets the maximum zoom level of this map type, returned by GMapType.getMaximumResolution(). Default is the maximum of all tile layers.
I think these are the params i want to set, i just don't know how if drupal gmap module expose the necessary function.
You can set the maximum and
You can set the maximum and minimum resolutions via the Google Maps API, but your question was about the number of zoom levels, which the API doesn't directly address.
That said, if you find a solution, please post it.
maxzoom
In the DOM you can find : Drupal.settings.gmap.(map_id).maxzoom
Is that what you're looking for?
Here is how you do it...
Open the gmap.module file. Search for the string "zoom" and change its value to whatever you want and you'll be fine!
I think this change must be made in a couple of places in that file...
I worked out what need to be done
HI All,
I'm the one who posted the question in the first place, and I got it working now. The code below need to be called before calling theme function to draw the map
$maxresolution = 15;
$minresolution = 9;
$setmapzoomlimit = "
G_PHYSICAL_MAP.getMinimumResolution = function () { return $minresolution };
G_NORMAL_MAP.getMinimumResolution = function () { return $minresolution };
G_SATELLITE_MAP.getMinimumResolution = function () { return $minresolution };
G_HYBRID_MAP.getMinimumResolution = function () { return $minresolution};
G_PHYSICAL_MAP.getMaximumResolution = function () { return $maxresolution };
G_NORMAL_MAP.getMaximumResolution = function () { return $maxresolution };
G_SATELLITE_MAP.getMaximumResolution = function () { return $maxresolution };
G_HYBRID_MAP.getMaximumResolution = function () { return $maxresolution };";
drupal_add_js($setmapzoomlimit, 'inline');
Gmap provides 18 levels of zoom, and $maxresolution, $minresolution can take any values between 0-17, min < max of course. I like the fact that no hacking of gmap module is required. BTW, you can see the map in action here:
http://www.juump.com/explore-cck?searchbox=san%20diego&lng=-117.1572551&...