2 - 準備
2-1 ダウンロード
a GeoExt 3 — JavaScript Toolkit for Rich Web Mapping Applications
https://geoext.github.io/geoext3/
の右上の「code」、または、「About GeoExt」の本文中の「checkout the code.」をクリックします。
b geoext/geoext3・GitHub
https://github.com/geoext/geoext3
の右側の 「Download ZIP」をクリックしてダウンロードします。
バージョンはそれぞれ、
OpenLayers3 v3.6.0
ExtJS v6.0.0.beta
です。
c ダウンロードしたファイルを展開します。
user@deb8-vmw:~$ cd ダウンロード
user@deb8-vmw:~/ダウンロード$ ls
---
geoext3-master.zip
---
user@deb8-vmw:~/ダウンロード$ unzip geoext3-master.zip
user@deb8-vmw:~/ダウンロード$ ls
---
geoext3-master
geoext3-master.zip
---
2-2 NetBeans にインポート
1 NetBeans を起動します。
2 メイン・メニューで「ファイル」→「新規プロジェクト」([Ctrl]-[Shift]-[N]を選択して新規プロジェクト・ウィザードを開きます。
3 HTML5カテゴリを選択し、「HTML5アプリケーション」を選択します。「次」をクリックします。
4 「新規 HTML5アプリケーション」で「プロジェクト名」に「geoext3proj」と入力し、「プロジェクトの場所」右側の「参照」ボタンをクリックします。
5 「プロジェクトの場所を選択」で /home/user/public_html を指定し「OK」ボタンをクリックします。
6 「新規 HTML5アプリケーション」で「次>」ボタンをクリックします。
7 「サイト・テンプレート」では、「サイト・テンプレートなし」を選択します。
「次>」ボタンをクリックします。
8 「JavaScriptファイル」では、「使用可能」ペインで仮に prototype(エラーが表示されたときは他のものでもOK) JavaScriptライブラリを選択し、右矢印アイコン( > )をクリックして、選択したライブラリをウィザードの「選択済」ペインに移動し、「終了」ボタンをクリックします。
9 展開したフォルダをサイトルートにコピーします。
user@deb8-vmw:~/ダウンロード$ cp -r geoext3-master ../public_html/geoext3proj/public_html/js/libs/
2016年2月15日月曜日
GeoExt3-dev 1 - はじめに
1 はじめに
GeoExt3 は、まだ、正式にリリースされていません。
GeoExt3 — JavaScript Toolkit for Rich Web Mapping Applications
https://geoext.github.io/geoext3/
に、次のように書かれています。
GeoExt is Open Source and enables building desktop-like GIS applications through the web. It is a JavaScript framework that combines the GIS functionality of OpenLayers with the user interface of the ExtJS library provided by Sencha.
GeoExt はオープンソースであり、web 経由でデスクトップのような GIS アプリケーションの構築を可能にします。これは、OpenLayers のGIS機能と Sencha が提供する ExtJS ライブラリのユーザーインターフェイスを組み合わせた JavaScript フレームワークです。
Version 3 of GeoExt is the successor to the GeoExt 2-series and is built atop the newest official installments of it's base libraries; OpenLayers 3.6 and ExtJS 6.0.0.beta.
GeoExt のバージョン 3 は、GeoExt2 シリーズの後継であり、それのベースライブラリの最新の公式インストールメント(取り付け)、OpenLayers 3.6 と ExtJS 6.0.0.beta、の上に構築されています。
Geoext 3 is not released yet, and we are actively developing it. Right now it is neither feature complete, nor fully tested. Everybody is invited to help us create the next version of GeoExt.
Geoext 3 はまだ(正式に)リリースされていませんが、積極的に開発しています。今のところ、機能は完全でなく、また、完全にテストされていません。誰もが、私たちの GeoExt の次のバージョンの作成を支援するために招待されています。
「About GeoExt」には、次のように説明があります。
Since version 3, GeoExt is based upon the newest beta of Ext JS 6.
バージョン3 以来、GeoExt は Ext JS6 の最新のベータ版に基づいています。
This means GeoExt can be used just like any other Ext component, and applications making use of GeoExt also profit from Ext JS enhancements like charting, a harmonized API with Sencha Touch and a sophisticated single-file build tool.
これは GeoExt は、他の Ext コンポーネントと同様に使用できることを意味し、GeoExt を使用するアプリケーションも、グラフ化のような Ext JS の拡張機能や Sencha タッチで洗練された調和のとれたAPI、単一ファイルのビルドツールからも利益を得ます。
GeoExt 3 is a very young project, a lot of the code and structural decisions come from a code sprint in Bonn. 9 developers gathered there from 2015-06-17 to 2015-06-19. We are deeply grateful that our sponsors helped to start GeoExt 3.
GeoExt3 は非常に若いプロジェクトで、たくさんのコードとボンのコードスプリントからなる構造決定があります。 9人の開発者は、2015年6月17日から2015年6月19日にそこに集まりました。私たちは、スポンサーがGeoExt3を開始するために役立っていることを深く感謝しています。
Now, have a look at the examples below, read the API documentation, the API documentation (including ExtJS classes) or checkout the code.
さて、以下の例を見て、APIドキュメント、(ExtJSのクラスを含む)のAPIドキュメントを読み、または、コードをチェックアウトしてください。
ライセンスは、次のようにあります。
Code licensed under the GPL-3-license. All documentation CC BY 3.0.
GPL-3-license の下で許可されたコード。 すべてのドキュメントは、CC BY 3.0。
The GeoExt library is for use with the ExtJS library. ExtJS is distributed under the terms of the GPL v3. See the ExtJS license page for details on Ext JS licensing.
GeoExt ライブラリは ExtJS のライブラリをと共に使用します。 ExtJS は、GPL v3 の条件の下で配布されています。ExtJS ライセンスの詳細については、ExtJS のライセンスページを参照してください。
(訳者注: ExtJS は、作成した JavaScript コードを公開する場合は無料で使用できます。非公開にする場合は費用を払う必要があります。)
続いて GeoExt3 を準備します。
GeoExt3 は、まだ、正式にリリースされていません。
GeoExt3 — JavaScript Toolkit for Rich Web Mapping Applications
https://geoext.github.io/geoext3/
に、次のように書かれています。
GeoExt is Open Source and enables building desktop-like GIS applications through the web. It is a JavaScript framework that combines the GIS functionality of OpenLayers with the user interface of the ExtJS library provided by Sencha.
GeoExt はオープンソースであり、web 経由でデスクトップのような GIS アプリケーションの構築を可能にします。これは、OpenLayers のGIS機能と Sencha が提供する ExtJS ライブラリのユーザーインターフェイスを組み合わせた JavaScript フレームワークです。
Version 3 of GeoExt is the successor to the GeoExt 2-series and is built atop the newest official installments of it's base libraries; OpenLayers 3.6 and ExtJS 6.0.0.beta.
GeoExt のバージョン 3 は、GeoExt2 シリーズの後継であり、それのベースライブラリの最新の公式インストールメント(取り付け)、OpenLayers 3.6 と ExtJS 6.0.0.beta、の上に構築されています。
Geoext 3 is not released yet, and we are actively developing it. Right now it is neither feature complete, nor fully tested. Everybody is invited to help us create the next version of GeoExt.
Geoext 3 はまだ(正式に)リリースされていませんが、積極的に開発しています。今のところ、機能は完全でなく、また、完全にテストされていません。誰もが、私たちの GeoExt の次のバージョンの作成を支援するために招待されています。
「About GeoExt」には、次のように説明があります。
Since version 3, GeoExt is based upon the newest beta of Ext JS 6.
バージョン3 以来、GeoExt は Ext JS6 の最新のベータ版に基づいています。
This means GeoExt can be used just like any other Ext component, and applications making use of GeoExt also profit from Ext JS enhancements like charting, a harmonized API with Sencha Touch and a sophisticated single-file build tool.
これは GeoExt は、他の Ext コンポーネントと同様に使用できることを意味し、GeoExt を使用するアプリケーションも、グラフ化のような Ext JS の拡張機能や Sencha タッチで洗練された調和のとれたAPI、単一ファイルのビルドツールからも利益を得ます。
GeoExt 3 is a very young project, a lot of the code and structural decisions come from a code sprint in Bonn. 9 developers gathered there from 2015-06-17 to 2015-06-19. We are deeply grateful that our sponsors helped to start GeoExt 3.
GeoExt3 は非常に若いプロジェクトで、たくさんのコードとボンのコードスプリントからなる構造決定があります。 9人の開発者は、2015年6月17日から2015年6月19日にそこに集まりました。私たちは、スポンサーがGeoExt3を開始するために役立っていることを深く感謝しています。
Now, have a look at the examples below, read the API documentation, the API documentation (including ExtJS classes) or checkout the code.
さて、以下の例を見て、APIドキュメント、(ExtJSのクラスを含む)のAPIドキュメントを読み、または、コードをチェックアウトしてください。
ライセンスは、次のようにあります。
Code licensed under the GPL-3-license. All documentation CC BY 3.0.
GPL-3-license の下で許可されたコード。 すべてのドキュメントは、CC BY 3.0。
The GeoExt library is for use with the ExtJS library. ExtJS is distributed under the terms of the GPL v3. See the ExtJS license page for details on Ext JS licensing.
GeoExt ライブラリは ExtJS のライブラリをと共に使用します。 ExtJS は、GPL v3 の条件の下で配布されています。ExtJS ライセンスの詳細については、ExtJS のライセンスページを参照してください。
(訳者注: ExtJS は、作成した JavaScript コードを公開する場合は無料で使用できます。非公開にする場合は費用を払う必要があります。)
続いて GeoExt3 を準備します。
2014年3月9日日曜日
38 - 外部サービスを利用する 5 - 地理院タイル
38-5 地理院タイル(東日本大震災被災地震災直後オルソ画像、災害復興計画基図)
「地理院タイルを用いた開発(http://portal.cyberjapan.jp/help/development.html)」に「地理院タイル仕様」と「地理院タイル一覧」がります。このうちの「東日本大震災被災地震災直後オルソ画像(2011年3月~2011年4月撮影)」と「災害復興計画基図」を使ってみます。「OpenLayers Basic ESRI Map Cache Example(xyz-esri.html)」を参考に 地理院タイルを陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
38-1 Google Map で使用した「ol018-nippon_bmi_takata_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。
b 「ファイルを開く」ウィンドウで、「OpenLayers-2.13.1」->「examples」->「xyz-esri.html」をクリックして選択し、「OK」ボタンをクリックします。
c 次のように「xyz-esri.html」の内容の一部をコピーして「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
d 上記サイトを表示します。
e 次のように内容の一部をコピーして、「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
参考 HTML
ol018tile-nippon_bmi_takata_pgis.html
「地理院タイルを用いた開発(http://portal.cyberjapan.jp/help/development.html)」に「地理院タイル仕様」と「地理院タイル一覧」がります。このうちの「東日本大震災被災地震災直後オルソ画像(2011年3月~2011年4月撮影)」と「災害復興計画基図」を使ってみます。「OpenLayers Basic ESRI Map Cache Example(xyz-esri.html)」を参考に 地理院タイルを陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
38-1 Google Map で使用した「ol018-nippon_bmi_takata_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。
b 「ファイルを開く」ウィンドウで、「OpenLayers-2.13.1」->「examples」->「xyz-esri.html」をクリックして選択し、「OK」ボタンをクリックします。
c 次のように「xyz-esri.html」の内容の一部をコピーして「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
d 上記サイトを表示します。
e 次のように内容の一部をコピーして、「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
<style type="text/css">
/*
.olControlAttribution {
bottom: 0px;
left: 2px;
right: inherit;
width: 400px;
}
*/
/* マウスポジションを上部に設置 */
.olControlMousePosition {
top: 0px;
}
.olImageLoadError {
/* when OL encounters a 404, don't display the pink image */
display: none !important;
}
</style>
---
layers: [
// ここから追加(Google Map レイヤは削除)
new OpenLayers.Layer.XYZ("震災直後オルソ画像",
"http://cyberjapandata.gsi.go.jp/xyz/toho1/${z}/${x}/${y}.jpg",
{
sphericalMercator: true,
attribution: "<a href='http://portal.cyberjapan.jp/help/termsofuse.html' target='_blank'>国土地理院</a>"
},{
isBaselayer: false
}),
new OpenLayers.Layer.XYZ("災害復興計画基図",
"http://cyberjapandata.gsi.go.jp/xyz/fukkokizu/${z}/${x}/${y}.png",
{
sphericalMercator: true,
attribution: "<a href='http://portal.cyberjapan.jp/help/termsofuse.html' target='_blank'>国土地理院</a>"
},{
isBaselayer: false
}),
// ここまで
/*
new OpenLayers.Layer.WMS( "R.Takata Height WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata5m-epsg2452'
},{
isBaselayer: true
}),
*/
---参考 HTML
ol018tile-nippon_bmi_takata_pgis.html
38 - 外部サービスを利用する 4 - 地理院地図(電子国土Web)
38-4 地理院地図(電子国土Web)
地理院地図(電子国土Web) は、「地理院タイル利用規約(http://portal.cyberjapan.jp/help/termsofuse.html)」にしたがって提供されています。
「OpenLayers サイトサンプル集(http://portal.cyberjapan.jp/portalsite/sample/index.html)」に、API関数の説明があります。
「OpenLayers サンプル集(http://portal.cyberjapan.jp/portalsite/version/v4/samples.html)」には、基本的な地図の表示コードがあります。
デフォルトデータセット
「デフォルトデータセット(地図)を表示する(http://portal.cyberjapan.jp/portalsite/version/v4/v4samples/default.html)」と「OpenLayers Spherical Mercator Example(http://openlayers.org/dev/examples/spherical-mercator.html)」(example フォルダにもありました。)を参考に 地理院地図(電子国土Web) を陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
38-1 Google Map で使用した「ol018-nippon_bmi_takata_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a 上記サイトを右クリックしてソースを表示します。
b 次のように内容の一部をコピーして、「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
地理院地図(電子国土Web) は、「地理院タイル利用規約(http://portal.cyberjapan.jp/help/termsofuse.html)」にしたがって提供されています。
「OpenLayers サイトサンプル集(http://portal.cyberjapan.jp/portalsite/sample/index.html)」に、API関数の説明があります。
「OpenLayers サンプル集(http://portal.cyberjapan.jp/portalsite/version/v4/samples.html)」には、基本的な地図の表示コードがあります。
デフォルトデータセット
「デフォルトデータセット(地図)を表示する(http://portal.cyberjapan.jp/portalsite/version/v4/v4samples/default.html)」と「OpenLayers Spherical Mercator Example(http://openlayers.org/dev/examples/spherical-mercator.html)」(example フォルダにもありました。)を参考に 地理院地図(電子国土Web) を陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
38-1 Google Map で使用した「ol018-nippon_bmi_takata_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a 上記サイトを右クリックしてソースを表示します。
b 次のように内容の一部をコピーして、「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
<!-- 追加 --> <!-- 問題があったときはコメントを外して、OpenLayers-2.13.1 をコメントアウトしてください <script type="text/javascript" src="http://portal.cyberjapan.jp/sys/OpenLayers-2.11/OpenLayers.js" charset="UTF-8"></script> --> <link rel="stylesheet" href="http://portal.cyberjapan.jp/sys/v4/css/webtis.css" type="text/css"> <script type="text/javascript" src="http://portal.cyberjapan.jp/sys/v4/webtis/webtis_v4.js" charset="UTF-8"></script>
<style type="text/css">
/*
.olControlAttribution {
bottom: 0px;
left: 2px;
right: inherit;
width: 400px;
}
*/
/* マウスポジションを上部に設置 */
.olControlMousePosition {
top: 0px;
}
</style>
---layers: [
// ここから追加(Google Map レイヤは削除)
new webtis.Layer.BaseMap("webtismap"),
// ここまで
/*
new OpenLayers.Layer.WMS( "R.Takata Height WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata5m-epsg2452'
},{
isBaselayer: true
}),
*/
---38 - 外部サービスを利用する 3 - Open Street Map
38-3 Open Street Map
Open Street Map は、クリエーティブコモンズライセンスにしたがって提供されています。クリエーティブコモンズライセンスについては、「cretive commons 表示 - 継承 3.0 非移植 (CC BY-SA 3.0)(https://creativecommons.org/licenses/by-sa/3.0/deed.ja)」を参照してください。使用者は、使用した資料のクレジットの明示と、改変した場合はそれを明示すればフリーに使えます。
OpenLayers の Development Examples の「Basic OSM Example(http://openlayers.org/dev/examples/osm.html)」と「OpenLayers Spherical Mercator Example(http://openlayers.org/dev/examples/spherical-mercator.html)」(両方とも example フォルダにもありました。)を参考に Open Street Map を陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
前前章、38-1 Google Map で使用した「ol018-nippon_bmi_takata_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a 上記サイトを右クリックしてソースを表示します。
b 次のように内容の一部をコピーして、「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
Open Street Map は、クリエーティブコモンズライセンスにしたがって提供されています。クリエーティブコモンズライセンスについては、「cretive commons 表示 - 継承 3.0 非移植 (CC BY-SA 3.0)(https://creativecommons.org/licenses/by-sa/3.0/deed.ja)」を参照してください。使用者は、使用した資料のクレジットの明示と、改変した場合はそれを明示すればフリーに使えます。
OpenLayers の Development Examples の「Basic OSM Example(http://openlayers.org/dev/examples/osm.html)」と「OpenLayers Spherical Mercator Example(http://openlayers.org/dev/examples/spherical-mercator.html)」(両方とも example フォルダにもありました。)を参考に Open Street Map を陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
前前章、38-1 Google Map で使用した「ol018-nippon_bmi_takata_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a 上記サイトを右クリックしてソースを表示します。
b 次のように内容の一部をコピーして、「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
<style type="text/css">
/*
.olControlAttribution {
bottom: 0px;
left: 2px;
right: inherit;
width: 400px;
}
*/
/* マウスポジションを上部に設置 */
.olControlMousePosition {
top: 0px;
}
</style>
---layers: [ // ここから追加 (Google Map レイヤは削除) new OpenLayers.Layer.OSM(
{
isBaselayer: true
}),
// ここまで
/*
new OpenLayers.Layer.WMS( "R.Takata Height WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata5m-epsg2452'
},{
isBaselayer: true
}),
*/
---38 - 外部サービスを利用する 2 - Microsoft 地図 Bing Map
38-2 Microsoft 地図 Bing Map
Bing Map は、Bing Map API により、無料のウェッブサイトに表示できる無料のサービスです。商用ウェッブサイトで使用するときは、有償ライセンスが必要です。詳しくは「Bing Maps Licensing Options」(http://www.microsoft.com/maps/Licensing/licensing.aspx)ページをみてください。「Help Me Decide」で
「Who will be using this application?」
-> Consumers (for the general public)
「What is your application type?」
-> My application is a Public Website for Education or Non-Profit organizations.
「Next steps to license」
-> Bing Maps account
と進んでアカウントを取得します。
社内(組織内)だけで使用する場合などは、問い合わせてください。
OpenLayers の Development Examples の「Bing Example(http://openlayers.org/dev/examples/bing.html)」と「OpenLayers Spherical Mercator Example(http://openlayers.org/dev/examples/spherical-mercator.html)」(両方とも example フォルダにもありました。)を参考に Bing Map を陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
前章、38-1 Google Map で使用した「ol018-nippon_bmi_takata_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a 上記サイトを右クリックしてソースを表示します。
b 次のように内容の一部をコピーして、「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
Bing Map は、Bing Map API により、無料のウェッブサイトに表示できる無料のサービスです。商用ウェッブサイトで使用するときは、有償ライセンスが必要です。詳しくは「Bing Maps Licensing Options」(http://www.microsoft.com/maps/Licensing/licensing.aspx)ページをみてください。「Help Me Decide」で
「Who will be using this application?」
-> Consumers (for the general public)
「What is your application type?」
-> My application is a Public Website for Education or Non-Profit organizations.
「Next steps to license」
-> Bing Maps account
と進んでアカウントを取得します。
社内(組織内)だけで使用する場合などは、問い合わせてください。
OpenLayers の Development Examples の「Bing Example(http://openlayers.org/dev/examples/bing.html)」と「OpenLayers Spherical Mercator Example(http://openlayers.org/dev/examples/spherical-mercator.html)」(両方とも example フォルダにもありました。)を参考に Bing Map を陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
前章、38-1 Google Map で使用した「ol018-nippon_bmi_takata_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a 上記サイトを右クリックしてソースを表示します。
b 次のように内容の一部をコピーして、「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
<style type="text/css">
/*
.olControlAttribution {
bottom: 0px;
left: 2px;
right: inherit;
width: 400px;
}
*/
/* マウスポジションを上部に設置 */
.olControlMousePosition {
top: 0px;
}
</style>
---
var epsg2452 = new OpenLayers.Projection("EPSG:2452");
var epsg900913 = new OpenLayers.Projection("EPSG:900913");
//var bounds = new OpenLayers.Bounds(55900,-118000,77500,-98100);
var bounds = new OpenLayers.Bounds(50000,-118000,77500,-98100);
var epsg900913bounds = bounds.transform(epsg2452, epsg900913);
// create Bing layers // API key for http://openlayers.org. Please get your own at // http://bingmapsportal.com/ and use that instead. var apiKey = "At8z******"; //追加---
layers: [
// ここから追加(Google Map レイヤは削除)
new OpenLayers.Layer.Bing({
key: apiKey,
type: "Road",
wrapDateLine: true
},{
isBaselayer: false
}),
new OpenLayers.Layer.Bing({
key: apiKey,
type: "Aerial",
wrapDateLine: true
},{
isBaselayer: false
}),
new OpenLayers.Layer.Bing({
key: apiKey,
type: "AerialWithLabels",
wrapDateLine: true
},{
isBaselayer: false
}),
// ここまで
/*
new OpenLayers.Layer.WMS( "R.Takata Height WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata5m-epsg2452'
},{
isBaselayer: true
}),
*/
new OpenLayers.Layer.WMS( "Iwate Kuiki WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:iwate_kuiki',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
---38 - 外部サービスを利用する 1 - Google Map
38-1 Google Map
Google Map は、Google Map API により、無料のウェッブサイトに表示できる無料のサービスです。有料ウェッブサイトや社内使用するときは、Google Map API for Business の有償ライセンスが必要です。非営利団体が無償で Google Map API for Business のライセンスを受けられる場合もあるようです。詳しくは「Google Maps API のライセンス」(https://developers.google.com/maps/licensing?hl=ja)ページをみてください。
(API キーがなくても Google Map API の機能は使えるようです。)
「Google (v3) Layer Example(google-v3.html)」を参考に Google Map を陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
「ol018-nippon_bmi_akiruno_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。
b 「ファイルを開く」ウィンドウで、「OpenLayers-2.13.1」->「examples」->「google-v3.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「google-v3.js」を開きます。
c 次のように「google-v3.html」の内容の一部をコピーして「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
iwate_kuiki レイヤのタイル表示がおかしいので、マップの表示範囲を修正します。
---
API キーがないと拡大表示に制限があるようです。
Google Map は、Google Map API により、無料のウェッブサイトに表示できる無料のサービスです。有料ウェッブサイトや社内使用するときは、Google Map API for Business の有償ライセンスが必要です。非営利団体が無償で Google Map API for Business のライセンスを受けられる場合もあるようです。詳しくは「Google Maps API のライセンス」(https://developers.google.com/maps/licensing?hl=ja)ページをみてください。
(API キーがなくても Google Map API の機能は使えるようです。)
「Google (v3) Layer Example(google-v3.html)」を参考に Google Map を陸前高田市の地図に重ねてみます。
OpenLayers 「Spherical Mercator(http://docs.openlayers.org/library/spherical_mercator.html)」も参考にしました。
「ol018-nippon_bmi_akiruno_pgis.html」を続けて使います。
(他の地図サービスを試すときはコピーして使ってください。)
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。
b 「ファイルを開く」ウィンドウで、「OpenLayers-2.13.1」->「examples」->「google-v3.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「google-v3.js」を開きます。
c 次のように「google-v3.html」の内容の一部をコピーして「ol018-nippon_bmi_takata_pgis.html」に貼り付け、修正します。
---
<title>WMS Example Rikuzen Takata PGIS2</title> <!-- 追加 --> <script src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script> <script src="OpenLayers-2.13.1/lib/OpenLayers.js"></script>---
<!-- 追加 -->
<style type="text/css">
.olControlAttribution {
bottom: 0px;
left: 2px;
right: inherit;
width: 400px;
}
/* conditionally position control differently for Google Maps */
.olForeignContainer div.olControlMousePosition {
bottom: 28px;
}
</style>
---
<script type="text/javascript"> OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; Ext.BLANK_IMAGE_URL = "ext-3.4.1/resources/images/default/s.gif"; var app, items = [], controls = [];
// ここから追加
var epsg2452 = new OpenLayers.Projection("EPSG:2452");
var epsg900913 = new OpenLayers.Projection("EPSG:900913");
var bounds = new OpenLayers.Bounds(55900,-118000,77500,-98100);
var epsg900913bounds = bounds.transform(epsg2452, epsg900913);
// ここまで
Ext.onReady(function() {
app = new Ext.Viewport({
layout: "border",
items: items
});
});
items.push({
xtype: "gx_mappanel",
ref: "mapPanel",
region: "center",
map: {
controls: controls,
// projection: new OpenLayers.Projection("EPSG:2452"),
projection: epsg900913,
displayProjection: new OpenLayers.Projection("EPSG:4326"),
// maxResolution: 'auto',
maxResolution: 156543.0339,
units: 'meters',
// maxExtent: new OpenLayers.Bounds(55900,-118000,77500,-98100)
maxExtent: epsg900913bounds,
restrictedExtent: epsg900913bounds.clone()
},
/* extent: OpenLayers.Bounds.fromArray([ -122.911, 42.291, -122.787,42.398 ]), */
extent: epsg900913bounds,
/*
layers: [new OpenLayers.Layer.WMS(
"Medford",
"/geoserver/wms",
{layers: "medford"},
{isBaseLayer: false}
)]
*/
layers: [
// ここから追加
new OpenLayers.Layer.Google(
"Google Physical",
{
type: google.maps.MapTypeId.TERRAIN,
sphericalMercator: true
},{
isBaselayer: false
}),
new OpenLayers.Layer.Google(
"Google Streets", // the default
{
// numZoomLevels: 20
sphericalMercator: true
},{
isBaselayer: false
}),
new OpenLayers.Layer.Google(
"Google Hybrid",
{
type: google.maps.MapTypeId.HYBRID, //numZoomLevels: 20
sphericalMercator: true
},{
isBaselayer: false
}),
new OpenLayers.Layer.Google(
"Google Satellite",
{
type: google.maps.MapTypeId.SATELLITE, //numZoomLevels: 22
sphericalMercator: true
},{
isBaselayer: false
}),
// ここまで
/*
new OpenLayers.Layer.WMS( "R.Takata Height WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata5m-epsg2452'
},{
isBaselayer: true
}),
*/
new OpenLayers.Layer.WMS( "Iwate Kuiki WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:iwate_kuiki',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
---iwate_kuiki レイヤのタイル表示がおかしいので、マップの表示範囲を修正します。
---
// var bounds = new OpenLayers.Bounds(55900,-118000,77500,-98100); var bounds = new OpenLayers.Bounds(50000,-118000,77500,-98100); ---
API キーがないと拡大表示に制限があるようです。
2014年3月3日月曜日
37 - 陸前高田市の地図の表示 9 - 陸前高田市の地図の表示
37-9 陸前高田市の地図の表示
「36 - GeoEXT を使用した WFS-T」で使用した HTML コードを参考に陸前高田市の地図を表示します。
「ol017bonus-nippon_bmi_akiruno_pgis.html」をコピーして使います。
a 「App Exploler」ペインの「ol017bonus-nippon_bmi_akiruno_pgis.html」を右クリックし「コピー」をクリックします。
b 「App Exploler」ペイン上で右クリックし「貼り付け」をクリックします。
c 「名前の競合」ウィンドウで「ol018-nippon_bmi_takata_pgis.html」と入力し「OK」ボタンをクリックします。
Proj4JS の EPSG2452.js の定義ファイルを追加します。
マップの projection と maxExtent を修正します。
GeoServer の rikuzentakata_kukakusen レイヤのデータ
Min X: 55999.999987
Min Y: -117,971.375
Max X: 77,583.9140625
Max Y: -98138.759978
から、
---
---
// ここから修正
---
---
参考 HTML ファイル
ol018-nippon_bmi_takata_pgis.html
「36 - GeoEXT を使用した WFS-T」で使用した HTML コードを参考に陸前高田市の地図を表示します。
「ol017bonus-nippon_bmi_akiruno_pgis.html」をコピーして使います。
a 「App Exploler」ペインの「ol017bonus-nippon_bmi_akiruno_pgis.html」を右クリックし「コピー」をクリックします。
b 「App Exploler」ペイン上で右クリックし「貼り付け」をクリックします。
c 「名前の競合」ウィンドウで「ol018-nippon_bmi_takata_pgis.html」と入力し「OK」ボタンをクリックします。
Proj4JS の EPSG2452.js の定義ファイルを追加します。
--- <!-- Title を "Rikuzen Takata" に修正 --> <title>WMS Example Rikuzen Takata PGIS2</title> <script src="OpenLayers-2.13.1/lib/OpenLayers.js"></script> <script src="OpenLayers-2.13.1/lib/proj4js/lib/proj4js.js"></script> <script src="OpenLayers-2.13.1/lib/proj4js/lib/proj4js-combined.js"></script> <!-- <script src="OpenLayers-2.13.1/lib/proj4js/lib/proj4js-compressed.js"></script> <script src="OpenLayers-2.13.1/lib/proj4js/lib/defs/EPSG2451.js"></script> --> <script src="OpenLayers-2.13.1/lib/proj4js/lib/defs/EPSG2452.js"></script> ---
マップの projection と maxExtent を修正します。
GeoServer の rikuzentakata_kukakusen レイヤのデータ
Min X: 55999.999987
Min Y: -117,971.375
Max X: 77,583.9140625
Max Y: -98138.759978
から、
---
items.push({
xtype: "gx_mappanel",
ref: "mapPanel",
region: "center",
map: {
controls: controls,
projection: new OpenLayers.Projection("EPSG:2452"), // 修正
displayProjection: new OpenLayers.Projection("EPSG:4326"),
maxResolution: 'auto',
units: 'meters',
maxExtent: new OpenLayers.Bounds(55900,-118000,77500,-98100) // 修正
},
---
// ここから修正
layers: [
new OpenLayers.Layer.WMS( "R.Takata Height WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata5m-epsg2452'
},{
isBaselayer: true
}),
new OpenLayers.Layer.WMS( "Iwate Kuiki WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:iwate_kuiki',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Kukakusen WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_kukakusen',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Choaza WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_choaza',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Kaigan WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_kaigan',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Suigai WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_suigai',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Suiiki WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_suiiki',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Suikozo WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_suikozo',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Doro WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_doro',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Dorokozo WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_dorokozo',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Kido WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_kido',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "R.Takata Kenchiku WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:rikuzentakata_kenchiku',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "Iwate Public Facilities WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:iwate_pf',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
})
]
});
// ここまで---
items.push({
xtype: "editorgrid",
ref: "featureGrid",
title: "Feature Table",
region: "south",
height: 150,
sm: new GeoExt.grid.FeatureSelectionModel(),
store: new GeoExt.data.FeatureStore({
fields: [
{name: "fid", type: "int"},
{name: "id", type: "string"},
{name: "term", type: "string"},
{name: "address", type: "string"},
{name: "category1", type: "string"},
{name: "category2", type: "string"},
{name: "category3", type: "string"},
{name: "createdate", type: "string"},
{name: "lastupdate", type: "string"}
],
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.WFS({
url: "/geoserver/ows",
version: "1.1.0",
featureType: "riuzentakata_polygon", // 修正
featureNS: "http://www.myhome.net/npn",
srsName: "EPSG:2452", // 修正
geometryName: "the_geom",
schema: "http://192.168.1.200/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=npn:riuzentakata_polygon" // 修正
})
}),
autoLoad: true
}),
---
参考 HTML ファイル
ol018-nippon_bmi_takata_pgis.html
2014年2月20日木曜日
36 - GeoEXT を使用した WFS-T 12 - 選択したレイヤの編集 3
36-12-3 選択したレイヤのフィーチャと属性の編集
選択したレイヤのフィーチャの作成(draw)と編集(modify, delete)と、属性の編集ができるようにします。
3.2. Editing Features and Their Attributes(http://workshops.boundlessgeo.com/geoext/wfs/editing.html)の「Bonus Task」を参考に、一部を修正します。
---
</script>
---
選択したレイヤのフィーチャの作成(draw)と編集(modify, delete)と、属性の編集ができるようにします。
3.2. Editing Features and Their Attributes(http://workshops.boundlessgeo.com/geoext/wfs/editing.html)の「Bonus Task」を参考に、一部を修正します。
---
function reconfigure(store, url) {
var fields = [], columns = [], geometryName, geometryType;
// regular expression to detect the geometry column
var geomRegex = /gml:(Multi)?(Point|Line|Polygon|Surface|Geometry).*/;
// mapping of xml schema data types to Ext JS data types
var types = {
"xsd:int": "int",
"xsd:short": "int",
"xsd:long": "int",
"xsd:string": "string",
"xsd:dateTime": "string",
"xsd:double": "float",
"xsd:decimal": "float",
"Line": "Path",
"Surface": "Polygon"
};
store.each(function(rec) {
var type = rec.get("type");
var name = rec.get("name");
var match = geomRegex.exec(type);
if (match) {
// we found the geometry column
geometryName = name;
// Geometry type for the sketch handler:
// match[2] is "Point", "Line", "Polygon", "Surface" or "Geometry"
geometryType = types[match[2]] || match[2]; // 追加
} else {
// we have an attribute column
fields.push({
name: name,
type: types[type]
});
columns.push({
xtype: types[type] == "string" ?
"gridcolumn" :
"numbercolumn",
dataIndex: name,
header: name,
// ここから追加
// textfield editor for strings, numberfield for others
editor: {
xtype: types[type] == "string" ?
"textfield" :
"numberfield"
}
// ここまで
});
}
});
app.featureGrid.reconfigure(new GeoExt.data.FeatureStore({
autoLoad: true,
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.WFS({
url: url,
version: "1.1.0",
featureType: rawAttributeData.featureTypes[0].typeName,
featureNS: rawAttributeData.targetNamespace,
// srsName: "EPSG:4326",
srsName: "EPSG:2451",
geometryName: geometryName,
maxFeatures: 250
})
}),
fields: fields
}), new Ext.grid.ColumnModel(columns)); app.featureGrid.store.bind(vectorLayer); app.featureGrid.getSelectionModel().bind(vectorLayer); // ここから追加 // Set the correct sketch handler according to the geometryType drawControl.handler = new OpenLayers.Handler[geometryType]( drawControl, drawControl.callbacks, drawControl.handlerOptions ); // ここまで }
function setLayer(model, node) {
if(!node || node.layer instanceof OpenLayers.Layer.Vector) {
return;
}
vectorLayer.removeAllFeatures();
app.featureGrid.reconfigure(
new Ext.data.Store(),
new Ext.grid.ColumnModel([])
);
var layer = node.layer;
var url = layer.url.split("?")[0]; // the base url without params
var schema = new GeoExt.data.AttributeStore({
url: url,
// request specific params
baseParams: {
"SERVICE": "WFS",
"REQUEST": "DescribeFeatureType",
"VERSION": "1.1.0",
"TYPENAME": layer.params.LAYERS
},
autoLoad: true,
listeners: {
"load": function(store) {
app.featureGrid.setTitle(layer.name);
reconfigure(store, url);
}
}
});
}
Ext.onReady(function() {
app.tree.getSelectionModel().on(
"selectionchange", setLayer
);
});
</script>
---
参考 HTML ファイル
36 - GeoEXT を使用した WFS-T 12 - 選択したレイヤの編集 2
36-12-2 選択したレイヤの属性の表示
3.1. Creating a Synchronized Grid and Map View of WFS Features(http://workshops.boundlessgeo.com/geoext/wfs/grid.html)の「Bonus Task」をコピーして貼り付け、一部を修正します。
---
---
レイヤの属性の中で、「name」が表示されません。コード中に使用されている「name」に影響されているのかもしれません。属性の「name」を「term」に変更したら表示されるようになりました。
GeoServer で akiruno_polygon akiruno_line akiruno_point レイヤの「Feature Type Details」を確認します。表示されないときは「Reload feature type」をクリックします。
3.1. Creating a Synchronized Grid and Map View of WFS Features(http://workshops.boundlessgeo.com/geoext/wfs/grid.html)の「Bonus Task」をコピーして貼り付け、一部を修正します。
---
// ここから追加
var rawAttributeData;
var read = OpenLayers.Format.WFSDescribeFeatureType.prototype.read;
OpenLayers.Format.WFSDescribeFeatureType.prototype.read = function() {
rawAttributeData = read.apply(this, arguments);
return rawAttributeData;
};
function reconfigure(store, url) {
var fields = [], columns = [], geometryName, geometryType;
// regular expression to detect the geometry column
var geomRegex = /gml:(Multi)?(Point|Line|Polygon|Surface|Geometry).*/;
var types = {
// mapping of xml schema data types to Ext JS data types
"xsd:int": "int",
"xsd:short": "int",
"xsd:long": "int",
"xsd:string": "string",
"xsd:dateTime": "string",
"xsd:double": "float",
"xsd:decimal": "float",
// mapping of geometry types
"Line": "Path",
"Surface": "Polygon"
};
store.each(function(rec) {
var type = rec.get("type");
var name = rec.get("name");
var match = geomRegex.exec(type);
if (match) {
// we found the geometry column
geometryName = name;
} else {
// we have an attribute column
fields.push({
name: name,
type: types[type]
});
columns.push({
xtype: types[type] == "string" ?
"gridcolumn" :
"numbercolumn",
dataIndex: name,
header: name
});
}
});
app.featureGrid.reconfigure(new GeoExt.data.FeatureStore({
autoLoad: true,
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.WFS({
url: url,
version: "1.1.0",
featureType: rawAttributeData.featureTypes[0].typeName,
featureNS: rawAttributeData.targetNamespace,
// srsName: "EPSG:4326",
srsName: "EPSG:2451",
geometryName: geometryName,
maxFeatures: 250
})
}),
fields: fields
}), new Ext.grid.ColumnModel(columns));
app.featureGrid.store.bind(vectorLayer);
app.featureGrid.getSelectionModel().bind(vectorLayer);
}
function setLayer(model, node) {
if(!node || node.layer instanceof OpenLayers.Layer.Vector) {
return;
}
vectorLayer.removeAllFeatures();
app.featureGrid.reconfigure(
new Ext.data.Store(),
new Ext.grid.ColumnModel([])
);
var layer = node.layer;
var url = layer.url.split("?")[0]; // the base url without params
var schema = new GeoExt.data.AttributeStore({
url: url,
// request specific params
baseParams: {
"SERVICE": "WFS",
"REQUEST": "DescribeFeatureType",
"VERSION": "1.1.0",
"TYPENAME": layer.params.LAYERS
},
autoLoad: true,
listeners: {
"load": function(store) {
app.featureGrid.setTitle(layer.name);
reconfigure(store, url);
}
}
});
}
Ext.onReady(function() {
app.tree.getSelectionModel().on(
"selectionchange", setLayer
);
});
// ここまで
</script>---
レイヤの属性の中で、「name」が表示されません。コード中に使用されている「name」に影響されているのかもしれません。属性の「name」を「term」に変更したら表示されるようになりました。
nippon_bmi=> ALTER TABLE akiruno_polygon RENAME name to term; ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_line RENAME name to term; ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_point RENAME name to term; ALTER TABLE
GeoServer で akiruno_polygon akiruno_line akiruno_point レイヤの「Feature Type Details」を確認します。表示されないときは「Reload feature type」をクリックします。
36 - GeoEXT を使用した WFS-T 12 - 選択したレイヤの編集 1
36-12-1 akiruno_point と akiruno_line に 属性を追加
Developing OGC Compliant Web Applications with GeoExt の
3.1. Creating a Synchronized Grid and Map View of WFS Features(http://workshops.boundlessgeo.com/geoext/wfs/grid.html)と3.2. Editing Features and Their Attributes(http://workshops.boundlessgeo.com/geoext/wfs/editing.html)の「Bonus Task」を参考に、「Add to Map」で追加したレイヤを tree で選択して編集します。
「ol017-nippon_bmi_akiruno_pgis.html」をコピーして名前を付けて(「ol017bonus-nippon_bmi_akiruno_pgis.html」など)使います。
最初に、akiruno_point と akiruno_line に akiruno_polygon と同じように属性を追加します。
既存の属性
fid
the_geom
追加の属性
id charactor varying(32)
name charactor varying(32)
address charactor varying(32)
createdate charactor varying(32)
lastupdate charactor varying(32)
category1 charactor varying(32)
category2 charactor varying(32)
category3 charactor varying(32)
user@debian7-vmw:~$ psql nippon_bmi
psql (9.1.11)
"help" でヘルプを表示します.
nippon_bmi=> \d akiruno_point
nippon_bmi=> \d akiruno_line
GeoServer で akiruno_point と akiruno_line レイヤの「Feature Type Details」を確認します。表示されないときは「Reload feature type」をクリックします。
仮の属性の値を追加します。
nippon_bmi=> SELECT fid, id, name, createdate, lastupdate, category1, category2, category3 from akiruno_point;
nippon_bmi=> UPDATE akiruno_point SET id = 'a', name = '点2', address = 'aki', createdate = '2014-2-14', lastupdate = '2014-2-14', category1 = 'c1', category2 = 'c2', category3 = 'c3' where fid = 2;
UPDATE 1
nippon_bmi=> SELECT fid, id, name, address, createdate, lastupdate, category1, category2, category3 from akiruno_line;
nippon_bmi=> UPDATE akiruno_line SET id = 'a', name = '線2', address = 'aki', createdate = '2014-2-14', lastupdate = '2014-2-14', category1 = 'c1', category2 = 'c2', category3 = 'c3' where fid = 3;
UPDATE 1
Developing OGC Compliant Web Applications with GeoExt の
3.1. Creating a Synchronized Grid and Map View of WFS Features(http://workshops.boundlessgeo.com/geoext/wfs/grid.html)と3.2. Editing Features and Their Attributes(http://workshops.boundlessgeo.com/geoext/wfs/editing.html)の「Bonus Task」を参考に、「Add to Map」で追加したレイヤを tree で選択して編集します。
「ol017-nippon_bmi_akiruno_pgis.html」をコピーして名前を付けて(「ol017bonus-nippon_bmi_akiruno_pgis.html」など)使います。
最初に、akiruno_point と akiruno_line に akiruno_polygon と同じように属性を追加します。
既存の属性
fid
the_geom
追加の属性
id charactor varying(32)
name charactor varying(32)
address charactor varying(32)
createdate charactor varying(32)
lastupdate charactor varying(32)
category1 charactor varying(32)
category2 charactor varying(32)
category3 charactor varying(32)
user@debian7-vmw:~$ psql nippon_bmi
psql (9.1.11)
"help" でヘルプを表示します.
nippon_bmi=> ALTER TABLE akiruno_point ADD COLUMN id varchar(32); --- ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_line ADD COLUMN id varchar(32); ---
nippon_bmi=> \d akiruno_point
テーブル "public.akiruno_point"
カラム | 型 | 修飾語
------------+-----------------------+-------------------------------------------------------------
fid | integer | not null default nextval('akiruno_point_fid_seq'::regclass)
the_geom | geometry |
id | character varying(32) |
name | character varying(32) |
address | character varying(32) |
createdate | character varying(32) |
lastupdate | character varying(32) |
category1 | character varying(32) |
category2 | character varying(32) |
category3 | character varying(32) |
インデックス: "akiruno_point_pkey" PRIMARY KEY, btree (fid) "spatial_akiruno_point_the_geom" gist (the_geom) CHECK 制約: "enforce_dims_the_geom" CHECK (st_ndims(the_geom) = 2) "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'MULTIPOINT'::text OR the_geom IS NULL) "enforce_srid_the_geom" CHECK (st_srid(the_geom) = 2451) (END):q
nippon_bmi=> \d akiruno_line
テーブル "public.akiruno_line"
カラム | 型 | 修飾語
------------+-----------------------+------------------------------------------------------------
fid | integer | not null default nextval('akiruno_line_fid_seq'::regclass)
the_geom | geometry |
id | character varying(32) |
name | character varying(32) |
address | character varying(32) |
createdate | character varying(32) |
lastupdate | character varying(32) |
category1 | character varying(32) |
category2 | character varying(32) |
category3 | character varying(32) |
インデックス: "akiruno_line_pkey" PRIMARY KEY, btree (fid) "spatial_akiruno_line_the_geom" gist (the_geom) CHECK 制約: "enforce_dims_the_geom" CHECK (st_ndims(the_geom) = 2) "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'MULTILINESTRING'::text OR the_geom IS NULL) "enforce_srid_the_geom" CHECK (st_srid(the_geom) = 2451) (END):q
GeoServer で akiruno_point と akiruno_line レイヤの「Feature Type Details」を確認します。表示されないときは「Reload feature type」をクリックします。
仮の属性の値を追加します。
nippon_bmi=> SELECT fid, id, name, createdate, lastupdate, category1, category2, category3 from akiruno_point;
fid | id | name | createdate | lastupdate | category1 | category2 | category3 -----+----+------+------------+------------+-----------+-----------+----------- 2 | | | | | | | (1 行)
nippon_bmi=> UPDATE akiruno_point SET id = 'a', name = '点2', address = 'aki', createdate = '2014-2-14', lastupdate = '2014-2-14', category1 = 'c1', category2 = 'c2', category3 = 'c3' where fid = 2;
UPDATE 1
nippon_bmi=> SELECT fid, id, name, address, createdate, lastupdate, category1, category2, category3 from akiruno_line;
fid | id | name | address | createdate | lastupdate | category1 | category2 | category3 -----+----+------+---------+------------+------------+-----------+-----------+----------- 3 | | | | | | | | (1 行) (stdin):q
nippon_bmi=> UPDATE akiruno_line SET id = 'a', name = '線2', address = 'aki', createdate = '2014-2-14', lastupdate = '2014-2-14', category1 = 'c1', category2 = 'c2', category3 = 'c3' where fid = 3;
UPDATE 1
36 - GeoEXT を使用した WFS-T 11 - 編集したフィーチャの保存
36-11 編集したフィーチャの保存Developing OGC Compliant Web Applications with GeoExt の
3.3. Committing Feature Modifications Over WFS-T(http://workshops.boundlessgeo.com/geoext/wfs/wfst.html)を参考に WFS レイヤの編集したフィーチャを保存します。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
akiruno_kukaku レイヤでは新規に作成したフィーチャが保存できなかったので、前回使用した akiruno_polygon レイヤに設定しました。
akiruno_polygon レイヤの属性を追加します。
既存の属性
fid
the_geom
追加の属性
id charactor varying(32)
name charactor varying(32)
address charactor varying(32)
createdate charactor varying(32)
lastupdate charactor varying(32)
category1 charactor varying(32)
category2 charactor varying(32)
category3 charactor varying(32)
user@debian7-vmw:~$ psql nippon_bmi
psql (9.1.11)
"help" でヘルプを表示します.
GeoServer で akiruno_polygon レイヤの「Feature Type Details」を確認します。表示されないときは「Reload feature type」をクリックします。
(属性の保存ができるように列を操作したので、順序が違います。詳細は後で説明します。)
コードの修正
---
1)属性(attribution)を追加した後、WFS フィーチャが表示できなくなりました。
Firebug の「ネット」タブの「POST」に「Failed to get property: gid」が表示されていました。
「Geographic Information Systems Stack Exchange」の「“Failed to get property: gid” error in geoserver sql view」(http://gis.stackexchange.com/questions/83791/failed-to-get-property-gid-error-in-geoserver-sql-view)を参考に、原因を探しました。
結局、GeoServer のログに 「"aki" はジオメトリではない」という意味の記述がありました。
"aki" は、追加した属性の「location」の値です。カラム名が「location」の値は、ジオメトリと判断されてしまうようです。
それで、カラム名の「location」を「address」に変更したら、WFS フィーチャが表示されるようになりました。
このサイトのコードの「new OpenLayers.Protocol.WFS」には、「geometryName」がありませんでしたが、「schema」と共に、追加しました。
---
2)属性の「createdate」と「lastupdate」は日付ですが、EXTJS の「editor: {xtype: "datefield"}」を使用すると追加できない(PostgresQL の型との関係だと思われます)ので、"textfield" にしました。
参考 HTML ファイル
ol017-nippon_bmi_akiruno_pgis.html
3.3. Committing Feature Modifications Over WFS-T(http://workshops.boundlessgeo.com/geoext/wfs/wfst.html)を参考に WFS レイヤの編集したフィーチャを保存します。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
akiruno_kukaku レイヤでは新規に作成したフィーチャが保存できなかったので、前回使用した akiruno_polygon レイヤに設定しました。
akiruno_polygon レイヤの属性を追加します。
既存の属性
fid
the_geom
追加の属性
id charactor varying(32)
name charactor varying(32)
address charactor varying(32)
createdate charactor varying(32)
lastupdate charactor varying(32)
category1 charactor varying(32)
category2 charactor varying(32)
category3 charactor varying(32)
user@debian7-vmw:~$ psql nippon_bmi
psql (9.1.11)
"help" でヘルプを表示します.
nippon_bmi=> ALTER TABLE akiruno_polygon ADD COLUMN id varchar(32); ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_polygon ADD COLUMN name varchar(32); ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_polygon ADD COLUMN address varchar(32); ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_polygon ADD COLUMN createdate varchar(32); ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_polygon ADD COLUMN lastupdate varchar(32); ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_polygon ADD COLUMN category1 varchar(32); ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_polygon ADD COLUMN category2 varchar(32); ALTER TABLE nippon_bmi=> ALTER TABLE akiruno_polygon ADD COLUMN category3 varchar(32); ALTER TABLEnippon_bmi=> \d akiruno_polygon
テーブル "public.akiruno_polygon"
カラム | 型 | 修飾語
------------+-----------------------+---------------------------------------------------------------
fid | integer | not null default nextval('akiruno_polygon_fid_seq'::regclass)
the_geom | geometry |
id | character varying(32) |
name | character varying(32) |
location | character varying(32) |
createdate | character varying(32) |
lastupdate | character varying(32) |
category1 | character varying(32) |
category2 | character varying(32) |
category3 | character varying(32) |
インデックス: "akiruno_polygon_pkey" PRIMARY KEY, btree (fid) "spatial_akiruno_polygon_the_geom" gist (the_geom) CHECK 制約: "enforce_dims_the_geom" CHECK (st_ndims(the_geom) = 2) "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS NULL) "enforce_srid_the_geom" CHECK (st_srid(the_geom) = 2451) (stdin):q
GeoServer で akiruno_polygon レイヤの「Feature Type Details」を確認します。表示されないときは「Reload feature type」をクリックします。
(属性の保存ができるように列を操作したので、順序が違います。詳細は後で説明します。)
コードの修正
---
items.push({
xtype: "editorgrid",
ref: "featureGrid",
title: "Feature Table",
region: "south",
height: 150,
sm: new GeoExt.grid.FeatureSelectionModel(),
store: new GeoExt.data.FeatureStore({
fields: [
// ここから修正
{name: "fid", type: "int"},
{name: "id", type: "string"},
{name: "name", type: "string"},
{name: "address", type: "string"},
{name: "category1", type: "string"},
{name: "category2", type: "string"},
{name: "category3", type: "string"},
{name: "createdate", type: "string"},
{name: "lastupdate", type: "string"}
// ここまで
],
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.WFS({
url: "/geoserver/ows",
version: "1.1.0",
featureType: "akiruno_polygon",
featureNS: "http://www.myhome.net/npn",
srsName: "EPSG:2451",
geometryName: "the_geom", // 追加
schema: "http://192.168.1.200/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=npn:akiruno_polygon" // 追加
})
}),
autoLoad: true
}),
columns: [
// ここから修正
{header: "fid", dataIndex: "fid"},
{header: "id", dataIndex: "id", sortable : true, editor: {xtype: "textfield"}}, // editor: {xtype: "textfield"} 追加
{header: "name", dataIndex: "name", sortable : true, editor: {xtype: "textfield"}},
{header: "address", dataIndex: "address", sortable : true, editor: {xtype: "textfield"}},
{header: "category1", dataIndex: "category1", sortable : true, editor: {xtype: "textfield"}},
{header: "category2", dataIndex: "category2", sortable : true, editor: {xtype: "textfield"}},
{header: "category3", dataIndex: "category3", sortable : true, editor: {xtype: "textfield"}},
{header: "createdate", dataIndex: "createdate", sortable : true, editor: {xtype: "textfield"}},
{header: "lastupdate", dataIndex: "lastupdate", sortable : true, editor: {xtype: "textfield"}}
// ここまで
],
bbar: []
});
---Ext.onReady(function() {
var bbar = app.featureGrid.getBottomToolbar();
bbar.add([{
text: "Delete",
handler: function() {
// ここから追加
app.featureGrid.store.featureFilter = new OpenLayers.Filter({
evaluate: function(feature) {
return feature.state != OpenLayers.State.DELETE;
}
});
// ここまで
app.featureGrid.getSelectionModel().each(function(rec) {
var feature = rec.getFeature();
modifyControl.unselectFeature(feature);
vectorLayer.removeFeatures([feature]);
// ここから追加
if (feature.state != OpenLayers.State.INSERT) {
feature.state = OpenLayers.State.DELETE;
vectorLayer.addFeatures([feature]);
}
// ここまで
});
}
}, new GeoExt.Action({
control: drawControl,
text: "Create",
enableToggle: true
})
// ここから追加
, {
text: "Save",
handler: function() {
app.featureGrid.store.proxy.protocol.commit(
vectorLayer.features, {
callback: function() {
var layers = app.mapPanel.map.layers;
for (var i=layers.length-1; i>=0; --i) {
layers[i].redraw(true);
}
app.featureGrid.store.reload();
}
});
}
// ここまで
}]);
bbar.doLayout();
});
---1)属性(attribution)を追加した後、WFS フィーチャが表示できなくなりました。
Firebug の「ネット」タブの「POST」に「Failed to get property: gid」が表示されていました。
「Geographic Information Systems Stack Exchange」の「“Failed to get property: gid” error in geoserver sql view」(http://gis.stackexchange.com/questions/83791/failed-to-get-property-gid-error-in-geoserver-sql-view)を参考に、原因を探しました。
結局、GeoServer のログに 「"aki" はジオメトリではない」という意味の記述がありました。
"aki" は、追加した属性の「location」の値です。カラム名が「location」の値は、ジオメトリと判断されてしまうようです。
それで、カラム名の「location」を「address」に変更したら、WFS フィーチャが表示されるようになりました。
このサイトのコードの「new OpenLayers.Protocol.WFS」には、「geometryName」がありませんでしたが、「schema」と共に、追加しました。
---
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.WFS({
url: "/geoserver/ows",
version: "1.1.0",
featureType: "akiruno_polygon",
featureNS: "http://www.myhome.net/npn",
srsName: "EPSG:2451",
geometryName: "the_geom", // 追加
schema: "http://192.168.1.200/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=npn:akiruno_polygon" // 追加
})
}),
---2)属性の「createdate」と「lastupdate」は日付ですが、EXTJS の「editor: {xtype: "datefield"}」を使用すると追加できない(PostgresQL の型との関係だと思われます)ので、"textfield" にしました。
参考 HTML ファイル
ol017-nippon_bmi_akiruno_pgis.html
36 - GeoEXT を使用した WFS-T 10 - フィーチャとその属性の編集
36-10 フィーチャとその属性の編集
Developing OGC Compliant Web Applications with GeoExt の
3.2. Editing Features and Their Attributes(http://workshops.boundlessgeo.com/geoext/wfs/editing.html)を参考に WFS レイヤのフィーチャと属性を編集できるようにします。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
---
</script>
---
Developing OGC Compliant Web Applications with GeoExt の
3.2. Editing Features and Their Attributes(http://workshops.boundlessgeo.com/geoext/wfs/editing.html)を参考に WFS レイヤのフィーチャと属性を編集できるようにします。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
---
items.push({
xtype: "editorgrid", // 修正
ref: "featureGrid",
title: "Feature Table",
region: "south",
height: 150,
sm: new GeoExt.grid.FeatureSelectionModel(),
store: new GeoExt.data.FeatureStore({
fields: [
{name: "gid", type: "int"},
{name: "id", type: "string"},
{name: "orggilvl", type: "string"},
{name: "orgmdid", type: "string"},
{name: "category", type: "string"},
{name: "flag", type: "string"},
{name: "type", type: "string"},
{name: "name", type: "string"},
{name: "code", type: "string"}
],
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.WFS({
url: "/geoserver/ows",
version: "1.1.0",
featureType: "akiruno_kukaku",
featureNS: "http://www.myhome.net/npn",
srsName: "EPSG:2451"
}),
})
autoLoad: true
}),
columns: [
{header: "gid", dataIndex: "gid"},
{header: "id", dataIndex: "id", editor: {xtype: "textfield"}}, // editor: {xtype: "textfield"} 追加
{header: "orggilvl", dataIndex: "orggilvl", editor: {xtype: "textfield"}},
{header: "orgmdid", dataIndex: "orgmdid", editor: {xtype: "textfield"}},
{header: "category", dataIndex: "category", editor: {xtype: "textfield"}},
{header: "flag", dataIndex: "flag", editor: {xtype: "textfield"}},
{header: "type", dataIndex: "type", editor: {xtype: "textfield"}},
{header: "name", dataIndex: "name", editor: {xtype: "textfield"}},
{header: "code", dataIndex: "code", editor: {xtype: "textfield"}}
],
bbar: []
});
var vectorLayer = new OpenLayers.Layer.Vector("Editable features");
Ext.onReady(function() {
app.mapPanel.map.addLayer(vectorLayer);
app.featureGrid.store.bind(vectorLayer);
app.featureGrid.getSelectionModel().bind(vectorLayer);
});
// コントロールの追加
var modifyControl = new OpenLayers.Control.ModifyFeature(
vectorLayer, {autoActivate: true}
);
var drawControl = new OpenLayers.Control.DrawFeature(
vectorLayer,
OpenLayers.Handler.Polygon,
{handlerOptions: {multi: true}}
);
controls.push(modifyControl, drawControl);
// グリッドが1行だけ選択されていることを確認
Ext.onReady(function() {
var sm = app.featureGrid.getSelectionModel();
sm.unbind();
sm.bind(modifyControl.selectControl);
sm.on("beforerowselect", function() { sm.clearSelections(); });
});
// "Delete" と "Create" ボタン追加
Ext.onReady(function() {
var bbar = app.featureGrid.getBottomToolbar();
bbar.add([{
text: "Delete",
handler: function() {
app.featureGrid.getSelectionModel().each(function(rec) {
var feature = rec.getFeature();
modifyControl.unselectFeature(feature);
vectorLayer.removeFeatures([feature]);
});
}
}, new GeoExt.Action({
control: drawControl,
text: "Create",
enableToggle: true
})]);
bbar.doLayout();
});
</script>
---
36 - GeoEXT を使用した WFS-T 7 - WMS GetFeatureInfo Popup
36-7 WMS GetFeatureInfo Popup
Developing OGC Compliant Web Applications with GeoExt の
2.4. Explore Map Features with a WMS GetFeatureInfo Popup(http://workshops.boundlessgeo.com/geoext/stores/getfeatureinfo.html)を参考に WMS レイヤの属性をポップアップ表示します。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
---
// ここから追加
// ここまで
</script>
---
Developing OGC Compliant Web Applications with GeoExt の
2.4. Explore Map Features with a WMS GetFeatureInfo Popup(http://workshops.boundlessgeo.com/geoext/stores/getfeatureinfo.html)を参考に WMS レイヤの属性をポップアップ表示します。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
---
<link rel="stylesheet" type="text/css" href="GeoExt/resources/css/geoext-all-debug.css" /> <link rel="stylesheet" type="text/css" href="GeoExt/resources/css/popup.css"><!-- 追加 --> <script type="text/javascript" src="GeoExt/lib/GeoExt.js"></script>
<script type="text/javascript"> OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; // 追加---
// ここから追加
items.push({
xtype: "gx_legendpanel",
region: "east",
width: 200,
autoScroll: true,
padding: 5
});
controls.push(new OpenLayers.Control.WMSGetFeatureInfo({
autoActivate: true,
infoFormat: "application/vnd.ogc.gml",
maxFeatures: 3,
eventListeners: {
"getfeatureinfo": function(e) {
var items = [];
Ext.each(e.features, function(feature) {
items.push({
xtype: "propertygrid",
title: feature.fid,
source: feature.attributes
});
});
new GeoExt.Popup({
title: "Feature Info",
width: 200,
height: 200,
layout: "accordion",
map: app.mapPanel,
location: e.xy,
items: items
}).show();
}
}
}));
// ここまで
</script>
---
36 - GeoEXT を使用した WFS-T 6 - 凡例の表示
36-6 凡例の表示
Developing OGC Compliant Web Applications with GeoExt の
2.3. Adding a Legend Using WMS GetLegendGraphic(http://workshops.boundlessgeo.com/geoext/stores/legend.html)を参考に WMS レイヤの凡例を表示します。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
---
// ここから追加
</script>
---
Developing OGC Compliant Web Applications with GeoExt の
2.3. Adding a Legend Using WMS GetLegendGraphic(http://workshops.boundlessgeo.com/geoext/stores/legend.html)を参考に WMS レイヤの凡例を表示します。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
---
// ここから追加
items.push({
xtype: "gx_legendpanel",
region: "east",
width: 200,
autoScroll: true,
padding: 5
});
// ここまで</script>
---
36 - GeoEXT を使用した WFS-T 5 - Tree の表示
36-5 Tree の表示
Developing OGC Compliant Web Applications with GeoExt の
2.2. Adding a Tree View to Manage the Map Panel’s Layers(http://workshops.boundlessgeo.com/geoext/stores/tree.html)を参考に WMS レイヤ表示操作を Tree でします。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
---
// ここから追加
// ここまで
</script>
---
Developing OGC Compliant Web Applications with GeoExt の
2.2. Adding a Tree View to Manage the Map Panel’s Layers(http://workshops.boundlessgeo.com/geoext/stores/tree.html)を参考に WMS レイヤ表示操作を Tree でします。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。
---
// ここから追加
items.push({
xtype: "treepanel",
ref: "tree",
region: "west",
width: 200,
autoScroll: true,
enableDD: true,
root: new GeoExt.tree.LayerContainer({
expanded: true
}),
bbar: [{
text: "Remove from Map",
handler: function() {
var node = app.tree.getSelectionModel().getSelectedNode();
if (node && node.layer instanceof OpenLayers.Layer.WMS) {
app.mapPanel.map.removeLayer(node.layer);
}
}
}]
});
// ここまで
</script>
---
36 - GeoEXT を使用した WFS-T 4 - Grid の表示
36-4 Grid の表示
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 ブラウザのアドレスバーに上記アドレスを入力して、ダウンロードしたファイルを読み込みました。
---
// ここから追加
</script>
---
レイヤを追加すると倍率が変わってしまいました。
(元の倍率に戻すボタン{地球儀?}をクリックします。)
akiruno_kidou レイヤを追加
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 レイヤを追加
36 - GeoEXT を使用した WFS-T 3 - HTML ファイルの作成
36-3 HTML ファイルの作成
Developing OGC Compliant Web Applications with GeoExt の 1.1. Creating a Map Window ページ(http://workshops.boundlessgeo.com/geoext/basics/map.html)を参考に HTML ファイルを準備します。
1. GeoExt Basics(http://workshops.boundlessgeo.com/geoext/basics/index.html#geoext-basics)を参考に GeoEXT で地図を表示します。
a 「App Exploler」ペインの「ol009-nippon_bmi_akiruno_pgis.html」を右クリックし「コピー」をクリックします。
b 「App Exploler」ペイン上で右クリックし「貼り付け」をクリックします。
c 「名前の競合」ウィンドウで「ol017-nippon_bmi_akiruno_pgis.html」と入力し「OK」ボタンをクリックします。
d 「App Exploler」ペインの「ol017-nippon_bmi_akiruno_pgis.html」をダブルクリックして開きます。
e 次のように内容の一部をコピーして「ol017-nippon_bmi_akiruno_pgis.html」に貼り付け、修正します。
(29-2 で追加したところは削除します。)
---
<!-- ここから追加 -->
ここからコードはほとんど書き換えます。
Map 表示用のコードを利用して修正します。
*/
Developing OGC Compliant Web Applications with GeoExt の 1.1. Creating a Map Window ページ(http://workshops.boundlessgeo.com/geoext/basics/map.html)を参考に HTML ファイルを準備します。
1. GeoExt Basics(http://workshops.boundlessgeo.com/geoext/basics/index.html#geoext-basics)を参考に GeoEXT で地図を表示します。
a 「App Exploler」ペインの「ol009-nippon_bmi_akiruno_pgis.html」を右クリックし「コピー」をクリックします。
b 「App Exploler」ペイン上で右クリックし「貼り付け」をクリックします。
c 「名前の競合」ウィンドウで「ol017-nippon_bmi_akiruno_pgis.html」と入力し「OK」ボタンをクリックします。
d 「App Exploler」ペインの「ol017-nippon_bmi_akiruno_pgis.html」をダブルクリックして開きます。
e 次のように内容の一部をコピーして「ol017-nippon_bmi_akiruno_pgis.html」に貼り付け、修正します。
(29-2 で追加したところは削除します。)
---
<!-- ここから追加 -->
<link rel="stylesheet" type="text/css" href="ext-3.4.1/resources/css/ext-all.css" /> <script type="text/javascript" src="ext-3.4.1/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="ext-3.4.1/ext-all.js"></script> <link rel="stylesheet" type="text/css" href="GeoExt/resources/css/geoext-all-debug.css" /> <script type="text/javascript" src="GeoExt/lib/GeoExt.js"></script><!-- ここまで -->
<script type="text/javascript"> // var map, layer0, layer1, layer2, layer3, layer4; 削除/*
ここからコードはほとんど書き換えます。
Map 表示用のコードを利用して修正します。
*/
Ext.BLANK_IMAGE_URL = "ext-3.4.1/resources/images/default/s.gif"; var app, items = [], controls = [];
Ext.onReady(function() {
app = new Ext.Viewport({
layout: "border",
items: items
});
});
items.push({
xtype: "gx_mappanel",
ref: "mapPanel",
region: "center",
map: {
// numZoomLevels: 19,
controls: controls,
projection: new OpenLayers.Projection("EPSG:2451"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
maxResolution: 'auto',
units: 'meters',
maxExtent: new OpenLayers.Bounds(-63100,-34500,-45400,-24200)
},
/*
extent: OpenLayers.Bounds.fromArray([
-122.911, 42.291,
-122.787, 42.398
]),
*/
/*
layers: [new OpenLayers.Layer.WMS(
"Medford",
"/geoserver/wms",
{layers: "medford"},
{isBaseLayer: false}
)]
*/
// 表示順に並べ換える
layers: [
new OpenLayers.Layer.WMS( "Tokyo Height WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:tokyo10m-epsg2451'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "Tokyo Kuiki WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:tokyo_kuiki',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "Akiruno Kukaku WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:akiruno_kukaku',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "Akiruno Kenchiku WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:akiruno_kenchiku',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
}),
new OpenLayers.Layer.WMS( "Tokyo Public Facilities WMS",
"http://192.168.1.200:8080/geoserver/wms",
{
layers: 'npn:tokyo_pf',
transparent: true,
format: 'image/png'
},{
isBaselayer: false
})
]
});
controls.push( new OpenLayers.Control.Navigation(), new OpenLayers.Control.Attribution(), new OpenLayers.Control.PanPanel(), new OpenLayers.Control.ZoomPanel(), new OpenLayers.Control.LayerSwitcher(), new OpenLayers.Control.MousePosition(), new OpenLayers.Control.ScaleLine() );
</script> </head> <body> </body> </html>
36 - GeoEXT を使用した WFS-T 1 - GeoEXT のインストール
36-1 GeoEXT のインストール
Developing OGC Compliant Web Applications with GeoExt
http://workshops.boundlessgeo.com/geoext/index.html
を参考に GeoEXT で WFS-T 機能を使用してみます。
GeoEXT ホームページ
http://geoext.org/
の Tutorial の GeoExt QuickStart ページ
http://geoext.org/tutorials/quickstart.html
の「Getting GeoEXT」の設定方法に従って、GeoEXT と EXTJS を準備します。
a ダウンロード
次のファイルをダウンロードしました。
GeoEXT:
Download GeoExt ページ
http://geoext.org/downloads.html
GeoExt 1.1 Sources + Full Build
EXT JS:
Download Sencha Ext JS
http://www.sencha.com/products/extjs/download/
Ext JS 3.4.1.1 GPLv3(Ext JS 4 ではありません。GeoExt Code Sprint – Spring 2012{http://boundlessgeo.com/2012/01/geoext-code-sprint-spring-2012/}を参照してください。フリーソフトですがライセンスについては確認してください。)
b インストール
ファイルを解凍して Eclipse の Workspace(私は openlayersTokyoproj)に移動します。
user@debian7-vmw:~$ cd ダウンロード
user@debian7-vmw:~/ダウンロード$ ls
---
GeoExt-1.1.zip
---
ext-3.4.1.1-gpl.zip
---
user@debian7-vmw:~/ダウンロード$ unzip GeoExt-1.1.zip
user@debian7-vmw:~/ダウンロード$ unzip ext-3.4.1.1-gpl.zip
(途中 「replace ...」と表示されたので 「A(ll)」と入力しました。)
user@debian7-vmw:~/ダウンロード$ mv GeoExt ../mapsite/openlayersTokyoproj/
user@debian7-vmw:~/ダウンロード$ mv ext-3.4.1 ../mapsite/openlayersTokyoproj/
Developing OGC Compliant Web Applications with GeoExt
http://workshops.boundlessgeo.com/geoext/index.html
を参考に GeoEXT で WFS-T 機能を使用してみます。
GeoEXT ホームページ
http://geoext.org/
の Tutorial の GeoExt QuickStart ページ
http://geoext.org/tutorials/quickstart.html
の「Getting GeoEXT」の設定方法に従って、GeoEXT と EXTJS を準備します。
a ダウンロード
次のファイルをダウンロードしました。
GeoEXT:
Download GeoExt ページ
http://geoext.org/downloads.html
GeoExt 1.1 Sources + Full Build
EXT JS:
Download Sencha Ext JS
http://www.sencha.com/products/extjs/download/
Ext JS 3.4.1.1 GPLv3(Ext JS 4 ではありません。GeoExt Code Sprint – Spring 2012{http://boundlessgeo.com/2012/01/geoext-code-sprint-spring-2012/}を参照してください。フリーソフトですがライセンスについては確認してください。)
b インストール
ファイルを解凍して Eclipse の Workspace(私は openlayersTokyoproj)に移動します。
user@debian7-vmw:~$ cd ダウンロード
user@debian7-vmw:~/ダウンロード$ ls
---
GeoExt-1.1.zip
---
ext-3.4.1.1-gpl.zip
---
user@debian7-vmw:~/ダウンロード$ unzip GeoExt-1.1.zip
user@debian7-vmw:~/ダウンロード$ unzip ext-3.4.1.1-gpl.zip
(途中 「replace ...」と表示されたので 「A(ll)」と入力しました。)
user@debian7-vmw:~/ダウンロード$ mv GeoExt ../mapsite/openlayersTokyoproj/
user@debian7-vmw:~/ダウンロード$ mv ext-3.4.1 ../mapsite/openlayersTokyoproj/
登録:
コメント (Atom)








































