2009年12月29日火曜日

OpenLayers 42b WMSDescribeLayer - の WMS DescribeLayer の HTML コード

WMSDescribeLayerParser の HTML ファイルを作成します。

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

次のようにコードを修正します。

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers42 WMSDescribeLayer Parser</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="./lib/OpenLayers.js"></script>
<script type="text/javascript">
function parseData(req) {
format = new OpenLayers.Format.WMSDescribeLayer();
html = "<br />"
resp = format.read(req.responseText);
for(var i = 0; i < resp.length; i++) {
html += "Layer: typeName: "+ resp[i].typeName+",";
html += "<ul>";
html += "<li>owsURL: "+resp[i].owsURL+"</li>";
html += "<li>owsType: "+resp[i].owsType+"</li>";
html += "</ul>"
}
document.getElementById('output').innerHTML = html;
}
function load() {
OpenLayers.loadURL("tokyo_pf_pgis_wmsd.xml", "", null, parseData); // 修正
}
</script>
</head>

<!-- body 部分 -->

<body onload="load()">
<h1 id="title">WMSDescribeLayer Parser Example</h1>
<div id="tags"></div>
<p id="shortdesc">
Demonstrate the operation of the WMSDescribeLayer parser.
</p>
<div id="output"></div>
<div id="docs">
This script reads data from a file and parses out the coordinates, appending them to a HTML string with markup tags.
This markup is dumped to an element in the page.
</div>
</body>
</html>

tokyo_pf_pgis_wmsd.xml を Eclipse にインポートします。
1. メニューバーの ファイル -> インポート をクリック
2. 「選択」ウィンドウで 一般 -> ファイルシステム を選択し、「次へ」ボタンをクリック。
3. 「ファイル・システム」ウィンドウで、「次のディレクトリから」をダウンロードしたディレクトリ(今回は「ユーザディレクトリにしました。)、tokyo_pf_pgis_wmsd.gml をチェック、「宛先フォルダー」を「openlayersTokyoproj」にして「完了」ボタンをクリック。



tokyo_pf_pgis.map の WEB の Metadata と shinkansen レイヤの Metadata の wfs_title をコメントアウトしていますが、openlayers41_sld.html の layer1 (Shinkansen)は表示されます。

0 件のコメント: