How to set the map zoom level in Openlayers

Source: Internet
Author: User

From: http://www.cnblogs.com/sailheart/archive/2011/03/15/1984519.html

I. Overview

In Openlayers, the map must have a range of zoom levels, which can be represented by scale or resolution (resolution).

Scale--How many map coordinate units are represented by 1 meters on the screen; resolution--How many map coordinate units a pixel on the screen represents.
The conversion relationship between the two is: Scale = Resolution * 72 * 39.3701 (1 meters = 39.3701 inches, 1 inches = 72 pixels)

The map has a total zoom level, each layer can have its own zoom level, which controls that the layer is displayed only at the appropriate level.

Second, the zoom level range of Determination Method 1, scale array or resolution array to determine (adjacent two levels are not necessarily twice times the relationship, can be any value). Example: Resolutions: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125]
Scales: [50000000, 30000000, 10000000, 5000000]

2, with the maximum resolution (maxresolution) and the total number of zoom level (Numzoomlevels) determined that the adjacent two levels is twice times the relationship 2.1 maximum resolution method:

A. Specify the maxresolution directly, for example:

maxresolution:0.17578125

B. Direct designation of Minscale, e.g.:

minscale:50000000

C. Determined by Maxextent (Maxresolution need to be set to ' auto '), e.g.:

Maxextent:new Openlayers.bounds (-180,-90, 180, 90),
Maxresolution: How to determine the total number of zoom levels for "Auto" 2.2:

A. Specify the numzoomlevels directly, for example: Numzoomlevels:5
B. Determined by the ratio of the maximum resolution to the minimum resolution, the minimum resolution of the same 2.1 has three ways to determine:

B.1 Direct Designation Minresolution
B.2 Direct Designation Maxscale
B.3 determined by minextent (Minresolution need to be set to ' auto ')

If too many parameters are specified, resulting in inconsistent zoom level ranges, the above method order determines the priority openlayers determines the zoom level range.

How to set the map zoom level in Openlayers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.