2014年2月20日木曜日

36 - GeoEXT を使用した WFS-T 9 - WFS レイヤの表示

36-9 WFS レイヤの表示
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)を参考に WFS レイヤを表示します。
続けて「ol017-nippon_bmi_akiruno_pgis.html」を使います。

属性の一部を表示するようにしました。

user@debian7-vmw:~$ psql nippon_bmi
psql (9.1.11)
"help" でヘルプを表示します.
                                 テーブル "public.akiruno_kukaku"
  カラム   |          型           |                            修飾語                            
-----------+-----------------------+--------------------------------------------------------------
 gid       | integer               | not null default nextval('akiruno_kukaku_gid_seq'::regclass)
 id        | character varying(6)  | 
 uuid      | character varying(28) | 
 presences | double precision      | 
 presencef | double precision      | 
 finished  | double precision      | 
 orggilvl  | character varying(4)  | 
 orgmdid   | character varying(7)  | 
 category  | character varying(4)  | 
 flag      | character varying(4)  | 
 type      | character varying(16) | 
 name      | character varying(12) | 
 code      | character varying(5)  | 
 the_geom  | geometry              | 
インデックス:
    "akiruno_kukaku_pkey" PRIMARY KEY, btree (gid)
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) = (-1))

nippon_bmi=> SELECT gid, id, uuid, orggilvl, orgmdid, category, flag, type, name, code from akiruno_kukaku where gid = '1';
 gid |  id  |             uuid             | orggilvl | orgmdid | category | flag |       type       |    name    | code  
-----+------+------------------------------+----------+---------+----------+------+------------------+------------+-------
   1 | K4_1 | fgoid:10-00200-11-6572-94188 | 2500     |         | 表示     | 既存 | 郡市・東京都の区 | あきる野市 | 13228
(1 行)
---
// ここから追加
items.push({
 xtype: "grid",
 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"},
  {header: "orggilvl", dataIndex: "orggilvl"},
  {header: "orgmdid", dataIndex: "orgmdid"},
  {header: "category", dataIndex: "category"},
  {header: "flag", dataIndex: "flag"},
  {header: "type", dataIndex: "type"},
  {header: "name", dataIndex: "name"},
  {header: "code", dataIndex: "code"}
 ],
 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);
});
// ここまで
</script>
---

0 件のコメント: