複数引数を必要とするSQLビューにOpenLayersから引数を渡す
select geometry from shops where shop_code = '%shop_code%' and owner_no = %owner_no%
上記のSQLビューに引数を渡すには以下のように引数「key:value」をセミコロンで連結
var params = "shop_code:123456789;owner_no:54321"; var layer = new OpenLayers.Layer.WMS( "layer name", "../geoserver/ワークスペース名/wms", { LAYERS: 'レイヤ名', format: 'image/png', transparent: true, viewparams: params }, { singleTile: false } ); in句を使った条件に複数の引数を渡す select geometry from shops where shop_code in (%shop_code%)
var params = "shop_code:'123456789'\\,'987654321'"; var layer = new OpenLayers.Layer.WMS( "layer name", "../geoserver/ワークスペース名/wms", { LAYERS: 'レイヤ名', format: 'image/png', transparent: true, viewparams: params }, { singleTile: false } );