<div dir="ltr"><div>Evening all,<br><br></div>I was hesitant to post this here but I am at the end of the road after seeking help on both Stack Overflow and a Google Group prior to this.<br><br>Please could I gain some assistance with the following problem - I would
like to create a CQL filter in Leaflet which filters data from
GeoServer based on user input, with the data hosted in a PostGIS database. I am displaying my layers as WMS, and although I was able to get an
interactive filter working in Openlayers 3, I still have had no luck
with Leaflet.<br><p>I have managed to get the 'static' cql_filter as suggested within my code as below:</p>
<pre><code>var contours = L.tileLayer.wms('<a href="http://gis01-dbn:8080/geoserver/Inyaninga_243-198/wms">http://gis01-dbn:8080/geoserver/Inyaninga_243-198/wms</a>', {
layers: 'Inyaninga_243-198:contours_3857',
format: 'image/png',
transparent: true,
cql_filter: 'elevation= 126',
});
</code></pre>
<p>Is there however any way to make this elevation parameter receive user input and update?</p>
<p>I have created a form in the html as such:</p>
<pre><code><form>
Elevation(m):<br>
<input type="text" id="myInput">
<input type="button" value="Elevation">
</form>
</code></pre>
<p>However, I am getting stuck with passing "myInput" into the cql_filter to accept a value which the user can enter. I have also tried creating a function housing the cql_filter but again
cannot call this into the cql_filter option when loading the WMS layer.<br></p><p>I am new to the web development side of GIS, and currently in the process of self studying this, any help or pointers in the right direction would be greatly appreciated.</p>
<p>Kind regards, <br></p><div><div><div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><font style="background-color:rgb(255,255,255)" color="#666666" face="arial narrow, sans-serif" size="4">Cameron Muller<br></font><div><font style="background-color:rgb(255,255,255)" color="#666666" face="arial narrow, sans-serif">Master of Science: Environmental Sciences</font></div><font style="background-color:rgb(255,255,255)">
</font><font style="background-color:rgb(255,255,255)" color="#666666" face="arial narrow, sans-serif">GISc Technician (GT 1770)<br></font><div><span style="background-color:rgb(255,255,255)"><font color="#666666" face="arial narrow, sans-serif"><font style="background-color:rgb(255,255,255)">072 686 9200<br></font><br></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div></div></div></div>