[OpenLayers-Users] zoom level problem

Jan H. van der Ven j.vanderven at magion.nl
Fri Mar 4 11:37:21 EST 2011


Dear maxx,

As a workaround you may try:
     var layer = new OpenLayers.Layer.Google( "Google layer", 
{'sphericalMercator':true, MIN_ZOOM_LEVEL:1, MAX_ZOOM_LEVEL:16});

You can of course also use a higher level for MIN_ZOOM_LEVEL.

Kind regards,


Jan


On 4-3-2011 17:12, emmexx wrote:
> I have an apparently simple problem that I can't solve.
>
> A map with google terrain, satellite, osm and other "map" layers.
> A vector layer.
> I'm trying to zoom to a feature (a line) in order to display it to its
> max extent on the map.
> Now, let's suppose that the line is very short. If I try to use:
> map.zoomToExtent(bounds) when the Google Terrain baselayer is selected,
> the zoom level for the feature is greater than the max zoom level for
> the baselayer. And instead of the google map I get the google "message"
> "we're sorry, we don't have maps for this zoom level..."
>
> I tried the following code to no avail:
> var featzoom = map.getZoomForExtent(bounds);
> var blzoom = map.getNumZoomLevels();
> map.zoomTo((blzoom<=featzoom) ? blzoom : featzoom);
>
> I get blzoom = 20, featzoom = 16.
>
> Any help will be appreciated.
>
> thank you
> 	maxx
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: j_vanderven.vcf
Type: text/x-vcard
Size: 274 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110304/ed9c18fc/j_vanderven.vcf


More information about the Users mailing list