ラベル WMSDescribeLayer の投稿を表示しています。 すべての投稿を表示
ラベル WMSDescribeLayer の投稿を表示しています。 すべての投稿を表示

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)は表示されます。

2009年12月28日月曜日

OpenLayers 42a WMSDescribeLayer - MapServer の WMS DescribeLayer 設定

MapServer の WMS DescribeLayer は、WMS サーバ設定に WFS および WCS の設定の一部を追加することによって、WFS と WCS の機能を追加する WMS サーバのオプションです。
詳しくは、

MapServer, WMS Server
http://www.mapserver.org/ogc/wms_server.html#wms-server

の 「How does a WMS Work」を参照してください。

WCS (Web Coverage Service)は、レイヤタイプが Raster(ラスター)のための Web サービスです。
詳しくは、

MapServer, WCS Server
http://mapserver.org/ogc/wcs_server.html

を参照してください。

tokyo_pf_pgis.map を次のように修正します。

MAP
NAME tokyo_pf_pgis_map
---
WEB
IMAGEPATH "/home/user/ka-map/htdocs/tmp/kacache/"
IMAGEURL "/ka-map/tmp/kacache/"
METADATA
"wms_title" "Tokyo mlit Map WMS Server" # WMS サーバ設定
"wms_onlineresource" "http://192.168.1.6/cgi-bin/mapserv?map=/home/user/mapfile/tokyo_pf_pgis.map"
"wms_srs" "EPSG:2456 EPSG:4326"
# "wfs_title" "Tokyo mlit Map WFS Server" # WFS サーバ設定をコメントアウト
"wfs_onlineresource" "http://192.168.1.6/cgi-bin/mapserv?map=/home/user/mapfile/tokyo_pf_pgis.map" # 必須
"wcs_onlineresource" "http://192.168.1.6/cgi-bin/mapserv?map=/home/user/mapfile/tokyo_pf_pgis.map" # 追加(これはこのファイルには必要ないでしょう)
END
END

---

LAYER
NAME shinkansen
GROUP railroad
TYPE LINE
STATUS ON
DUMP TRUE # 必須
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=balanced"
DATA "the_geom from (select * from railroad2 where int = '1') as railroadquery using unique gid using srid = -1" #1
MINSCALEDENOM 1000 # 不適当な縮尺で使用されないように。
MAXSCALEDENOM 1000000 # (MINSCALE, MAXSCALE から置き換え。MapServer5より)
LABELITEM "lin"
METADATA
"group_title" "鉄道" # ka-Map の設定
"queryable" "true" #
"searchfield" "lin" #
"fields" "opc:運営会社,lin:路線名" # ここまで
"wms_title" "Shinkansen mlit WMS Layer" # 必須
# "wfs_title" "Shinkansen mlit WFS Layer" # コメントアウト
"gml_featureid" "gid" # 追加
"gml_include_items" "all" # 追加
END
---

次のコマンドで、shinkansen レイヤの WMS describeLayer の情報が得られます。

(Mapbender、Sld integration
http://www.mapbender.org/Sld_integration
の WMS-SLD Examples を参考にしました。)

user@debian:~$ wget -O tokyo_pf_pgis_wmsd.xml "http://localhost/cgi-bin/mapserv?map=/home/user/mapfile/tokyo_pf_pgis.map&service=WMS&version=1.1.1&request=describeLayer&layers=shinkansen"

tokyo_pf_pgis_wmsd.xml の内容

<?xml version='1.0' encoding="ISO-8859-1"?>
<!DOCTYPE WMS_DescribeLayerResponse SYSTEM "http://schemas.opengis.net/wms/1.1.1/WMS_DescribeLayerResponse.dtd">
<WMS_DescribeLayerResponse version="1.1.1" >
<LayerDescription name="shinkansen" wfs="http://192.168.1.6/cgi-bin/mapserv?map=/home/user/mapfile/tokyo_pf_pgis.map" owsType="WFS" owsURL="http://192.168.1.6/cgi-bin/mapserv?map=/home/user/mapfile/tokyo_pf_pgis.map">
<Query typeName="shinkansen" />
</LayerDescription>
</WMS_DescribeLayerResponse>

次のコマンドで、shinkansen レイヤの WFS describeFeatureType の情報が得られます。

user@debian:~$ wget -O tokyo_pf_pgis_wmsdft.xml "http://localhost/cgi-bin/mapserv?map=/home/user/mapfile/tokyo_pf_pgis.map&service=WFS&version=1.0.0&request=describeFeatureType&typename=shinkansen"

tokyo_pf_pgis_wmsdft.xml の内容

<?xml version='1.0' encoding="ISO-8859-1" ?>
<schema
targetNamespace="http://mapserver.gis.umn.edu/mapserver"
xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml"
elementFormDefault="qualified" version="0.1" >

<import namespace="http://www.opengis.net/gml"
schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd" />

<element name="shinkansen"
type="ms:shinkansenType"
substitutionGroup="gml:_Feature" />

<complexType name="shinkansenType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element name="msGeometry" type="gml:GeometryPropertyType" minOccurs="0" maxOccurs="1"/>
<element name="gid" type="string"/>
<element name="rac" type="string"/>
<element name="int" type="string"/>
<element name="lin" type="string"/>
<element name="opc" type="string"/>
</sequence>
</extension>
</complexContent>
</complexType>

</schema>