Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As per the title, is there a way to increase the maximum zoom of maps in openlayers? I'm finding the google sat maps are not able to zoom in to the degree they can in the gmap module. I had a look at the Maximum Resolution setting on the preset options, but can't really fathom how this applies to maximum zoom. I'll experiment some more, but I figured it might be useful to others if someone could document their knowledge of this issue.
Comment | File | Size | Author |
---|---|---|---|
#20 | openlayers-goog_zoomlevel_max-7x-563470-20.patch | 715 bytes | jeffschuler |
#19 | ol-goog_zoomlevel-563470-19.patch | 576 bytes | jeffschuler |
Comments
Comment #1
phayes CreditAttribution: phayes commentedThere is no current way of doing this. This will require a patch.
There needs to be another option in the map array for min and max zoom. I'm tagging this as a 2.0 feature request.
Comment #2
phayes CreditAttribution: phayes commentedComment #3
zzolo CreditAttribution: zzolo commentedComment #4
tmcw CreditAttribution: tmcw commentedThis is patched in 2.x. Works by letting maps define their own resolutions array, and then array.slice()ing that array into the required zoom levels, and reducing numZoomLevels to let all controls become aware of the new range. On commercial layers, minZoomLevel and maxZoomLevel are set.
Comment #5
looplog CreditAttribution: looplog commentedgreat thanks, I'll check it out when I have a chance
Comment #7
Sinan Erdem CreditAttribution: Sinan Erdem commentedIs there a possible way to hardcode a maximum zoom-in level for Google maps in 1.x version? Virtual Earth maps currently have more zoom-in levels than Google maps.
Comment #8
tmcw CreditAttribution: tmcw commentedYou mean hardcode a maximum for Virtual Earth? Google Maps won't have more zoom levels if you just set OpenLayers to look for more. Also google layers seem to have more zoom levels than virtual earth by default?
Comment #9
Sinan Erdem CreditAttribution: Sinan Erdem commentedIf you have time, please check the map on this link: http://sofra.bilimternet.com/deneme
I generate this map with Views. I don't see any setting that I can set the max. zoom level for that map. When you play with available layers, you can see that Virtual Earth Hybrid map can zoom more than Google Hybrid map.
I want to make sure that users can zoom up to level 19 zoom on Gmaps... Right now, by default, it is at most 14 or 15 I think...
(Using OpenLayers 6.x-1.0-beta4)
Comment #10
tmcw CreditAttribution: tmcw commentedHey etcetera9, could you open a ticket for that problem in OpenLayers 6.1? This ticket is for the 2.x implementation, and that's somewhat dealt with. Also, that page looks pretty broken because of the Virtual Earth layer, and Google Maps is just going to give you blank tiles if you request zoom levels that it hasn't rendered yet?
Comment #11
Sinan Erdem CreditAttribution: Sinan Erdem commentedOf course, thank you...
Comment #12
tmcw CreditAttribution: tmcw commentedPer-layer zoom levels were added to the TMS layer type in 321258. I decided to go with a pure-PHP approach to this, just basically supporting 900913 serverResolutions in the layer type and then restricting resolutions in the per-layer settings. Note that this is a little weird as far as maps go, because zoomLevels is actually an index in this array: if you have zooms 0-13 and then knock off the first three, then zoomTo(0) starts going to 3 rather than 0. This is barely reasonable behavior from OpenLayers's perspective, but we'll have to deal with it for now. I'm going to add it to the other layer types in order, because this isn't going to be easy to do for everything - especially with the way that projections affect the code. Next up is OSM, because it's pretty much the same technique as TMS.
Comment #13
tmcw CreditAttribution: tmcw commentedper-layer zoom levels have been added to all layers for which they'll be immediately useful. There may be some more to add, and you can follow the pattern of TMS, OSM, etc.
Comment #15
narongwit12 CreditAttribution: narongwit12 commentedI have experienced this issue as well, and it is stil in 2 version too. When i switch to OSM, it can zoom into very detail of map but when i switch to google map, I can only zoom to certain extent. How can I make google map to have a max zoom like OSM do?
Best regards
Narongwit
Comment #16
narongwit12 CreditAttribution: narongwit12 commentedNarongwit
Comment #17
ejohnson CreditAttribution: ejohnson commentedRe: #15 Did you find a fix for this, that you could share? Thanks.
Comment #18
tmcw CreditAttribution: tmcw commentedGoogle Maps has a variable actual level of zoom depth. The mapping library isn't generating the tiles - if it zoomed in further, you'd just see blank tiles.
Comment #19
jeffschulerI ran into the default numZoomLevels=15 being too limiting, too.
Cloning the default Google road maps layer and increasing "Number of Zoom Levels" to, say, 21 works well to fix this.
I find, though, (with 7.x-2.x-dev,) that setting the numZoomLevels to a really high number (I tried 300) doesn't have any ill effects -- OL seems to limit how far I can zoom to some sensible maximum... I don't have the ability to zoom too far and get blank tiles.
So, I wonder if it would be sensible to raise the default numZoomLevels from 15?
Patch for 6.x-2.x-dev attached.
Comment #20
jeffschulerre-rolled for 7.x-2.x-dev
Comment #21
cesareaugusto CreditAttribution: cesareaugusto commentedWill this patch merged into the main 7.x dev release?
Comment #22
PolThis patch fix the problem.
@cesareaugusto: Help us to reduce the issues here and we'll release a new version.
Comment #23
PolThanks, committed.
http://drupalcode.org/project/openlayers.git/commit/b1e2921