OpenLayers中的最小/最大缩放级别 [英] Min/max zoom level in OpenLayers

查看:2881
本文介绍了OpenLayers中的最小/最大缩放级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OpenLayers在网页中显示地图。我正在使用来自CloudMade的磁贴,但OpenStreetMap中的Mapnik磁贴出现了同样的问题。

I'm using OpenLayers to display a map in a web page. I am using tiles from CloudMade, but the same issues occur with the Mapnik tiles from OpenStreetMap.

我正在尝试限制地图,以便用户无法放大所有走向世界观 - 我希望他们大致保持在城市一级放大。

I'm trying to restrict the map so that the user cannot zoom all the way out to world view -- I want them to stay at roughly a city level zoom at minimum.

我尝试过使用 minZoomLevel / maxZoomLevel / numZoomLevels properties;只有 maxZoomLevel numZoomLevels 属性似乎有效,而 minZoomLevel 属性似乎完全被忽略。

I have tried using the minZoomLevel / maxZoomLevel / numZoomLevels properties; only the maxZoomLevel and numZoomLevels properties seem to work, whereas the minZoomLevel property seems to be completely ignored.

还有另一种方法可以实现这个目标吗?

Is there another way to accomplish this?

推荐答案

XYZ图层不支持minZoomLevel,其中OSM是子类。

minZoomLevel is not supported for XYZ layers, of which OSM is a subclass.

请参阅以下门票获取解决方法:

See the following tickets for workarounds:

  • http://trac.osgeo.org/openlayers/ticket/2909 (apply a zoom offset)
  • http://trac.osgeo.org/openlayers/ticket/2189 (add minZoomLevel patch)

这篇关于OpenLayers中的最小/最大缩放级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆