Developing OGC Compliant Web Applications with GeoExt の
2.1. Creating a Grid View of WMS Capabilities(http://workshops.boundlessgeo.com/geoext/stores/capabilities.html)を参考に WMS レイヤ一覧を Grid で表示します。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
最初、GeServer の WMS レイヤのリストが表示されませんでした。
store: new GeoExt.data.WMSCapabilitiesStore({
の url に
"http://192.168.1.200:8080/geoserver/wms?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1&TILED=true"
など、試しましたが表示されなかったので、Web ブラウザのアドレスバーに上記アドレスを入力して、ダウンロードしたファイルを読み込みました。
---
// ここから追加
items.push({
xtype: "grid",
ref: "capsGrid", // makes the grid available as app.capsGrid
title: "Available Layers",
region: "north",
height: 150,
viewConfig: {forceFit: true},
store: new GeoExt.data.WMSCapabilitiesStore({
url: "getcapabilities_1.1.1.xml", 下記の url では表示できませんでした // url: "/geoserver/wms?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1&TILED=true", // url: "http://192.168.1.200:8080/geoserver/wms?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1&TILED=true",
autoLoad: true }),
columns: [
{header: "Name", dataIndex: "name", sortable: true},
{header: "Title", dataIndex: "title", sortable: true},
{header: "Abstract", dataIndex: "abstract"}
],
bbar: [{
text: "Add to Map",
handler: function() {
app.capsGrid.getSelectionModel().each(function(record) {
var clone = record.clone();
clone.getLayer().mergeNewParams({
format: "image/png",
transparent: true
});
app.mapPanel.layers.add(clone);
app.mapPanel.map.zoomToExtent(
OpenLayers.Bounds.fromArray(clone.get("llbbox"))
);
});
}
}]
});
// ここまで</script>
---
レイヤを追加すると倍率が変わってしまいました。
(元の倍率に戻すボタン{地球儀?}をクリックします。)
akiruno_kidou レイヤを追加



0 件のコメント:
コメントを投稿