2009年12月10日木曜日

OpenLayers 40d WMC - OpenLayers で Map Context を試す1 Map Cntext ドキュメントの出力

OpenLayers.Format.WMC は、WMC ドキュメントの読み書きに使用します。

HTML ファイルを新規作成します。
「openlayersTokyoproj」 を右クリックして 新規 -> HTML ファイル をクリック。
「HTML ファイル」ウィンドウの「ファイル名(任意:openlayers_wmc.html)」に入力して「完了」ボタンをクリック。
「charset」を「utf-8」にします。
「examples」の「wmc.html」の内容をコピーして新規作成したファイルに貼り付けます。

map と layer 部分を次のように修正して、「write」ボタンをクリックすると WMC ドキュメントを表示します。

---
function init() {
var options = {
projection: new OpenLayers.Projection("EPSG:2456"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
maxResolution: 183.593750,
units: 'meters',
maxExtent: new OpenLayers.Bounds(-279000,1054000,-185000,1104000)
};
map = new OpenLayers.Map("map", options);

layer1 = new OpenLayers.Layer.WMS( "Tokyo Height WMS",
"http://192.168.1.6/cgi-bin/mapserv?",
{
map: '/home/user/mapfile/tokyo_bmi_pgis_img.map',
layers: 'height',
format: 'image/png'
});
layer2 = new OpenLayers.Layer.WMS( "Tokyo Kukaku Sen WMS",
"http://192.168.1.6/cgi-bin/mapserv?",
{
map: '/home/user/mapfile/tokyo_bmi_pgis_img2.map',
layers: 'kukaku',
transparent: true,
format: 'image/png'
});
layer3 = new OpenLayers.Layer.WMS( "Tokyo Gyoseikai mlit WMS",
"http://192.168.1.6/cgi-bin/mapserv?",
{
map: '/home/user/mapfile/tokyo_pf_pgis.map',
layers: 'gyoseikai',
transparent: true,
format: 'image/png'
});
map.addLayers([layer1, layer2, layer3]);
---

出力した WMC ドキュメント

<ViewContext xmlns="http://www.opengis.net/context" version="1.1.0" id="OpenLayers_Context_188" xsi:schemaLocation="http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<General>
<Window width="512" height="256"/>
<BoundingBox minx="-279000.0000" miny="1055500.000" maxx="-185000.0000" maxy="1102500.000" SRS="EPSG:2456"/>
<Title/>
<Extension>
<ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-279000.0000" miny="1054000.000" maxx="-185000.0000" maxy="1104000.000"/>
</Extension>
</General>
<LayerList>
<Layer queryable="0" hidden="0">
<Server service="OGC:WMS" version="1.1.1">
<OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.1.6/cgi-bin/mapserv?"/>
</Server>
<Name>height</Name>
<Title>Tokyo Height WMS</Title>
<FormatList>
<Format current="1">image/png</Format>
</FormatList>
<StyleList>
<Style current="1">
<Name/>
<Title>Default</Title>
</Style>
</StyleList>
<Extension>
<ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-279000.0000" miny="1054000.000" maxx="-185000.0000" maxy="1104000.000"/>
<ol:numZoomLevels xmlns:ol="http://openlayers.org/context">16</ol:numZoomLevels>
<ol:units xmlns:ol="http://openlayers.org/context">m</ol:units>
<ol:isBaseLayer xmlns:ol="http://openlayers.org/context">true</ol:isBaseLayer>
<ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">true</ol:displayInLayerSwitcher>
<ol:singleTile xmlns:ol="http://openlayers.org/context">false</ol:singleTile>
</Extension>
</Layer>


<Layer queryable="0" hidden="0">
<Server service="OGC:WMS" version="1.1.1">
<OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.1.6/cgi-bin/mapserv?"/>
</Server>
<Name>kukaku</Name>
<Title>Tokyo Kukaku Sen WMS</Title>
<FormatList>
<Format current="1">image/png</Format>
</FormatList>
<StyleList>
<Style current="1">
<Name/>
<Title>Default</Title>
</Style>
</StyleList>
<Extension>
<ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-279000.0000" miny="1054000.000" maxx="-185000.0000" maxy="1104000.000"/>
<ol:transparent xmlns:ol="http://openlayers.org/context">true</ol:transparent>
<ol:numZoomLevels xmlns:ol="http://openlayers.org/context">16</ol:numZoomLevels>
<ol:units xmlns:ol="http://openlayers.org/context">m</ol:units>
<ol:isBaseLayer xmlns:ol="http://openlayers.org/context">false</ol:isBaseLayer>
<ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">true</ol:displayInLayerSwitcher>
<ol:singleTile xmlns:ol="http://openlayers.org/context">false</ol:singleTile>
</Extension>
</Layer>


<Layer queryable="0" hidden="0">
<Server service="OGC:WMS" version="1.1.1">
<OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://192.168.1.6/cgi-bin/mapserv?"/>
</Server>
<Name>gyoseikai</Name>
<Title>Tokyo Gyoseikai mlit WMS</Title>
<FormatList>
<Format current="1">image/png</Format>
</FormatList>
<StyleList>
<Style current="1">
<Name/>
<Title>Default</Title>
</Style>
</StyleList>
<Extension>
<ol:maxExtent xmlns:ol="http://openlayers.org/context" minx="-279000.0000" miny="1054000.000" maxx="-185000.0000" maxy="1104000.000"/>
<ol:transparent xmlns:ol="http://openlayers.org/context">true</ol:transparent>
<ol:numZoomLevels xmlns:ol="http://openlayers.org/context">16</ol:numZoomLevels>
<ol:units xmlns:ol="http://openlayers.org/context">m</ol:units>
<ol:isBaseLayer xmlns:ol="http://openlayers.org/context">false</ol:isBaseLayer>
<ol:displayInLayerSwitcher xmlns:ol="http://openlayers.org/context">true</ol:displayInLayerSwitcher>
<ol:singleTile xmlns:ol="http://openlayers.org/context">false</ol:singleTile>
</Extension>
</Layer>
</LayerList>
</ViewContext>

0 件のコメント: