2009年11月28日土曜日

OpenLayers 33b OpenLayers.Layer Properties の Resolutions について

Class Documents より

OpenLayers.Layer
Properties
resolutions {Array}
A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, maxScale, etc.).

地図の解像度(1ピクセルあたりの地図単位)の降順のリストです。このレイヤコンストラクタで設定されていないと、他の関連するプロパティ(maxExtent、maxResolution、maxScaleなど)の解像度に基づいて設定されます。


地図を拡大縮小すれば分かりますが、設定した resolutions でだけ表示されます。
minResolution を設定したときは、これ以下の解像度では表示されません。
maxResolution を設定したときは、これ以上の解像度では表示されません。

この地図では、南北方向の範囲は 1104000-1054000=50000m です。
解像度は、50000m/250pixsel=195.3125 となります。
(実際には、Firebug -> DOM -> layer1 の maxResolution 195.3125 から逆算しました。)


OpenLayers の Spherical Mercator の First Map
http://docs.openlayers.org/library/spherical_mercator.html#first-map

に次のような文章がありました。

This map has a set of assumptions about the maxResolution of the map. Specifically, most spherical mercator maps use an extent of the world from -180 to 180 longitude, and from -85.0511 to 85.0511 latitude. Because the mercator projection stretches to infinity as you approach the poles, a cutoff in the north-south direction is required, and this particular cutoff results in a perfect square of projected meters. As you can see from the maxExtent parameter sent in the constructor of the layer, the coordinates stretch from -20037508.34 to 20037508.34 in each direction.

The maxResolution of the map defaults to fitting this extent into 256 pixels, resulting in a maxResolution of 156543.0339. This is handled internally by the layer, and does not need to be set in the layer options.

この地図は、マップのmaxResolutionについての仮定を設定しています。具体的には、ほとんどの球状のメルカトル図法の地図は、-180から180の経度、-85.0511から85.0511の緯度の世界の範囲を使用しています。メートル投影は、極点に近づくほど無限大に延びます、南北方向に切り取りが必要です、この特定のカットオフは、投影されたメータの完全な平面になります。このようにレイヤのコンストラクタで送信されたmaxExtentパラメータからわかるように、座標はそれぞれの方向に-20037508.34から20037508.34に延ばされます。

地図の maxResolution は、256ピクセル(私の意見ですが、tile[タイル]の一辺だと思います)にこの範囲内に合わせるため初期化します、結果として 156543.0339 の maxResolution になります。これは、レイヤによって内部で処理されて、レイヤのオプションを設定する必要はありません。

0 件のコメント: