| | 78 | Examples: |
| | 79 | {{{ |
| | 80 | var options = { scales: [50000000, 30000000, 10000000, 5000000] }; |
| | 81 | map = new OpenLayers.Map( $('map') , options); |
| | 82 | }}} |
| | 83 | |
| | 84 | {{{ |
| | 85 | var options = { resolutions: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125] }; |
| | 86 | map = new OpenLayers.Map( $('map') , options); |
| | 87 | }}} |
| | 88 | |
| | 89 | |
| | 90 | |
| | 106 | maxResolution: Converted from minScale using specified units |
| | 107 | numZoomLevels: Default from map |
| | 108 | {{{ |
| | 109 | var options = { minScale: 50000000, |
| | 110 | units: "degrees" |
| | 111 | }; |
| | 112 | map = new OpenLayers.Map( $('map') , options); |
| | 113 | }}} |
| | 114 | |
| | 115 | |
| | 116 | maxResolution: Calculated based on div size and default maxExtent from map |
| | 117 | numZoomLevels: Calculated using ratio of maxResolution/minResolution |
| | 118 | {{{ |
| | 119 | var options = { maxResolution: "auto", |
| | 120 | maxExtent: new OpenLayers.Bounds(-180, -90, 90, 180), |
| | 121 | minResolution: 0.0439453125 |
| | 122 | }; |
| | 123 | map = new OpenLayers.Map( $('map') , options); |
| | 124 | }}} |
| | 125 | |
| | 126 | maxResolution: Specified |
| | 127 | numZoomLevels: Specified |
| | 128 | {{{ |
| | 129 | var options = { maxResolution: 0.17578125, |
| | 130 | numZoomLevels: 15 |
| | 131 | }; |
| | 132 | map = new OpenLayers.Map( $('map') , options); |
| | 133 | }}} |
| | 134 | |
| | 135 | maxResolution: Default from map |
| | 136 | numZoomLevels: Converted maxScale (using default units from map) to minResolution, then uses ratio of maxResolution/minResolution to calculate numZoomLevels |
| | 137 | {{{ |
| | 138 | var options = { maxScale: 10000000 }; |
| | 139 | map = new OpenLayers.Map( $('map') , options); |
| | 140 | }}} |
| | 141 | |
| | 142 | maxResolution: Specified |
| | 143 | numZoomLevels: Calculated minResolution based on div size and default minExtent from map, then uses ratio of |
| | 144 | maxResolution/minResolution to calculate numZoomLevels |
| | 145 | {{{ |
| | 146 | var options = { maxResolution: 0.17578125, |
| | 147 | minResolution: "auto", |
| | 148 | minExtent: new OpenLayers.Bounds(-1, -1, 1, 1), |
| | 149 | }; |
| | 150 | map = new OpenLayers.Map( $('map') , options); |
| | 151 | }}} |