Ticket #2429 (closed feature: fixed)

Opened 3 years ago

Last modified 3 years ago

Change maximum zoom for Google layers

Reported by: Turban Owned by:
Priority: minor Milestone: 2.9 Release
Component: general Version: 2.8
Keywords: Cc:
State: Complete

Description

OpenLayers.Layer.Google is currently restricted to 20 zoom levels (0-19), while Google Maps API supports at least 22 zoom levels ( http://googlegeodevelopers.blogspot.com/2009/06/how-low-can-you-go-introducing.html). Let people use them.

Se previous patch:  http://trac.openlayers.org/ticket/613  http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/Google.js

Attachments

2429.0.patch Download (1.1 KB) - added by fredj 3 years ago.
define 22 zoom level for the google map layer

Change History

Changed 3 years ago by ahocevar

  • state set to Awaiting User Feedback

Have you tried to configure your Google layer with a

numZoomLevels: 22

option? This works as far as I know. Please close the ticket as invalid if you can confirm that it does.

Changed 3 years ago by Turban

Yes, I've tried, but numZoomLevels > 20 has no effect.

Changed 3 years ago by fredj

It's because OpenLayers.Layer.Google.prototype.RESOLUTIONS.length == 20.

We should add more resolutions to the list

Changed 3 years ago by fredj

Something like:

Index: Layer/Google.js
===================================================================
--- Layer/Google.js	(revision 9954)
+++ Layer/Google.js	(working copy)
@@ -32,7 +32,7 @@
      * Constant: MAX_ZOOM_LEVEL
      * {Integer} 19
      */
-    MAX_ZOOM_LEVEL: 19,
+    MAX_ZOOM_LEVEL: 21,
 
     /** 
      * Constant: RESOLUTIONS
@@ -59,7 +59,9 @@
         0.00002145767211914062, 
         0.00001072883605957031,
         0.00000536441802978515, 
-        0.00000268220901489257
+        0.00000268220901489257,
+        0.0000013411045074462891,
+        0.00000067055225372314453
     ],
 
     /**

Changed 3 years ago by fredj

define 22 zoom level for the google map layer

Changed 3 years ago by fredj

  • state changed from Awaiting User Feedback to Review

Please review, tests pass.

To see data at this zoom level, open examples/google.html and type in console:

map.layers[3].setVisibility(true); 
map.setCenter(new OpenLayers.LonLat(-122.08409272134, 37.422055053884), 21)

Changed 3 years ago by bartvde

  • state changed from Review to Commit

Looks good fredj, although the Firebug statements did not get me to level 21, I had to manually zoom in. Please commit.

Changed 3 years ago by fredj

You're right, should be:

map.setBaseLayer(map.layers[3]);
map.setCenter(new OpenLayers.LonLat(-122.08409272134, 37.422055053884), 21);

Changed 3 years ago by fredj

  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [10031]) add 2 fixed resolutions to the Google layer. r=bartvde (closes #2429)

Note: See TracTickets for help on using tickets.