<div dir="ltr">Hi everyone,<br>I would like to filter the features of a layer based on a filter decided by the user, on the client side, which produces a list of primary key identifiers corresponding to the features to be displayed.<div><br>In my code, I build the list with a database query written in <b>php </b>and I would like to pass the filter to qwc2 with a procedure written in <b>javascript</b>.</div><div><br>At the moment I was only able to calculate the bounding box of the selection of filtered objects and to command the zoom to the same extent on qwc2, using the <b>window.qwc2.zoomToExtent ()</b> function.<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Is there a procedure to also control the features filter?<br></div><div><br></div><div>Assuming that:</div><div><ul><li><b>$filter</b> variable contains the filter decided by the user;</li><li>the frame containing qwc2 is "<b>gfx</b>";</li><li><b>s_bene_tutelato</b> is the layer to be filtered, offered by a Qgis Server and based on the homonymous table of a PostgreSQL + PostGIS database<br></li></ul>, this is my code:<br></div><div><br></div><div><div style="color:rgb(0,0,0);background-color:rgb(255,255,254);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div>    <span style="color:rgb(0,17,136)">$str_sql</span> = <span style="color:rgb(163,21,21)">"SELECT '[' || replace(replace(substring(ST_Expand(ST_Extent(ST_Transform(geom, 32632)), 10000)::text from 5 for 100), ' ', ','), ')', ']')  FROM public.s_bene_tutelato"</span>;</div><div>    <span style="color:rgb(0,0,255)">if</span> (strlen(<span style="color:rgb(0,17,136)">$filter</span>) > <span style="color:rgb(9,134,88)">0</span>) {</div><div>        <span style="color:rgb(0,17,136)">$str_sql</span> = <span style="color:rgb(0,17,136)">$str_sql</span> . <span style="color:rgb(163,21,21)">" where "</span> . <span style="color:rgb(0,17,136)">$filter</span>;</div><div>    }</div><div>    <span style="color:rgb(0,17,136)">$filter_extent</span> = ExecuteScalar(<span style="color:rgb(0,17,136)">$str_sql</span>);</div><br><div>    ?> <script type=<span style="color:rgb(163,21,21)">"text/javascript"</span>></div><div>        <span style="color:rgb(0,0,255)">var</span> layer = {</div><div>            id: <span style="color:rgb(163,21,21)">"myselectionlayer"</span>,</div><div>            role: top.gfx.window.qwc2.LayerRole.SELECTION</div><div>        };</div><div>        top.gfx.window.qwc2.removeLayer(<span style="color:rgb(163,21,21)">"myselectionlayer"</span>);</div><div>        top.gfx.window.qwc2.zoomToExtent(<?=<span style="color:rgb(0,17,136)">$filter_extent</span>;?>, <span style="color:rgb(163,21,21)">"EPSG:32632"</span>);</div><div>    </script> <?php<br></div><br></div></div><div><br></div><div>Thanks for the attention,<br></div><div>Guglielmo</div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div>